]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
12 years agonet: Fix driver name for mdio-gpio.c
Dirk Eibach [Tue, 18 Oct 2011 03:04:11 +0000 (03:04 +0000)]
net: Fix driver name for mdio-gpio.c

Since commit
"7488876... dt/net: Eliminate users of of_platform_{,un}register_driver"
there are two platform drivers named "mdio-gpio" registered.
I renamed the of variant to "mdio-ofgpio".

Signed-off-by: Dirk Eibach <eibach@gdsys.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agom68k: Finally remove leftover markers sections
Kirill Tkhai [Sat, 3 Sep 2011 23:18:37 +0000 (03:18 +0400)]
m68k: Finally remove leftover markers sections

Markers have removed already twice:

1: fc5377668c3d808e1d53c4aee152c836f55c3490
2: eb878b3bc0349344dbf70c51bf01fc734d5cf2d3

But a little bit is still here.

Signed-off-by: Tkhai Kirill <tkhai@yandex.ru>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
12 years agom68k/mac: Fix mac_irq_pending() for PSC MACE and SCC
Finn Thain [Mon, 18 Jul 2011 09:44:17 +0000 (19:44 +1000)]
m68k/mac: Fix mac_irq_pending() for PSC MACE and SCC

Add missing return statement. The docs say that the level 4 PSC IRQs
relate to MACE DMA and SCC. Since those drivers don't call
mac_irq_pending() this patch has no affect. But it should be fixed all the
same, since it can be useful for MACE debugging.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
12 years agom68k/mac: Fix compiler warning in via_read_time()
Finn Thain [Sun, 17 Jul 2011 14:06:10 +0000 (00:06 +1000)]
m68k/mac: Fix compiler warning in via_read_time()

The algorithm described in the comment compares two reads from the RTC but
the code actually reads once and compares the result to an uninitialized
value. This causes the compiler to warn, "last_result maybe used
uninitialized". Make the code match the comment, fix the warning and
perhaps improve reliability. Tested on a Quadra 700.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
12 years agozorro: Fix four checkpatch warnings
Jim Rotmalm [Sun, 17 Jul 2011 21:12:30 +0000 (23:12 +0200)]
zorro: Fix four checkpatch warnings

zorro-driver.c: fix four checkpatch warnings of:
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

I had a cat. The cat was mine.
His name was Zorro. Amiga is fine.

Signed-off-by: Jim Rotmalm <jim.rotmalm@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
12 years agohwmon: (w83627ehf) Better fix for negative temperature values
Jean Delvare [Thu, 20 Oct 2011 07:13:31 +0000 (03:13 -0400)]
hwmon: (w83627ehf) Better fix for negative temperature values

It is more efficient to left-align 8-bit temperature values, so that
8-bit and 9-bit temperature values can be handled exactly the same way
in the rest of the code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (w83627ehf) Uninline is_word_sized
Jean Delvare [Thu, 20 Oct 2011 07:08:27 +0000 (03:08 -0400)]
hwmon: (w83627ehf) Uninline is_word_sized

Helper function is_word_sized has grown too much to be kept inline. It
was OK when there were only 6 word-sized registers but support for new
devices have made the list much longer. The function is also called
from more places than before.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (lm75) Document why clones are not detected
Jean Delvare [Thu, 13 Oct 2011 21:15:11 +0000 (17:15 -0400)]
hwmon: (lm75) Document why clones are not detected

Explain why clones of the LM75 are generally not detected by the
driver, and why this isn't going to change. Also update the
documentation to reflect the list of chip names currently supported by
the driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (w83627ehf) Move fan pins check to a separate function
Jean Delvare [Thu, 13 Oct 2011 14:43:14 +0000 (10:43 -0400)]
hwmon: (w83627ehf) Move fan pins check to a separate function

Move the check of fan pin usage to a separate function. This improves
readability, and will make it easier to integrate chip-specific
conditions.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (w83627ehf) Skip reading unused voltage registers
Jean Delvare [Thu, 13 Oct 2011 14:40:53 +0000 (10:40 -0400)]
hwmon: (w83627ehf) Skip reading unused voltage registers

When in6 is missing, don't read the corresponding registers, it's a
waste of time. The logic is similar to what we do for fans and
temperatures.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (lm75) Add support for Analog Devices ADT75
Michael Hennerich [Thu, 13 Oct 2011 08:43:31 +0000 (04:43 -0400)]
hwmon: (lm75) Add support for Analog Devices ADT75

Add datasheet reference and device ID for ADT75.

The ADT75, like some other LM75 derivatives, needs to be instantiated
using methods 1, 2, or 4.
For more information see Documentation/i2c/instantiating-devices.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (pmbus_core) Simplify sign extensions
Guenter Roeck [Wed, 28 Sep 2011 18:36:20 +0000 (11:36 -0700)]
hwmon: (pmbus_core) Simplify sign extensions

Shift operations can be used for sign extensions. Use it.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus) Add support for Lineage Power DC-DC converters
Guenter Roeck [Thu, 15 Sep 2011 17:43:40 +0000 (10:43 -0700)]
hwmon: (pmbus) Add support for Lineage Power DC-DC converters

Add device IDs and reference to datasheets for Lineage Power DC-DC converters.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus/ltc2978) Add support for LTC3880 to LTC2978 driver
Guenter Roeck [Mon, 12 Sep 2011 03:31:09 +0000 (20:31 -0700)]
hwmon: (pmbus/ltc2978) Add support for LTC3880 to LTC2978 driver

The LTC3880 PMBus command set is comparable to LTC2978. Add support for it
to the LTC2978 driver.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus/ltc2978) Explicit driver for LTC2978
Guenter Roeck [Fri, 2 Sep 2011 16:58:37 +0000 (09:58 -0700)]
hwmon: (pmbus/ltc2978) Explicit driver for LTC2978

Provide explicit driver for LTC2978 to enable support for minimum and peak
attributes. Remove ltc2978 chip id from generic pmbus driver.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus) Add support for TEMP2 peak attributes
Guenter Roeck [Sat, 10 Sep 2011 19:59:15 +0000 (12:59 -0700)]
hwmon: (pmbus) Add support for TEMP2 peak attributes

At least one PMBus chip supports peak attributes for READ_TEMPERATURE2.
Add virtual registers to be able to report it to the user.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: AD7314 driver (ported from IIO)
Jonathan Cameron [Thu, 29 Sep 2011 16:50:04 +0000 (12:50 -0400)]
hwmon: AD7314 driver (ported from IIO)

Driver for AD7314, ADT7301, and ADT7302, ported from IIO.

Currently dropped power down mode support.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
[guenter.roeck@ericsson.com: Added MODULE_DEVICE_TABLE]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (pmbus) Add support for Intersil power management chips
Guenter Roeck [Sat, 30 Jul 2011 05:21:53 +0000 (22:21 -0700)]
hwmon: (pmbus) Add support for Intersil power management chips

Add support for Intersil / Zilker Labs ZL2004, ZL2006, ZL2008, ZL2105, ZL2106,
ZL6100, and ZL6105.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus) Always call _pmbus_read_byte in core driver
Guenter Roeck [Sat, 30 Jul 2011 05:19:39 +0000 (22:19 -0700)]
hwmon: (pmbus) Always call _pmbus_read_byte in core driver

Always call _pmbus_read_byte() instead of pmbus_read_byte() in PMBus core
driver. With this change, device specific read functions can be implemented for
all registers.

Since the device specific read_byte function is now always called, we need to be
more careful with page validations. Only fail if the passed page number is larger
than 0, since -1 means "current page".

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus) Replace EINVAL return codes with more appropriate errors
Guenter Roeck [Thu, 1 Sep 2011 15:34:31 +0000 (08:34 -0700)]
hwmon: (pmbus) Replace EINVAL return codes with more appropriate errors

EINVAL was over-used in the code. Replace it with more appropriate errors.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon: (pmbus) Provide more documentation
Guenter Roeck [Sat, 27 Aug 2011 18:42:30 +0000 (11:42 -0700)]
hwmon: (pmbus) Provide more documentation

Provide more documentation describing PMBus driver functionality and the API
between the PMBus core driver and PMBus chip drivers.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
12 years agohwmon/f71882fg: Make the decision wether to register fan attr. per fan
Hans de Goede [Fri, 9 Sep 2011 10:12:35 +0000 (12:12 +0200)]
hwmon/f71882fg: Make the decision wether to register fan attr. per fan

Before this patch the f71882fg driver completely fails to initialize
on systems which have reserved settings in the pwm enable register, and
it disables all auto pwm sysfs attributes if any fan is controlled by
a digital sensor reading.

This patch changes the fail to initialize into don't register any attributes
for the fan for which there are reserved settings in the pwm enable register
and also makes the not registering of auto pwm sysfs attributes a per fan
thing.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon/f71882fg: Add a f71882fg_create_fan_sysfs_files helper function
Hans de Goede [Fri, 9 Sep 2011 10:12:34 +0000 (12:12 +0200)]
hwmon/f71882fg: Add a f71882fg_create_fan_sysfs_files helper function

This is a preparation patch for not registering fan/pwm attributes for
some fans (rather then register them for all or for none).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon/f71882fg: Make all fan/pwm attr tables 2 dimensional
Hans de Goede [Fri, 9 Sep 2011 10:12:33 +0000 (12:12 +0200)]
hwmon/f71882fg: Make all fan/pwm attr tables 2 dimensional

This is a preparation patch for not registering fan/pwm attributes for
some fans (rather then register them for all or for none).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (exynos4_tmu) Remove IRQF_DISABLED
Yong Zhang [Wed, 21 Sep 2011 09:28:57 +0000 (05:28 -0400)]
hwmon: (exynos4_tmu) Remove IRQF_DISABLED

Since commit [c58543c8: genirq: Run irq handlers with interrupts disabled],
we run all interrupt handlers with interrupts disabled
and we even check and yell when an interrupt handler
returns with interrupts enabled (see commit [b738a50a:
genirq: Warn when handler enables interrupts]).

So now this flag is a NOOP and can be removed.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: Add driver for EXYNOS4 TMU
Donggeun Kim [Wed, 7 Sep 2011 09:49:08 +0000 (18:49 +0900)]
hwmon: Add driver for EXYNOS4 TMU

This patch allows to read temperature
from TMU(Thermal Management Unit) of SAMSUNG EXYNOS4 series of SoC.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (pmbus/adm1275) Add support for ADM1276
Guenter Roeck [Thu, 14 Jul 2011 18:55:35 +0000 (11:55 -0700)]
hwmon: (pmbus/adm1275) Add support for ADM1276

ADM1276 is mostly compatible to ADM1275, with added support for input power
measurement. Add support for it to the ADM1275 driver.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
12 years agohwmon: (pmbus/adm1275) Add support for second current limit
Guenter Roeck [Tue, 2 Aug 2011 18:08:57 +0000 (11:08 -0700)]
hwmon: (pmbus/adm1275) Add support for second current limit

ADM1275 supports a second current limit, which can be configured as either lower
or upper limit. Add support for it and report it as either lower or upper
critical current limit.

Also replace error return code EINVAL for unsupported pages with ENXIO as this
is more appropriate for the observed condition.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
12 years agohwmon: (pmbus) Don't return errors from driver remove functions
Guenter Roeck [Fri, 26 Aug 2011 15:12:38 +0000 (08:12 -0700)]
hwmon: (pmbus) Don't return errors from driver remove functions

Driver remove functions have an error return value, but rarely return an error
in practice. If a driver does return an error from its remove function, the
driver won't be unloaded and is expected to stay alive.

pmbus_do_remove() is defined as returning an int, but always returns 0 (no
error). Calling code passes that return value on to high level driver
remove functions, but does not evaluate it and removes driver data even if
pmbus_do_remove() returned an error (which it in practice never does). Even if
this code could never cause a real problem, it is nevertheless conceptually
wrong.

To reduce confusion and simplify the code, change pmbus_do_remove() to be a void
function, and have PMBus client drivers always return zero in their driver
remove functions.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
12 years agohwmon: (pmbus) Add comments explaining internal driver API return values
Guenter Roeck [Fri, 26 Aug 2011 15:01:51 +0000 (08:01 -0700)]
hwmon: (pmbus) Add comments explaining internal driver API return values

Return values for functions reading/writing manufacturer specific registers are
poorly explained. Add comments to improve documentation.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
12 years agohwmon: (w83627ehf) add caseopen detection
Dmitry Artamonow [Fri, 12 Aug 2011 20:41:11 +0000 (16:41 -0400)]
hwmon: (w83627ehf) add caseopen detection

Export caseopen alarm status into userspace for Winbond W83627*
and Nuvoton NCT677[56] chips and implement alarm clear attribute.
Second caseopen alarm on NCT6776 is also supported.

Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years ago9p: fix 9p.txt to advertise msize instead of maxdata
Nicolae Mogoreanu [Mon, 3 Oct 2011 20:03:53 +0000 (20:03 +0000)]
9p: fix 9p.txt to advertise msize instead of maxdata

9p.txt advertises that maxdata mount option should be used to specify
msize, in the code though we use msize option and completely ignore
maxdata if passed

Signed-off-by: Nicolae Mogoreanu <mogoreanu@gmail.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agonet/9p: Convert net/9p protocol dumps to tracepoints
Aneesh Kumar K.V [Sat, 6 Aug 2011 19:16:59 +0000 (00:46 +0530)]
net/9p: Convert net/9p protocol dumps to tracepoints

This helps in more control over debugging.
root@qemu-img-64:~# ls /pass/123
ls: cannot access /pass/123: No such file or directory
root@qemu-img-64:~# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
#           TASK-PID    CPU#    TIMESTAMP  FUNCTION
#              | |       |          |         |
              ls-1536  [001]    70.928584: 9p_protocol_dump: clnt 18446612132784021504 P9_TWALK(tag = 1)
000: 16 00 00 00 6e 01 00 01 00 00 00 02 00 00 00 01
010: 00 03 00 31 32 33 00 00 00 ff ff ff ff 00 00 00

              ls-1536  [001]    70.928587: <stack trace>
 => trace_9p_protocol_dump
 => p9pdu_finalize
 => p9_client_rpc
 => p9_client_walk
 => v9fs_vfs_lookup
 => d_alloc_and_lookup
 => walk_component
 => path_lookupat
              ls-1536  [000]    70.929696: 9p_protocol_dump: clnt 18446612132784021504 P9_RLERROR(tag = 1)
000: 0b 00 00 00 07 01 00 02 00 00 00 4e 03 00 02 00
010: 00 00 00 00 03 00 02 00 00 00 00 00 ff 43 00 00

              ls-1536  [000]    70.929697: <stack trace>
 => trace_9p_protocol_dump
 => p9_client_rpc
 => p9_client_walk
 => v9fs_vfs_lookup
 => d_alloc_and_lookup
 => walk_component
 => path_lookupat
 => do_path_lookup

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agofs/9p: change an int to unsigned int
Dan Carpenter [Fri, 26 Aug 2011 16:57:40 +0000 (19:57 +0300)]
fs/9p: change an int to unsigned int

Without this msize=4294967295 will result in a crash

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agofs/9p: Cleanup option parsing in 9p
Aneesh Kumar K.V [Tue, 30 Aug 2011 06:49:34 +0000 (12:19 +0530)]
fs/9p: Cleanup option parsing in 9p

Instead of saying all integer argument option should be listed in the beginning
move integer parsing to each option type.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years ago9p: move dereference after NULL check
Dan Carpenter [Fri, 26 Aug 2011 16:55:59 +0000 (19:55 +0300)]
9p: move dereference after NULL check

We dereferenced "req->tc" and "req->rc" before checking for NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agofs/9p: inode file operation is properly initialized init_special_inode
Aneesh Kumar K.V [Tue, 30 Aug 2011 06:01:21 +0000 (11:31 +0530)]
fs/9p: inode file operation is properly initialized init_special_inode

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agofs/9p: Update zero-copy implementation in 9p
Aneesh Kumar K.V [Tue, 16 Aug 2011 05:20:10 +0000 (10:50 +0530)]
fs/9p: Update zero-copy implementation in 9p

* remove lot of update to different data structure
* add a seperate callback for zero copy request.
* above makes non zero copy code path simpler
* remove conditionalizing TREAD/TREADDIR/TWRITE in the zero copy path
* Fix the dotu p9_check_errors with zero copy. Add sufficient doc around
* Add support for both in and output buffers in zero copy callback
* pin and unpin pages in the same context
* use helpers instead of defining page offset and rest of page ourself
* Fix mem leak in p9_check_errors
* Remove 'E' and 'F' in p9pdu_vwritef

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
12 years agoMerge commit 'v3.1' into devicetree/next
Grant Likely [Mon, 24 Oct 2011 15:03:35 +0000 (17:03 +0200)]
Merge commit 'v3.1' into devicetree/next

12 years agodt: Add empty of_match_node() macro
Nicolas Ferre [Mon, 24 Oct 2011 09:53:32 +0000 (11:53 +0200)]
dt: Add empty of_match_node() macro

Add an empty macro for of_match_node() that will save
some '#ifdef CONFIG_OF' for non-dt builds.

I have chosen to use a macro instead of a function to
be able to avoid defining the first parameter.
In fact, this "struct of_device_id *" first parameter
is usualy not defined as well on non-dt builds.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
12 years agonfs41: implement DESTROY_CLIENTID operation
Mi Jinlong [Thu, 20 Oct 2011 09:51:39 +0000 (17:51 +0800)]
nfs41: implement DESTROY_CLIENTID operation

According to rfc5661 18.50, implement DESTROY_CLIENTID operation.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
12 years agonfsd4: typo logical vs bitwise negate for want_mask
Benny Halevy [Thu, 20 Oct 2011 02:13:29 +0000 (19:13 -0700)]
nfsd4: typo logical vs bitwise negate for want_mask

Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
12 years agonfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UN...
Benny Halevy [Thu, 20 Oct 2011 02:13:13 +0000 (19:13 -0700)]
nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED

RFC5661 says:
   The client may set one or both of
   OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL and
   OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED.

Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
12 years agonfsd4: seq->status_flags may be used unitialized
Benny Halevy [Thu, 20 Oct 2011 02:13:06 +0000 (19:13 -0700)]
nfsd4: seq->status_flags may be used unitialized

Reported-by: Gopala Suryanarayana <gsuryanarayana@vmware.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
12 years agonfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid
Benny Halevy [Thu, 20 Oct 2011 02:12:58 +0000 (19:12 -0700)]
nfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
12 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
David S. Miller [Mon, 24 Oct 2011 07:12:49 +0000 (03:12 -0400)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

12 years agoLinux 3.1 v3.1
Linus Torvalds [Mon, 24 Oct 2011 07:10:05 +0000 (09:10 +0200)]
Linux 3.1

12 years agoipv4: tcp: fix TOS value in ACK messages sent from TIME_WAIT
Eric Dumazet [Mon, 24 Oct 2011 07:06:21 +0000 (03:06 -0400)]
ipv4: tcp: fix TOS value in ACK messages sent from TIME_WAIT

There is a long standing bug in linux tcp stack, about ACK messages sent
on behalf of TIME_WAIT sockets.

In the IP header of the ACK message, we choose to reflect TOS field of
incoming message, and this might break some setups.

Example of things that were broken :
  - Routing using TOS as a selector
  - Firewalls
  - Trafic classification / shaping

We now remember in timewait structure the inet tos field and use it in
ACK generation, and route lookup.

Notes :
 - We still reflect incoming TOS in RST messages.
 - We could extend MuraliRaja Muniraju patch to report TOS value in
netlink messages for TIME_WAIT sockets.
 - A patch is needed for IPv6

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agortnetlink: Add missing manual netlink notification in dev_change_net_namespaces
Eric W. Biederman [Fri, 21 Oct 2011 06:24:20 +0000 (06:24 +0000)]
rtnetlink: Add missing manual netlink notification in dev_change_net_namespaces

Renato Westphal noticed that since commit a2835763e130c343ace5320c20d33c281e7097b7
"rtnetlink: handle rtnl_link netlink notifications manually" was merged
we no longer send a netlink message when a networking device is moved
from one network namespace to another.

Fix this by adding the missing manual notification in dev_change_net_namespaces.

Since all network devices that are processed by dev_change_net_namspaces are
in the initialized state the complicated tests that guard the manual
rtmsg_ifinfo calls in rollback_registered and register_netdevice are
unnecessary and we can just perform a plain notification.

Cc: stable@kernel.org
Tested-by: Renato Westphal <renatowestphal@gmail.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoipv4: fix ipsec forward performance regression
Yan, Zheng [Sat, 22 Oct 2011 21:58:20 +0000 (21:58 +0000)]
ipv4: fix ipsec forward performance regression

There is bug in commit 5e2b61f(ipv4: Remove flowi from struct rtable).
It makes xfrm4_fill_dst() modify wrong data structure.

Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
Reported-by: Kim Phillips <kim.phillips@freescale.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agojme: fix irq storm after suspend/resume
Clemens Buchacher [Sat, 22 Oct 2011 02:56:20 +0000 (02:56 +0000)]
jme: fix irq storm after suspend/resume

If the device is down during suspend/resume, interrupts are enabled
without a registered interrupt handler, causing a storm of
unhandled interrupts until the IRQ is disabled because "nobody
cared".

Instead, check that the device is up before touching it in the
suspend/resume code.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=39112

Helped-by: Adrian Chadd <adrian@freebsd.org>
Helped-by: Mohammed Shafi <shafi.wireless@gmail.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoroute: fix ICMP redirect validation
Flavio Leitner [Mon, 24 Oct 2011 06:56:38 +0000 (02:56 -0400)]
route: fix ICMP redirect validation

The commit f39925dbde7788cfb96419c0f092b086aa325c0f
(ipv4: Cache learned redirect information in inetpeer.)
removed some ICMP packet validations which are required by
RFC 1122, section 3.2.2.2:
...
  A Redirect message SHOULD be silently discarded if the new
  gateway address it specifies is not on the same connected
  (sub-) net through which the Redirect arrived [INTRO:2,
  Appendix A], or if the source of the Redirect is not the
  current first-hop gateway for the specified destination (see
  Section 3.3.1).

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agonet: hold sock reference while processing tx timestamps
Richard Cochran [Fri, 21 Oct 2011 00:49:15 +0000 (00:49 +0000)]
net: hold sock reference while processing tx timestamps

The pair of functions,

 * skb_clone_tx_timestamp()
 * skb_complete_tx_timestamp()

were designed to allow timestamping in PHY devices. The first
function, called during the MAC driver's hard_xmit method, identifies
PTP protocol packets, clones them, and gives them to the PHY device
driver. The PHY driver may hold onto the packet and deliver it at a
later time using the second function, which adds the packet to the
socket's error queue.

As pointed out by Johannes, nothing prevents the socket from
disappearing while the cloned packet is sitting in the PHY driver
awaiting a timestamp. This patch fixes the issue by taking a reference
on the socket for each such packet. In addition, the comments
regarding the usage of these function are expanded to highlight the
rule that PHY drivers must use skb_complete_tx_timestamp() to release
the packet, in order to release the socket reference, too.

These functions first appeared in v2.6.36.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Cc: <stable@vger.kernel.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotcp: md5: add more const attributes
Eric Dumazet [Mon, 24 Oct 2011 06:46:04 +0000 (02:46 -0400)]
tcp: md5: add more const attributes

Now tcp_md5_hash_header() has a const tcphdr argument, we can add more
const attributes to callers.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoAdd ethtool -g support to virtio_net
Rick Jones [Wed, 19 Oct 2011 08:10:59 +0000 (08:10 +0000)]
Add ethtool -g support to virtio_net

Add support for reporting ring sizes via ethtool -g to the virtio_net
driver.

Signed-off-by: Rick Jones <rick.jones2@hp.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agotcp: md5: dont write skb head in tcp_md5_hash_header()
Eric Dumazet [Mon, 24 Oct 2011 05:52:35 +0000 (01:52 -0400)]
tcp: md5: dont write skb head in tcp_md5_hash_header()

tcp_md5_hash_header() writes into skb header a temporary zero value,
this might confuse other users of this area.

Since tcphdr is small (20 bytes), copy it in a temporary variable and
make the change in the copy.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoMerge git://git.infradead.org/iommu-2.6
Linus Torvalds [Mon, 24 Oct 2011 05:08:24 +0000 (07:08 +0200)]
Merge git://git.infradead.org/iommu-2.6

* git://git.infradead.org/iommu-2.6:
  intel-iommu: fix superpage support in pfn_to_dma_pte()
  intel-iommu: set iommu_superpage on VM domains to lowest common denominator
  intel-iommu: fix return value of iommu_unmap() API
  MAINTAINERS: Update VT-d entry for drivers/pci -> drivers/iommu move
  intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.
  intel-iommu: Workaround IOTLB hang on Ironlake GPU
  intel-iommu: Fix AB-BA lockdep report

12 years agoMerge branch 'for-linus' of http://people.redhat.com/agk/git/linux-dm
Linus Torvalds [Mon, 24 Oct 2011 05:05:38 +0000 (07:05 +0200)]
Merge branch 'for-linus' of http://people.redhat.com/agk/git/linux-dm

* 'for-linus' of http://people.redhat.com/agk/git/linux-dm:
  dm kcopyd: fix job_pool leak

12 years agox86: Fix S4 regression
Takashi Iwai [Sun, 23 Oct 2011 21:19:12 +0000 (23:19 +0200)]
x86: Fix S4 regression

Commit 4b239f458 ("x86-64, mm: Put early page table high") causes a S4
regression since 2.6.39, namely the machine reboots occasionally at S4
resume.  It doesn't happen always, overall rate is about 1/20.  But,
like other bugs, once when this happens, it continues to happen.

This patch fixes the problem by essentially reverting the memory
assignment in the older way.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Yinghai Lu <yinghai.lu@oracle.com>
[ We'll hopefully find the real fix, but that's too late for 3.1 now ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agotarget: Remove legacy se_task->task_timer and associated logic
Nicholas Bellinger [Mon, 24 Oct 2011 01:46:36 +0000 (18:46 -0700)]
target: Remove legacy se_task->task_timer and associated logic

This patch removes the legacy usage of se_task->task_timer and associated
infrastructure that originally was used as a way to help manage buggy backend
SCSI LLDs that in certain cases would never return back an outstanding task.

This includes the removal of target_complete_timeout_work(), timeout logic
from transport_complete_task(), transport_task_timeout_handler(),
transport_start_task_timer(), the per device task_timeout configfs attribute,
and all task_timeout associated structure members and defines in
target_core_base.h

This is being removed in preparation to make transport_complete_task() run
in lock-less mode.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Fix incorrect transport_sent usage
Nicholas Bellinger [Mon, 24 Oct 2011 01:16:13 +0000 (18:16 -0700)]
target: Fix incorrect transport_sent usage

This patch converts target-core to use se_cmd->t_transport_sent instead of
a duplicated se_cmd->transport_sent member in a handful of locations.
It also updates iscsi_target to properly use ->t_transport_sent instead of
it's own iscsi_cmd_t->transport_sent value that was not being assigned.

Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: re-use the command S/G list for single-task commands
Christoph Hellwig [Tue, 18 Oct 2011 10:57:03 +0000 (06:57 -0400)]
target: re-use the command S/G list for single-task commands

If we only have a single task per command (which at least in my testing
is the by far most common case) we do not have to allocate a new per-task
S/G list but can reuse the one from the command.

(nab: Fix BIDI handling in transport_free_dev_tasks)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Fix BIDI t_task_cdb handling in transport_generic_new_cmd
Nicholas Bellinger [Sat, 22 Oct 2011 11:06:23 +0000 (04:06 -0700)]
target: Fix BIDI t_task_cdb handling in transport_generic_new_cmd

This patch fixes a bug for BIDI handling in transport_generic_new_cmd() where
cmd->t_task_cdbs_left and Co. where not taking into account the extra
task count generated during the first call to transport_allocate_data_tasks().

Cc: Christoph Hellwig <hch@lst.de>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove transport_allocate_tasks
Christoph Hellwig [Tue, 18 Oct 2011 10:57:02 +0000 (06:57 -0400)]
target: remove transport_allocate_tasks

There were only two callers, and one of them always wants the call
to transport_allocate_data_tasks anyway.  Also drop the constant
lba argument to transport_allocate_data_tasks and move the variables
inside it into the minimum required scope.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: merge transport_new_cmd_obj into transport_generic_new_cmd
Christoph Hellwig [Tue, 18 Oct 2011 10:57:01 +0000 (06:57 -0400)]
target: merge transport_new_cmd_obj into transport_generic_new_cmd

These are two fairly small functions, and merging them gives a much
more readable control flow, and opportunities for more useful comments.

It also moves all code related to resources allocation closer together
and allows to remove a forward declaration for transport_allocate_tasks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove the task_sg_bidi field se_task and pSCSI BIDI support
Christoph Hellwig [Tue, 18 Oct 2011 10:57:00 +0000 (06:57 -0400)]
target: remove the task_sg_bidi field se_task and pSCSI BIDI support

This field is never used given that BIDI handling happens at the
command and not the task level.  Remove it and the dead code in
pscsi that tries to work on it.

It also prevents pSCSI passthrough for the two currently enabled BIDI
commands now that task->task_sg_bidi support has been removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: transport_subsystem_check_init cleanups
Nicholas Bellinger [Sat, 22 Oct 2011 08:03:54 +0000 (01:03 -0700)]
target: transport_subsystem_check_init cleanups

Remove the now unnecessary extra call to transport_subsystem_check_init() in
target_core_register_fabric(), and also merge transport_subsystem_reqmods()
directly into transport_subsystem_check_init().

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: use a workqueue for I/O completions
Christoph Hellwig [Mon, 17 Oct 2011 17:56:53 +0000 (13:56 -0400)]
target: use a workqueue for I/O completions

Instead of abusing the target processing thread for offloading I/O
completion in the backends to user context add a new workqueue.  This means
completions can be processed as fast as available CPU time allows it,
including in parallel with other completions and more importantly I/O
submission or QUEUE FULL retries.  This should give much better performance
especially on loaded systems.

As a fallout we can merge all the completed states into a single
one.

On the downside this change complicates lun reset handling a bit by
requiring us to cancel a work item only for those states that have it
initialized.  The alternative would be to either always initialize the work
item to a dummy handler, or always use the same handler and do a switch on
the state. The long term solution will be a flag that says that the command
has an initialized work item, but that's only going to be useful once we
have more users.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove unused TRANSPORT_ states
Christoph Hellwig [Mon, 17 Oct 2011 17:56:52 +0000 (13:56 -0400)]
target: remove unused TRANSPORT_ states

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove TRANSPORT_DEFERRED_CMD state
Christoph Hellwig [Mon, 17 Oct 2011 17:56:51 +0000 (13:56 -0400)]
target: remove TRANSPORT_DEFERRED_CMD state

We never check for this state, and it makes testing for a completed
state much harder given that it overrides the existing state.

Also remove the unused deferred_t_state which is related to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove the TRANSPORT_REMOVE state
Christoph Hellwig [Mon, 17 Oct 2011 17:56:50 +0000 (13:56 -0400)]
target: remove the TRANSPORT_REMOVE state

We never queue an command with this state, and only set it in a completely
bogus place in tcm_fc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: move depth_left manipulation out of transport_generic_request_failure
Christoph Hellwig [Mon, 17 Oct 2011 17:56:49 +0000 (13:56 -0400)]
target: move depth_left manipulation out of transport_generic_request_failure

We only need to decrement dev->depth_left if failing a command from
__transport_execute_tasks.  Instead of doing it first thing in
transport_generic_request_failure and requiring a pseudo-flag argument
for it just opencode the decrement in the two callers (which should
be factored into a single one anyway)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: stop task timers earlier
Christoph Hellwig [Mon, 17 Oct 2011 17:56:48 +0000 (13:56 -0400)]
target: stop task timers earlier

Currently we stop the timers for all tasks in a command fairly late during
I/O completion, which is fairly pointless and requires all kinds of safety
checks.

Instead delete pending timers early on in transport_complete_task, thus
ensuring no new timers firest after that.  We take t_state_lock a bit later
in that function thus making sure currenly running timers are out of the
criticial section.  To be completely sure the timer has finished we also
add another del_timer_sync call when freeing the task.

This also allows removing TF_TIMER_RUNNING as it would be equivalent
to TF_ACTIVE now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove TF_TIMER_STOP
Christoph Hellwig [Mon, 17 Oct 2011 17:56:47 +0000 (13:56 -0400)]
target: remove TF_TIMER_STOP

TF_TIMER_STOP is useless as it only helps to mitigate a tiny race during
deleting the timer.  But given that we have cleared TF_ACTIVE at this point
we already have another mitigation a few lines down the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: factor some duplicate code for stopping a task
Christoph Hellwig [Mon, 17 Oct 2011 17:56:46 +0000 (13:56 -0400)]
target: factor some duplicate code for stopping a task

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: fix list walking in transport_free_dev_tasks
Christoph Hellwig [Mon, 17 Oct 2011 17:56:45 +0000 (13:56 -0400)]
target: fix list walking in transport_free_dev_tasks

list_for_each_entry_safe only protects against deletions from the list,
but not against any concurrent modifications.  Given that we drop
t_state_lock inside the loop it is not safe in transport_free_dev_tasks.

Instead of use a local dispose_list that we move all tasks that are
to be deleted to.  This is safe because we never do list_emptry checks
on t_list to check if a command is on the list anywhere.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: use transport_cmd_check_stop_to_fabric consistently
Christoph Hellwig [Mon, 17 Oct 2011 17:56:44 +0000 (13:56 -0400)]
target: use transport_cmd_check_stop_to_fabric consistently

Change one remaining user of transport_cmd_check_stop(cmd, 2, 0) to the
transport_cmd_check_stop_to_fabric wrapper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: do not pass the queue object to transport_remove_cmd_from_queue
Christoph Hellwig [Mon, 17 Oct 2011 17:56:43 +0000 (13:56 -0400)]
target: do not pass the queue object to transport_remove_cmd_from_queue

We always operated on the same queue, so move finding it into the function,
just like we do for all other helpers operating on it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove SCF_EMULATE_QUEUE_FULL
Christoph Hellwig [Mon, 17 Oct 2011 17:56:42 +0000 (13:56 -0400)]
target: remove SCF_EMULATE_QUEUE_FULL

Add a new boolean at_head parameter to transport_add_cmd_to_queue and thus
obsolete the SCF_EMULATE_QUEUE_FULL flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: remove the transport_qf_callback se_cmd callback
Christoph Hellwig [Mon, 17 Oct 2011 17:56:41 +0000 (13:56 -0400)]
target: remove the transport_qf_callback se_cmd callback

Remove the need for the transport_qf_callback callback by making
sure we have specific states with specific handlers for the two
queue full cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: clean up the backend interface to caching parameters
Christoph Hellwig [Fri, 14 Oct 2011 11:30:17 +0000 (07:30 -0400)]
target: clean up the backend interface to caching parameters

Remove the dpo_emulated, fua_write_emulated, fua_read_emulated and
write_cache_emulated methods, and replace them with a simple bitfields in
se_subsystem_api in those cases where they ever returned one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: make iblock_emulate_sync_cache asynchronous
Christoph Hellwig [Fri, 14 Oct 2011 11:29:58 +0000 (07:29 -0400)]
target: make iblock_emulate_sync_cache asynchronous

Do not block the submitting thread when handling a SYNCHRONIZE CACHE command,
but implement it asynchronously by sending the FLUSH command ourself and
calling transport_complete_sync_cache from the completion handler.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Fix REPORT TARGET PORT GROUPS handling with small allocation length
Nicholas Bellinger [Wed, 19 Oct 2011 06:48:04 +0000 (23:48 -0700)]
target: Fix REPORT TARGET PORT GROUPS handling with small allocation length

This patch fixes a bug with the handling of REPORT TARGET PORT GROUPS
containing a smaller allocation length than the payload requires causing
memory writes beyond the end of the buffer.  This patch checks for the
minimum 4 byte length for the response payload length, and also checks
upon each loop of T10_ALUA(su_dev)->tg_pt_gps_list to ensure the Target
port group and Target port descriptor list is able to fit into the
remaining allocation length.

If the response payload exceeds the allocation length length, then rd_len
is still increments to indicate to the initiator that the payload has
been truncated.

Reported-by: Roland Dreier <roland@purestorage.com>
Cc: stable@kernel.org
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
12 years agotarget: remove the ->transport_split_cdb callback in se_cmd
Christoph Hellwig [Wed, 12 Oct 2011 15:09:13 +0000 (11:09 -0400)]
target: remove the ->transport_split_cdb callback in se_cmd

Add a switch statement implementing the CDB LBA/len update directly
in target_get_task_cdb and remove the old ->transport_split_cdb
callback and all its implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: replace ->get_cdb with a target_get_task_cdb helper
Christoph Hellwig [Wed, 12 Oct 2011 15:09:12 +0000 (11:09 -0400)]
target: replace ->get_cdb with a target_get_task_cdb helper

Instead of calling out to the backends from the core to get a per-task
CDB and then modify it for the LBA/len pair used for this CDB provide
a helper that writes the adjusted CDB into a provided buffer and call
this method from ->do_task in pscsi.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: make the ->get_cdb method optional
Christoph Hellwig [Wed, 12 Oct 2011 15:09:11 +0000 (11:09 -0400)]
target: make the ->get_cdb method optional

The most commonly used file, iblock and rd backends have no use for
a per-task CDB and thus don't need a method to copy it into their
otherwise unused CDB fields.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: pack struct se_task more tightly
Christoph Hellwig [Wed, 12 Oct 2011 15:07:07 +0000 (11:07 -0400)]
target: pack struct se_task more tightly

Rearrange the fields in se_task to avoid holes.  Also increase the
flags field to 16 bits as we have the space for it, and this makes
adding new flags safer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Remove unnecessary se_task members
Christoph Hellwig [Wed, 12 Oct 2011 15:07:04 +0000 (11:07 -0400)]
target: Remove unnecessary se_task members

This is a squashed version of the following unnecessary se_task structure
member removal patches:

target: remove the task_execute_queue field in se_task

    Instead of using a separate flag we can simply do list_emptry checks
    on t_execute_list if we make sure to always use list_del_init to remove
    a task from the list.  Also factor some duplicate code into a new
    __transport_remove_task_from_execute_queue helper.

target: remove the read-only task_no field in se_task

    The task_no field never was initialized and only used in debug printks,
    so kill it.

target: remove the task_padded_sg field in se_task

    This field is only check in one place and not actually needed there.

    Rationale:
    - transport_do_task_sg_chain asserts that we have task_sg_chaining
      set early on
    - we only make use of the sg_prev_nents field we calculate based on it
      if there is another sg list that gets chained onto this one, which
      never happens for the last (or only) task.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: make more use of the task_flags field in se_task
Christoph Hellwig [Wed, 12 Oct 2011 15:07:03 +0000 (11:07 -0400)]
target: make more use of the task_flags field in se_task

Replace various atomic_t variables that were mostly under t_state_lock
with new flags in task_flags.  Note that the execution error path
didn't take t_state_lock before, so add it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Cleanup unused se_task bits
Christoph Hellwig [Wed, 12 Oct 2011 15:07:00 +0000 (11:07 -0400)]
target: Cleanup unused se_task bits

This is a squashed version of the following se_task cleanup patches:

    target: remove the unused task_state_flags field in se_task
    target: remove the unused se_obj_ptr field in se_task
    target: remove the se_dev field in se_task

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Cleanup unused target_core_base.h bits
Christoph Hellwig [Wed, 12 Oct 2011 15:06:56 +0000 (11:06 -0400)]
target: Cleanup unused target_core_base.h bits

This is a squashed version of the following target_core_base.h
cleanup patches:

    target: remove the unused SHUTDOWN_SIGS defintion
    target: remove unused se_mem leftovers
    target: remove the unused map_func_t typedef
    target: move TRANSPORT_IOV_DATA_BUFFER to the iscsi-specific code

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agoloopback: Prevent uninitialized use of tl_tpg in tcm_loop_queuecommand
Nicholas Bellinger [Tue, 11 Oct 2011 02:44:05 +0000 (19:44 -0700)]
loopback: Prevent uninitialized use of tl_tpg in tcm_loop_queuecommand

This patch fixes a bug with tcm_loop where performing a scsi_host rescan was
causing an oops due to a received scsi_cmnd->device->id value not matching a
previously configured tcm_loop_tpg entry in tcm_loop_hba->tl_hba_tpgs[]
obtained from within tcm_loop_queuecommand() code.

This fix adds an explict check for tcm_loop_tpg->tl_hba in order to ensure
tcm_loop_make_naa_tpg() has already been invoked to initialize a given
tcm_loop_tpg entry, and also adds an explict clear of tcm_loop_tpg->tl_hba
from within the tcm_loop_drop_naa_tpg() release path.

This bug was manifesting itself with the following OOPs:

[176289.430909] BUG: unable to handle kernel NULL pointer dereference at 0000000000000090
[176289.431337] IP: [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
[176289.431399] PGD 22e9b067 PUD 23375067 PMD 0
[176289.431399] Oops: 0000 [#1] SMP
[176289.431815] CPU 1
[176289.431815] Modules linked in: tcm_loop target_core_stgt target_core_pscsi target_core_file target_core_iblock target_core_mod crc32c ib_cm ib_sa ib_mad ib_core qla2xxx scsi_tgt configfs fcoe libfcoe libfc scsi_transport_fc ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi sr_mod cdrom sd_mod ata_piix libata e1000 mptspi mptscsih mptbase [last unloaded: target_core_mod]
[176289.431815]
[176289.431815] Pid: 12339, comm: LIO_iblock Tainted: G        W   3.1.0-rc8+
[176289.431815] RIP: 0010:[<ffffffffa0395617>]  [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
[176289.431815] RSP: 0018:ffff880023bfbe10  EFLAGS: 00010283
[176289.431815] RAX: 0000000000000000 RBX: ffff88002d600040 RCX: ffff88002d600108
[176289.431815] RDX: ffff88000c9e50bc RSI: 0000000000000246 RDI: 0000000000000246
[176289.431815] RBP: ffff880023bfbee0 R08: ffff88002d600108 R09: 0000000000000000
[176289.431815] R10: ffff88002fc8cc80 R11: ffffffff81671b60 R12: ffff88002d600108
[176289.431815] R13: ffff88000c9e4f38 R14: ffff88000c9e50b8 R15: 0000000000000000
[176289.431815] FS:  0000000000000000(0000) GS:ffff88002fc80000(0000) knlGS:0000000000000000
[176289.431815] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[176289.431815] CR2: 0000000000000090 CR3: 000000002a33f000 CR4: 00000000000006e0
[176289.431815] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[176289.431815] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[176289.431815] Process LIO_iblock (pid: 12339, threadinfo ffff880023bfa000, task ffff88002a2e0000)
[176289.431815] Stack:
[176289.431815]  0000000000011280 0000000000000246 ffff88002a2e0000 ffff880023a58900
[176289.431815]  ffff880023bfbed0 ffff880023bfa000 ffff880023bfa000 ffff88000c9e50d0
[176289.431815]  ffff88000c9e50c0 ffff88000c9e50bc ffff880023bfa000 ffff880023bfbfd8
[176289.431815] Call Trace:
[176289.431815]  [<ffffffff81056657>] ? wake_up_bit+0x25/0x25
[176289.431815]  [<ffffffffa0395434>] ? transport_handle_cdb_direct+0x92/0x92 [target_core_mod]
[176289.431815]  [<ffffffff8105619a>] kthread+0x7d/0x85
[176289.431815]  [<ffffffff813cbcb4>] kernel_thread_helper+0x4/0x10
[176289.431815]  [<ffffffff8105611d>] ? kthread_worker_fn+0x16d/0x16d
[176289.431815]  [<ffffffff813cbcb0>] ? gs_change+0x13/0x13
[176289.431815] Code: 67 05 00 00 41 8b 84 24 4c ff ff ff ff c8 83 f8 11 0f 87 f0 04 00 00 89 c0 ff 24 c5 b0 c6 39 a0 0f 0b eb fe 48 8b 83 d8 00 00 00
[176289.431815] RIP  [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
[176289.431815]  RSP <ffff880023bfbe10>
[176289.431815] CR2: 0000000000000090
[176295.041004] ---[ end trace 85dc6865b23b8f3e ]---

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Remove legacy + unused device active I/O shutdown code
Nicholas Bellinger [Sun, 9 Oct 2011 09:19:01 +0000 (02:19 -0700)]
target: Remove legacy + unused device active I/O shutdown code

This patch removes the legacy device active I/O shutdown code that was
originally called from transport_processing_thread() context during shutdown
including transport_processing_shutdown() and transport_release_all_cmds().

This is due to the fact that in modern configfs control plane code by the
time shutdown of an se_device instance in transport_processing_thread()
is allowed to occur via:

rmdir /sys/kernel/config/target/core/$HBA/$DEV

all active I/O will already have been ceased while removing active configfs
fabric Port/LUN symlinks.  Eg: the removal of an active se_device is protected
by inter-module VFS references from active Port/LUN symlinks.

Two WARN_ON() checks have been added in their place before exiting
transport_processing_thread() to watch out for any leaked descriptors.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Merge transport_cmd_finish_abort_tmr into transport_cmd_finish_abort
Nicholas Bellinger [Sun, 9 Oct 2011 09:02:51 +0000 (02:02 -0700)]
target: Merge transport_cmd_finish_abort_tmr into transport_cmd_finish_abort

This patch merges transport_cmd_finish_abort_tmr() logic into a single
transport_cmd_finish_abort() function by adding a cmd->se_tmr_req check
around transport_lun_remove_cmd(), and updates the single caller within
core_tmr_drain_tmr_list().

Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agoiscsi-target: Remove SCF_SE_LUN_CMD flag abuses
Nicholas Bellinger [Sun, 9 Oct 2011 08:48:14 +0000 (01:48 -0700)]
iscsi-target: Remove SCF_SE_LUN_CMD flag abuses

This patch removes a number of SCF_SE_LUN_CMD flag abuses within iscsi-target
code to determine when iscsit_release_cmd() or transport_generic_free_cmd()
should be called while releasing an individual iscsi_cmd descriptor.

In the place of SCF_SE_LUN_CMD checks, this patch converts existing code to
use a new iscsit_free_cmd() that inspects iscsi_cmd->iscsi_opcode types to
determine which of the above functions should be invoked.  It also removes the
now unnecessary special case checking in iscsit_release_commands_from_conn().

(hch: Use iscsit_free_cmd instead of open-coded alternative)

Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Convert ->transport_wait_for_tasks usage to transport_generic_free_cmd
Nicholas Bellinger [Sun, 9 Oct 2011 08:00:58 +0000 (01:00 -0700)]
target: Convert ->transport_wait_for_tasks usage to transport_generic_free_cmd

This patch converts se_cmd->transport_wait_for_tasks(se_cmd, 1) usage to use
transport_generic_free_cmd() directly in target-core and iscsi-target fabric
usage.  The includes:

*) Removal of the optional transport_generic_free_cmd() call from within
   transport_generic_wait_for_tasks()
*) Usage of existing SCF_SUPPORTED_SAM_OPCODE to determine when
   transport_generic_wait_for_tasks() processing may occur instead of
   checking se_cmd->transport_wait_for_tasks()
*) Move transport_generic_wait_for_tasks() call ahead of core_dec_lacl_count()
   and transport_lun_remove_cmd() in transport_generic_free_cmd() to follow
   existing logic for iscsi-target w/ se_cmd->transport_wait_for_tasks(se_cmd, 1)
*) Removal of se_cmd->transport_wait_for_tasks() function pointer
*) Rename transport_generic_wait_for_tasks() -> transport_wait_for_tasks(), and
   add docbook comment.
*) Add EXPORT_SYMBOL for transport_wait_for_tasks()

For the case in iscsi_target_erl2.c:iscsit_prepare_cmds_for_realligance()
where se_cmd->transport_wait_for_tasks(se_cmd, 0) is called, this patch
adds a direct call to transport_wait_for_tasks().

(hch: Fix transport_generic_free_cmd() usage in iscsit_release_commands_from_conn)
(nab: Add patch: Ensure that TMRs hit wait_for_tasks logic during release)

Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Have core_tmr_alloc_req() take an explicit GFP_xxx flag
Roland Dreier [Thu, 6 Oct 2011 16:56:16 +0000 (09:56 -0700)]
target: Have core_tmr_alloc_req() take an explicit GFP_xxx flag

Testing in_interrupt() to know when sleeping is allowed is not really
reliable (since eg it won't be true if the caller is holding a spinlock).
Instead have the caller tell core_tmr_alloc_req() what GFP_xxx to use;
every caller except tcm_qla2xxx can use GFP_KERNEL.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotarget: Make pscsi_create_virtdevice use ERR_CAST
Dan Carpenter [Sat, 1 Oct 2011 22:59:13 +0000 (01:59 +0300)]
target: Make pscsi_create_virtdevice use ERR_CAST

This patch changes pscsi_create_virtdevice() to properly return ERR_CAST
instead of a raw pointer upon scsi_host_lookup() failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agotcm_fc: remove custom hex_to_bin in ft_parse_wwn
Andy Shevchenko [Fri, 30 Sep 2011 11:45:40 +0000 (14:45 +0300)]
tcm_fc: remove custom hex_to_bin in ft_parse_wwn

This patch converts ft_parse_wwn() to use hex_to_bin() instead of custom
conversion code.

(Andy: Re-add missing strict && isupper(c) check)

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
12 years agoiscsi-target: use native hex2bin for chap_string_to_hex
Andy Shevchenko [Fri, 30 Sep 2011 11:39:54 +0000 (14:39 +0300)]
iscsi-target: use native hex2bin for chap_string_to_hex

This patch converts chap_string_to_hex() to use hex2bin() instead of
the internal chap_asciihex_to_binaryhex().

(nab: Fix up minor compile breakage + typo)

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>