[PATCH v6 06/13] bsg: Remove unused function bsg_goose_queue()

2012-11-28 Thread Bart Van Assche
The function bsg_goose_queue() does not have any in-tree callers, so let's remove it. Signed-off-by: Bart Van Assche Cc: Jens Axboe Cc: Tejun Heo --- block/bsg-lib.c | 13 - include/linux/bsg-lib.h |1 - 2 files changed, 14 deletions(-) diff --git a/block/bsg-

[PATCH v6 07/13] Fix race between starved list processing and device removal

2012-11-28 Thread Bart Van Assche
Avoid that the sdev reference count can drop to zero before the queue is run by scsi_run_queue(). Also avoid that the sdev reference count can drop to zero in the same function by invoking __blk_run_queue(). Signed-off-by: Bart Van Assche Reported-and-tested-by: Chanho Min Reference: http

[PATCH v6 08/13] Remove get_device() / put_device() pair from scsi_request_fn()

2012-11-28 Thread Bart Van Assche
Now that all scsi_request_fn() callers hold a reference on the SCSI device that function is invoked on and since blk_cleanup_queue() waits until scsi_request_fn() has finished it is safe to remove the get_device() / put_device() pair from scsi_request_fn(). Signed-off-by: Bart Van Assche Acked

[PATCH v6 09/13] Avoid saving/restoring interrupt state inside scsi_remove_host()

2012-11-28 Thread Bart Van Assche
Since it is not allowed to invoke scsi_remove_host() with interrupts disabled, avoid saving and restoring the interrupt state inside scsi_remove_host(). Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Tejun Heo Cc: Mike Christie Cc: Hannes Reinecke --- drivers/scsi/hosts.c | 12

[PATCH v6 10/13] Make scsi_remove_host() wait for device removal

2012-11-28 Thread Bart Van Assche
scsi_remove_host() finished. Also, avoid adding new SCSI devices after scsi_remove_host() started. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke --- drivers/scsi/hosts.c | 30 ++ drivers/scsi/scsi_priv.h

[PATCH v6 11/13] Make scsi_remove_host() wait until error handling finished

2012-11-28 Thread Bart Van Assche
has finished. Also, do not invoke any of the eh_* functions after scsi_remove_host() has started. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/hosts.c |2 +- drivers/scsi/scsi_error.c | 114

[PATCH v6 12/13] Avoid that scsi_device_set_state() triggers a race

2012-11-28 Thread Bart Van Assche
Make concurrent invocations of scsi_device_set_state() safe. Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Tejun Heo Cc: Hannes Reinecke Cc: Mike Christie --- drivers/scsi/scsi_lib.c | 24 drivers/scsi/scsi_sysfs.c |9 - 2 files changed, 20

[PATCH v6 13/13] Do not queue new I/O after scsi_remove_host() started

2012-11-28 Thread Bart Van Assche
The function scsi_remove_host() may get invoked concurrently with scsi_request_fn(). Kill those I/O requests for which processing starts after scsi_remove_host() has been invoked. This makes device removal a little quicker by avoiding that such SCSI commands time out. Signed-off-by: Bart Van

Re: one 16K random read I/O issues 2 scsi I/O (16K and 4K) requests

2012-12-02 Thread Bart Van Assche
On 12/02/12 10:23, Hiroyuki Yamada wrote: I figured out what is going on, but I don't know what it is for. Ext3 filesystem has some 4KB data in each 4096KB(8192 sectors) data. Visually, data is aligned like the following. |4KB|4096KB|4KB|4096KB|4KB|4096KB| ... And 4096KB area in only accessibl

Re: [PATCH v6 03/13] block: Avoid that request_fn is invoked on a dead queue

2012-12-02 Thread Bart Van Assche
On 12/02/12 14:23, Tejun Heo wrote: On Wed, Nov 28, 2012 at 01:44:53PM +0100, Bart Van Assche wrote: A block driver may start cleaning up resources needed by its request_fn as soon as blk_cleanup_queue() finished, so request_fn must not be invoked after draining finished. This is important when

Re: [PATCH v6 04/13] block: Avoid scheduling delayed work on a dead queue

2012-12-02 Thread Bart Van Assche
On 12/02/12 14:26, Tejun Heo wrote: On Wed, Nov 28, 2012 at 01:45:56PM +0100, Bart Van Assche wrote: Running a queue must continue after it has been marked dying until it has been marked dead. So the function blk_run_queue_async() must not schedule delayed work after blk_cleanup_queue() has

Re: [PATCH v6 10/13] Make scsi_remove_host() wait for device removal

2012-12-03 Thread Bart Van Assche
On 12/02/12 14:45, Tejun Heo wrote: On Wed, Nov 28, 2012 at 01:51:13PM +0100, Bart Van Assche wrote: +/* Test whether scsi_remove_host() may finish, and if so, wake it up. */ +void __scsi_check_remove_host_done(struct Scsi_Host *shost) +{ + lockdep_assert_held(shost->host_l

Re: [PATCH v6 10/13] Make scsi_remove_host() wait for device removal

2012-12-03 Thread Bart Van Assche
On 12/03/12 17:15, Tejun Heo wrote: On Mon, Dec 03, 2012 at 09:23:59AM +0100, Bart Van Assche wrote: On 12/02/12 14:45, Tejun Heo wrote: On Wed, Nov 28, 2012 at 01:51:13PM +0100, Bart Van Assche wrote: +/* Test whether scsi_remove_host() may finish, and if so, wake it up. */ +void

Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-12-05 Thread Bart Van Assche
On 12/05/12 19:23, Or Gerlitz wrote: On Fri, Nov 30, 2012 at 4:21 AM, David Dillow wrote: [...] Modulo a few style issues (braces around one line if branches, etc.) and having three state variables vs one, I can live with everything up to aabfa852acd27962 at git://github.com/bvanassche/linux.gi

Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-12-05 Thread Bart Van Assche
On 12/05/12 19:50, Bart Van Assche wrote: On 12/05/12 19:23, Or Gerlitz wrote: On Fri, Nov 30, 2012 at 4:21 AM, David Dillow wrote: [...] Modulo a few style issues (braces around one line if branches, etc.) and having three state variables vs one, I can live with everything up to

Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-12-06 Thread Bart Van Assche
On 12/05/12 22:32, Or Gerlitz wrote: On Wed, Dec 5, 2012 at 8:50 PM, Bart Van Assche wrote: [...] The only way to make I/O work reliably if a failure can occur at the transport layer is to use multipathd on top of ib_srp. If a connection fails for some reason, then the SRP SCSI host will be

Re: [PATCH 00/11] First pass at merging Bart's HA work

2012-12-06 Thread Bart Van Assche
On 12/06/12 15:27, Or Gerlitz wrote: The core problem here seems to be that scsi_remove_host simply never ends. Hello Or, The later patches in the srp-ha patch series avoided such behavior by checking whether the connection between SRP initiator and target is unique, and by removing duplicat

[PATCH v7 0/9] More device removal fixes

2012-12-06 Thread Bart Van Assche
Fix a few race conditions that can be triggered by removing a device: - Fix a race between starved list processing and device removal. - Avoid that a SCSI LLD callback can get invoked after scsi_remove_host() finished. - Speed up device removal by stopping error handling as soon as the SHOST_D

[PATCH v7 1/9] Fix race between starved list processing and device removal

2012-12-06 Thread Bart Van Assche
Avoid that the sdev reference count can drop to zero before a queue is run by scsi_run_queue(). Signed-off-by: Bart Van Assche Reported-and-tested-by: Chanho Min Reference: http://lkml.org/lkml/2012/8/2/96 Acked-by: Tejun Heo Reviewed-by: Mike Christie Cc: Jens Axboe Cc: --- drivers/scsi

[PATCH v7 2/9] Remove get_device() / put_device() pair from scsi_request_fn()

2012-12-06 Thread Bart Van Assche
Now that all scsi_request_fn() callers hold a reference on the SCSI device that function is invoked for and since blk_cleanup_queue() waits until scsi_request_fn() has finished it is safe to remove the get_device() / put_device() pair from scsi_request_fn(). Signed-off-by: Bart Van Assche Acked

[PATCH v7 3/9] Introduce scsi_device_being_removed()

2012-12-06 Thread Bart Van Assche
Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: James Bottomley Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/device_handler/scsi_dh.c |7 ++- include/scsi/scsi_device.h|5 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi

[PATCH v7 4/9] Remove offline devices when removing a host

2012-12-06 Thread Bart Van Assche
SDEV_CANCEL when scsi_forget_host() is invoked. Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke Cc: Tejun Heo --- drivers/scsi/scsi_scan.c |2 +- drivers/scsi/scsi_sysfs.c |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH v7 5/9] Disallow changing the device state via sysfs into "deleted"

2012-12-06 Thread Bart Van Assche
Changing the state of a SCSI device via sysfs into "cancel" or "deleted" prevents scsi_remove_host() to remove these devices. Hence do not allow this. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke --- drivers/scsi

[PATCH v7 6/9] Avoid saving/restoring interrupt state inside scsi_remove_host()

2012-12-06 Thread Bart Van Assche
Since it is not allowed to invoke scsi_remove_host() with interrupts disabled, avoid saving and restoring the interrupt state inside scsi_remove_host(). This patch does not change the functionality of that function. Signed-off-by: Bart Van Assche Acked-by: Tejun Heo Cc: Mike Christie Cc

[PATCH v7 7/9] Make scsi_remove_host() wait for device removal

2012-12-06 Thread Bart Van Assche
() must wait until blk_cleanup_queue() for all devices associated with the host has finished. That avoids that queuecommand() gets invoked after scsi_remove_host() finished. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke --- drivers/scsi

[PATCH v7 8/9] Make scsi_remove_host() wait until error handling finished

2012-12-06 Thread Bart Van Assche
has finished. Also, do not invoke any of the eh_* functions after scsi_remove_host() has started. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/hosts.c |2 +- drivers/scsi/scsi_error.c | 76

[PATCH v7 9/9] Avoid that scsi_device_set_state() triggers a race

2012-12-06 Thread Bart Van Assche
Make concurrent invocations of scsi_device_set_state() safe. Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Tejun Heo Cc: Hannes Reinecke Cc: Mike Christie --- drivers/scsi/scsi_error.c |4 drivers/scsi/scsi_lib.c | 43

Re: [PATCH v6 10/13] Make scsi_remove_host() wait for device removal

2012-12-06 Thread Bart Van Assche
On 12/03/12 17:42, Tejun Heo wrote: On Mon, Dec 03, 2012 at 05:38:52PM +0100, Bart Van Assche wrote: It is indeed possible to invoke complete() only if the device list became empty with the host state equal to SHOST_CANCEL, SHOST_CANCEL_RECOVERY, SHOST_DEL or SHOST_DEL_RECOVERY and in We can

Re: [PATCH v7 3/9] Introduce scsi_device_being_removed()

2012-12-07 Thread Bart Van Assche
On 12/07/12 09:40, Rolf Eike Beer wrote: diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 55367b0..767dd16 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -442,6 +442,11 @@ static inline int scsi_device_created(struct scsi_device *sdev) r

Re: [PATCH v7 3/9] Introduce scsi_device_being_removed()

2012-12-07 Thread Bart Van Assche
On 12/07/12 11:02, Rolf Eike Beer wrote: > Am , schrieb Bart Van Assche: >> On 12/07/12 09:40, Rolf Eike Beer wrote: >>>> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h >>>> index 55367b0..767dd16 100644 >>>> --- a/inclu

Re: [PATCH v7 5/9] Disallow changing the device state via sysfs into "deleted"

2012-12-07 Thread Bart Van Assche
On 12/07/12 07:55, Hannes Reinecke wrote: On 12/06/2012 04:56 PM, Bart Van Assche wrote: Changing the state of a SCSI device via sysfs into "cancel" or "deleted" prevents scsi_remove_host() to remove these devices. Hence do not allow this. Signed-off-by: Bart Van Assch

Re: [PATCH v7 5/9] Disallow changing the device state via sysfs into "deleted"

2012-12-07 Thread Bart Van Assche
On 12/07/12 13:46, Bart Van Assche wrote: > On 12/07/12 07:55, Hannes Reinecke wrote: >> On 12/06/2012 04:56 PM, Bart Van Assche wrote: >>> Changing the state of a SCSI device via sysfs into "cancel" or >>> "deleted" prevents scsi_remove_host() to re

Re: [PATCH v7 4/9] Remove offline devices when removing a host

2012-12-07 Thread Bart Van Assche
On 12/07/12 16:10, Hannes Reinecke wrote: On 12/06/2012 04:55 PM, Bart Van Assche wrote: Currently __scsi_remove_device() skips devices that are visible and offline. Make sure that these devices get removed by changing their device state into SDEV_DEL at the start of __scsi_remove_device

Re: [PATCH v7 4/9] Remove offline devices when removing a host

2012-12-07 Thread Bart Van Assche
On 12/07/12 16:33, Bart Van Assche wrote: On 12/07/12 16:10, Hannes Reinecke wrote: On 12/06/2012 04:55 PM, Bart Van Assche wrote: Currently __scsi_remove_device() skips devices that are visible and offline. Make sure that these devices get removed by changing their device state into SDEV_DEL

Re: SCSI mid layer and high IOPS capable devices

2012-12-11 Thread Bart Van Assche
On 12/11/12 01:00, scame...@beardog.cce.hp.com wrote: I tried using scsi_debug with fake_rw and also the scsi_ram driver that was recently posted to get some idea of what the maximum IOPS that could be pushed through the SCSI midlayer might be, and the numbers were a little disappointing (was get

[PATCH] Save and restore host_scribble during error handling

2012-12-12 Thread Bart Van Assche
A SCSI LLD may overwrite host_scribble in its queuecommand() implementation. Several drivers need that field to process requests and aborts correctly. Hence this field must be saved by scsi_eh_prep_cmnd() and must be restored by scsi_eh_restore_cmnd(). Signed-off-by: Bart Van Assche Cc: James

Re: [PATCH 03/16] libfcoe: Save some memory and optimize name lookups

2012-12-12 Thread Bart Van Assche
On 12/13/12 00:22, Robert Love wrote: @@ -210,25 +210,23 @@ static ssize_t show_fcoe_fcf_device_##field(struct device *dev, \ #define fcoe_enum_name_search(title, table_type, table) \ static const char *get_fcoe_##title##_name(enum table_type table_key) \ {

Re: SCSI mid layer and high IOPS capable devices

2012-12-13 Thread Bart Van Assche
On 12/11/12 23:46, scame...@beardog.cce.hp.com wrote: I would be curious to see what kind of results you would get with scsi_debug with fake_rw=1. I am sort of suspecting that trying to put an "upper limit" on scsi LLD IOPS performance by seeing what scsi_debug will do with fake_rw=1 is not real

Re: SCSI mid layer and high IOPS capable devices

2012-12-13 Thread Bart Van Assche
On 12/11/12 01:00, scame...@beardog.cce.hp.com wrote: The driver, like nvme, has a submit and reply queue per cpu. This is interesting. If my interpretation of the POSIX spec is correct then aio_write() allows to queue overlapping writes and all writes submitted by the same thread have to be

Re: SCSI mid layer and high IOPS capable devices

2012-12-13 Thread Bart Van Assche
On 12/13/12 18:25, scame...@beardog.cce.hp.com wrote: On Thu, Dec 13, 2012 at 04:22:33PM +0100, Bart Van Assche wrote: On 12/11/12 01:00, scame...@beardog.cce.hp.com wrote: The driver, like nvme, has a submit and reply queue per cpu. This is interesting. If my interpretation of the POSIX

Re: SCSI mid layer and high IOPS capable devices

2012-12-13 Thread Bart Van Assche
On 12/13/12 19:03, scame...@beardog.cce.hp.com wrote: What are your system specs? A quad core Intel i5-2400 @ 3.10 GHz. taskset -c "$cpu" dd if="$device" of=/dev/null bs=4k iflag=direct Please use fio instead of dd for any serious performance measurements. dd doesn't even guarantee

Re: SCSI mid layer and high IOPS capable devices

2012-12-14 Thread Bart Van Assche
On 12/13/12 17:49, Christoph Hellwig wrote: On Thu, Dec 13, 2012 at 05:47:14PM +0100, Bart Van Assche wrote: From my experience with block and SCSI drivers option (1) doesn't look attractive from a performance point of view. From what I have seen performance with QD=1 is several times

Re: SCSI mid layer and high IOPS capable devices

2012-12-14 Thread Bart Van Assche
On 12/14/12 17:44, scame...@beardog.cce.hp.com wrote: I expect the flash devices re-order requests as well, simply because to feed requests to the things at a sufficient rate, you have to pump requests into them concurrently on multiple hardware queues -- a single cpu jamming requests into them a

Re: SCSI mid layer and high IOPS capable devices

2012-12-14 Thread Bart Van Assche
On 12/14/12 20:55, scame...@beardog.cce.hp.com wrote: It's not so much that they are re-ordered as that there is no controlled ordering to begin with because multiple cpus are submitting to multiple hardware queues concurrently. If you have 12 requests coming in on 12 cpus to 12 hardware queues

Re: Deadlock observed in SCSI device removal

2012-12-15 Thread Bart Van Assche
On 12/15/12 05:22, Amit Sahrawat wrote: We are using kernel version 3.0.33, and the patch which is mentioned for the above problem - is already applied in the kernel. If the kernel reports that io_schedule() hangs that usually means that an I/O request was not finished properly. It would help

Re: SCSI mid layer and high IOPS capable devices

2012-12-15 Thread Bart Van Assche
On 12/14/12 22:06, scame...@beardog.cce.hp.com wrote: [ ... ] how to get the scsi mid layer to provide a wide enough highway for requests destined for very low latency devices. While the SCSI mid-layer is processing an I/O request not only the queue lock has to be locked and unlocked several t

Re: [PATCH] scsi: remove device when state is changed to deleted thru sysfs

2012-12-17 Thread Bart Van Assche
On 12/18/12 00:26, David Milburn wrote: diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ce5224c..6d72abb 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -596,7 +596,7 @@ static ssize_t store_state_field(struct device *dev, struct device_attribu

Re: [PATCH 0/2] RESEND Add support for new IBM SAS controllers

2013-01-02 Thread Bart Van Assche
On 01/02/13 19:23, wenxi...@linux.vnet.ibm.com wrote: I am re-sending "blk iopoll support" and "bump version" patches in previous series. Hello Wendy, How much do these patches improve the performance of the ipr driver ? Thanks, Bart. -- To unsubscribe from this list: send the line "unsubsc

Re: [PATCH RFC 4/9] [SCSI] Rename scsi_evt_xxx to sdev_evt_xxx and scsi_event to sdev_event

2013-01-22 Thread Bart Van Assche
On Fri, Jan 18, 2013 at 9:27 AM, Ewan D. Milne wrote: > > @@ -2206,7 +2206,7 @@ static void scsi_evt_emit(struct scsi_device *sdev, > struct scsi_event *evt) > * Dispatch queued events to their associated scsi_device kobjects > * as uevents. > */ > -void scsi_evt_thread(struct work_

Re: [PATCH RFC 4/9] [SCSI] Rename scsi_evt_xxx to sdev_evt_xxx and scsi_event to sdev_event

2013-01-22 Thread Bart Van Assche
On Fri, Jan 18, 2013 at 9:27 AM, Ewan D. Milne wrote: > @@ -2206,7 +2206,7 @@ static void scsi_evt_emit(struct scsi_device *sdev, > struct scsi_event *evt) > * Dispatch queued events to their associated scsi_device kobjects > * as uevents. > */ > -void scsi_evt_thread(struct work_st

Re: [PATCH RFC 0/9] [SCSI] Enhanced sense and Unit Attention handling

2013-01-23 Thread Bart Van Assche
On Fri, Jan 18, 2013 at 9:27 AM, Ewan D. Milne wrote: > This patch set adds changes to the SCSI mid-layer, sysfs and scsi_debug > to provide enhanced support for Unit Attention conditions, as well as > detection of reported sense data overflow conditions and some changes > to sense data processing

Re: [PATCH RFC 0/9] [SCSI] Enhanced sense and Unit Attention handling

2013-01-24 Thread Bart Van Assche
On Thu, Jan 24, 2013 at 4:38 AM, Hannes Reinecke wrote: > As for AEN, does iSCSI _do_ AEN? I thought it got removed ... > > If it does, though, it should schedule an event on its own whenever an AER > is received. The same goes for LLDDs with vendor-specific AENs; thinking of > megaraid_sas here .

Re: [PATCH RFC 0/9] [SCSI] Enhanced sense and Unit Attention handling

2013-01-28 Thread Bart Van Assche
On 01/28/13 16:05, Jeremy Linton wrote: What I think your looking for is RSCN (Registered State Change notification). Hook that, and then check the name server. This will tell you when ports get added/removed. You can then report luns against lun 0 of all the known target ports. This allows you t

Re: How to online remove an error scsi disk from the system?

2013-01-31 Thread Bart Van Assche
On 02/01/13 07:13, Tao Ma wrote: In our product system, we have several sata disks attached to one machine. So when one of the disk fails, the jbd2(yes, we use ext4) will hang forever and we will get something in /var/log/messages like below. It seems to me that the io sent to the scsi la

[LSF/MM TOPIC] Reducing the SRP initiator failover time

2013-02-01 Thread Bart Van Assche
It is known that it takes about two to three minutes before the upstream SRP initiator fails over from a failed path to a working path. This is not only considered longer than acceptable but is also longer than other Linux SCSI initiators (e.g. iSCSI and FC). Progress so far with improving the

[PATCH v8 0/10] More device removal fixes

2013-02-05 Thread Bart Van Assche
Fix a few race conditions that can be triggered by removing a device: - Fix a race between starved list processing and device removal. - Avoid that a SCSI LLD callback can get invoked after scsi_remove_host() finished. - Speed up device removal by stopping error handling as soon as the SHOST_D

[PATCH v8 01/10] Fix race between starved list processing and device removal

2013-02-05 Thread Bart Van Assche
by increasing the sdev refcount before running the sdev queue. Also, remove a SCSI device from the starved list before __scsi_remove_device() decreases the sdev refcount such that the get_device() call added in scsi_run_queue() is guaranteed to succeed. Signed-off-by: Bart Van Assche Reported-and

[PATCH v8 02/10] Remove get_device() / put_device() pair from scsi_request_fn()

2013-02-05 Thread Bart Van Assche
Now that all scsi_request_fn() callers hold a reference on the SCSI device that function is invoked for and since blk_cleanup_queue() waits until scsi_request_fn() has finished it is safe to remove the get_device() / put_device() pair from scsi_request_fn(). Signed-off-by: Bart Van Assche Acked

[PATCH v8 03/10] Introduce scsi_device_being_removed()

2013-02-05 Thread Bart Van Assche
This patch does not change any functionality. Signed-off-by: Bart Van Assche Acked-by: Hannes Reinecke Cc: James Bottomley Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/device_handler/scsi_dh.c |7 ++- include/scsi/scsi_device.h| 15 +++ 2 files changed

[PATCH v8 04/10] Remove offline devices when removing a host

2013-02-05 Thread Bart Van Assche
__scsi_remove_device(). Also, avoid that __scsi_remove_device() gets called a second time by scsi_forget_host() for devices that are in state SDEV_CANCEL. Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke Cc: Tejun Heo --- drivers/scsi/scsi_scan.c |2

[PATCH v8 05/10] Disallow changing the device state via sysfs into "deleted"

2013-02-05 Thread Bart Van Assche
device state. Update scsi_device_set_state() such that gcc does not issue a warning about an enumeration value not being handled inside a switch statement. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke Cc: David Milburn --- drivers/scsi/scsi_lib.c

[PATCH v8 06/10] Avoid saving/restoring interrupt state inside scsi_remove_host()

2013-02-05 Thread Bart Van Assche
Since it is not allowed to invoke scsi_remove_host() with interrupts disabled, avoid saving and restoring the interrupt state inside scsi_remove_host(). This patch does not change the functionality of the function scsi_remove_host(). Signed-off-by: Bart Van Assche Acked-by: Tejun Heo Acked-by

[PATCH v8 07/10] Make scsi_remove_host() wait for device removal

2013-02-05 Thread Bart Van Assche
() finished. Hence scsi_remove_host() must wait until blk_cleanup_queue() for all devices associated with the host has finished. That avoids that queuecommand() gets invoked after scsi_remove_host() finished. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc

[PATCH v8 08/10] Make scsi_remove_host() wait until error handling finished

2013-02-05 Thread Bart Van Assche
has finished. Also, do not invoke any of the eh_* functions after scsi_remove_host() has started. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/hosts.c |2 +- drivers/scsi/scsi_error.c | 74

[PATCH v8 09/10] Avoid that scsi_device_set_state() triggers a race

2013-02-05 Thread Bart Van Assche
Signed-off-by: Bart Van Assche Acked-by: Hannes Reinecke Cc: James Bottomley Cc: Tejun Heo Cc: Mike Christie --- drivers/scsi/scsi_error.c |4 drivers/scsi/scsi_lib.c | 43 ++- drivers/scsi/scsi_scan.c | 15 --- drivers/scsi

[PATCH v8 10/10] Save and restore host_scribble during error handling

2013-02-05 Thread Bart Van Assche
A SCSI LLD may overwrite host_scribble in its queuecommand() implementation. Several drivers need that field to process requests and aborts correctly. Hence this field must be saved by scsi_eh_prep_cmnd() and must be restored by scsi_eh_restore_cmnd(). Signed-off-by: Bart Van Assche Cc: James

Re: [PATCH v8 0/10] More device removal fixes

2013-02-07 Thread Bart Van Assche
On 02/06/13 23:31, Joe Lawrence wrote: On Tue, 5 Feb 2013, Bart Van Assche wrote: Fix a few race conditions that can be triggered by removing a device: - Fix a race between starved list processing and device removal. - Avoid that a SCSI LLD callback can get invoked after scsi_remove_host

Re: [PATCH v8 0/10] More device removal fixes

2013-02-07 Thread Bart Van Assche
On 02/06/13 23:31, Joe Lawrence wrote: crash> list scsi_device.siblings -H 0x8808513a4290 -s scsi_device 880851232520 struct scsi_device { is_visible = 0x1, sdev_state = SDEV_DEL, } 880851235388 struct scsi_device { is_visible = 0x1, sdev_state = SDEV_DEL, } This is int

Re: [LSF/MM TOPIC][ATTEND] protection information and userspace

2013-02-07 Thread Bart Van Assche
On 02/07/13 13:08, Boaz Harrosh wrote: (My addition is for support of sg_lists to bsg, in a way that makes Tomo happy I know that qemu was wanting this for a while as well as the multitude of user-mode servers) Do you think it would help / make sense if sg_alloc_table() would be modified s

Re: [PATCH v8 0/10] More device removal fixes

2013-02-09 Thread Bart Van Assche
On 02/09/13 00:29, Joe Lawrence wrote: I haven't had time to rerun the test without the two patches that wait in scsi_remove_host(), however I did rerun the test and verify the same behavior as in my earlier mail. I didn't see any __scsi_remove_device() instances running. Some more investigatio

Re: [PATCH v7 1/9] Fix race between starved list processing and device removal

2013-02-09 Thread Bart Van Assche
Chanho Min -Original Message- From: Bart Van Assche [mailto:bvanass...@acm.org] Sent: Friday, December 07, 2012 12:53 AM To: undisclosed-recipients: Cc: linux-scsi; James Bottomley; Mike Christie; Tejun Heo; Chanho Min; Jens Axboe Subject: [PATCH v7 1/9] Fix race between starved list

Re: [PATCH v8 0/10] More device removal fixes

2013-02-11 Thread Bart Van Assche
On 02/09/13 10:28, Bart Van Assche wrote: On 02/09/13 00:29, Joe Lawrence wrote: I haven't had time to rerun the test without the two patches that wait in scsi_remove_host(), however I did rerun the test and verify the same behavior as in my earlier mail. I didn't see any __scsi_rem

Re: [PATCH] scsi: Allow 64-bit LUNs during report lun scan

2013-02-13 Thread Bart Van Assche
On 02/13/13 20:52, Jeremy Linton wrote: On 2/13/2013 9:06 AM, Hannes Reinecke wrote: So add a new flag 'support_64bit_luns' to the scsi host and modify report lun scan to not check for max_luns during scanning if that flag is set. This will get rid of the Along these lines, I don't thi

Re: [PATCH] scsi: Allow 64-bit LUNs during report lun scan

2013-02-14 Thread Bart Van Assche
On 02/14/13 23:44, Jeremy Linton wrote: On 2/14/2013 4:04 PM, Elliott, Robert (Server Storage) wrote: Like James notes, LUNs should generally be treated as opaque values. Maybe another issue to consider is how they are being displayed in userland. A device with two luns using one of the altern

[PATCH v9 0/9] More device removal fixes

2013-02-15 Thread Bart Van Assche
Fix a few issues that can be triggered by removing a device: - Fix a race between starved list processing and device removal. - Avoid that a SCSI LLD callback can get invoked after scsi_remove_host() finished. - Speed up device removal by stopping error handling as soon as the SHOST_DEL or SHO

[PATCH v9 1/9] Fix race between starved list processing and device removal

2013-02-15 Thread Bart Van Assche
by increasing the sdev refcount before running the sdev queue. Also, remove a SCSI device from the starved list before __scsi_remove_device() decreases the sdev refcount such that the get_device() call added in scsi_run_queue() is guaranteed to succeed. Signed-off-by: Bart Van Assche Reported-and

[PATCH v9 2/9] Remove get_device() / put_device() pair from scsi_request_fn()

2013-02-15 Thread Bart Van Assche
Now that all scsi_request_fn() callers hold a reference on the SCSI device that function is invoked for and since blk_cleanup_queue() waits until scsi_request_fn() has finished it is safe to remove the get_device() / put_device() pair from scsi_request_fn(). Signed-off-by: Bart Van Assche Acked

[PATCH v9 3/9] Avoid calling __scsi_remove_device() twice

2013-02-15 Thread Bart Van Assche
KED. If this happens this happens before a SCSI device is added to sysfs (is_visible == 0). Make sure that if this happens these devices are transitioned into state SDEV_DEL. This avoids that __scsi_remove_device() gets invoked a second time by scsi_forget_host(). Signed-off-by: Bart Van Assche

[PATCH v9 4/9] Disallow changing the device state via sysfs into "deleted"

2013-02-15 Thread Bart Van Assche
device state. Update scsi_device_set_state() such that gcc does not issue a warning about an enumeration value not being handled inside a switch statement. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke Cc: David Milburn --- drivers/scsi/scsi_lib.c

[PATCH v9 5/9] Avoid saving/restoring interrupt state inside scsi_remove_host()

2013-02-15 Thread Bart Van Assche
Since it is not allowed to invoke scsi_remove_host() with interrupts disabled, avoid saving and restoring the interrupt state inside scsi_remove_host(). This patch does not change the functionality of the function scsi_remove_host(). Signed-off-by: Bart Van Assche Acked-by: Tejun Heo Acked-by

[PATCH v9 6/9] Make scsi_remove_host() wait until error handling finished

2013-02-15 Thread Bart Van Assche
has finished. Also, do not invoke any of the eh_* functions after scsi_remove_host() has started. Remove Scsi_Host.tmf_in_progress because it is now superfluous. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Mike Christie Cc: Tejun Heo --- drivers/scsi/hosts.c |6 drivers

[PATCH v9 7/9] Avoid that scsi_device_set_state() triggers a race

2013-02-15 Thread Bart Van Assche
Make concurrent invocations of scsi_device_set_state() safe. Signed-off-by: Bart Van Assche Acked-by: Hannes Reinecke Cc: James Bottomley Cc: Tejun Heo Cc: Mike Christie --- drivers/scsi/scsi_error.c |4 drivers/scsi/scsi_lib.c | 43

[PATCH v9 8/9] Save and restore host_scribble during error handling

2013-02-15 Thread Bart Van Assche
A SCSI LLD may overwrite host_scribble in its queuecommand() implementation. Several drivers need that field to process requests and aborts correctly. Hence this field must be saved by scsi_eh_prep_cmnd() and must be restored by scsi_eh_restore_cmnd(). Signed-off-by: Bart Van Assche Cc: James

[PATCH v9 9/9] Avoid reenabling I/O after the transport became offline

2013-02-15 Thread Bart Van Assche
the SDEV_CANCEL state. - This patch does not affect Fibre Channel LLD drivers since these drivers invoke fc_remote_port_chkready() before submitting a SCSI request to the HBA. That prevents a timeout to occur in state SDEV_CANCEL if the transport is offline. Signed-off-by: Bart Van Assche Cc

Re: [PATCH v2 1/3] Encapsulate scsi_do_report_luns

2013-02-18 Thread Bart Van Assche
On 02/18/13 20:15, Rob Evers wrote: + /* +* bytes 6 - 9: length of the command. +*/ + scsi_cmd[6] = (unsigned char) (length >> 24) & 0xff; + scsi_cmd[7] = (unsigned char) (length >> 16) & 0xff; + scsi_cmd[8] = (unsigned char) (length >> 8) & 0xff; + s

Re: [PATCH v2 2/3] Configure reported luns

2013-02-18 Thread Bart Van Assche
On 02/18/13 20:15, Rob Evers wrote: length = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3] << 0)); [ ... ] + length = ((data[0] << 24) | (data[1] << 16) | + (data[2] << 8) | (data[3] << 0));

[PATCH 0/2] dm: Avoid use-after-free of a mapped device

2013-02-22 Thread Bart Van Assche
This mini-series of two patches avoids that the device mapper implementation triggers a use-after-free during removal of a mapped device. The two patches in this series are: - block: Avoid invoking blk_run_queue() recursively - dm: Avoid use-after-free of a mapped device -- To unsubscribe from thi

[PATCH 1/2] block: Avoid invoking blk_run_queue() recursively

2013-02-22 Thread Bart Van Assche
queue processing when invoked recursively is safe because the only two affected request_fn() implementations (dm and SCSI) guarantee that the request queue will be reexamined sooner or later before returning from their request_fn() implementation. Signed-off-by: Bart Van Assche Cc: Jens Axboe Cc

[PATCH 2/2] dm: Avoid use-after-free of a mapped device

2013-02-22 Thread Bart Van Assche
ork+0x29/0x40 [] process_one_work+0x1c3/0x5c0 [] worker_thread+0x15e/0x440 [] kthread+0xdb/0xe0 [] ret_from_fork+0x7c/0xb0 Signed-off-by: Bart Van Assche Cc: Alasdair G Kergon Cc: Jens Axboe Cc: Mike Snitzer Cc: Tejun Heo Cc: James Bottomley Cc: --- drivers/md/dm.c | 10 +-

Re: [PATCH 2/2] dm: Avoid use-after-free of a mapped device

2013-02-22 Thread Bart Van Assche
On 02/22/13 12:08, Mike Snitzer wrote: On Fri, Feb 22 2013 at 5:47am -0500, Bart Van Assche wrote: As the comment above rq_completed() explains, md members must not be touched after the dm_put() at the end of that function has been invoked. Avoid that the md->queue can be run asynchronou

Re: [PATCH 1/2] block: Avoid invoking blk_run_queue() recursively

2013-02-22 Thread Bart Van Assche
On 02/22/13 19:14, Tejun Heo wrote: > Hello, Bart. > > On Fri, Feb 22, 2013 at 11:46:14AM +0100, Bart Van Assche wrote: >> Some block drivers, e.g. dm and SCSI, need to trigger a queue >> run from inside functions that may be invoked by their request_fn() >> imp

Re: [PATCH 1/2] block: Avoid invoking blk_run_queue() recursively

2013-02-23 Thread Bart Van Assche
On 02/22/13 20:01, Jens Axboe wrote: That'd be fine. I agree with Tejun that just returning is error prone and could cause hard-to-debug hangs or stalls. So something ala if (blk_queue(dead)) return; else if (q->request_fn_active) { blk_delay_q

Re: [PATCH 2/2] dm: Avoid use-after-free of a mapped device

2013-02-25 Thread Bart Van Assche
ioset. +* So you must walk through the queue to unprep. +*/ + } goto out; } Without your patch my test failed after two or three iterations. With your patch my test is still running after 53 iterations. So if you wan

[PATCH v2 0/2] dm: Avoid use-after-free of a mapped device

2013-02-27 Thread Bart Van Assche
This mini-series of two patches avoids that the device mapper implementation can trigger a use-after-free during removal of a mapped device. The two patches in this series are: - block: Convert blk_run_queue() recursion into iteration. - dm: Avoid running the md queue after the last dm_put(). Not

[PATCH v2 1/2] block: Convert blk_run_queue() recursion into iteration

2013-02-27 Thread Bart Van Assche
Some block drivers, e.g. dm and SCSI, need to trigger a queue run from inside functions that may be invoked by their request_fn() implementation. Make sure that invoking blk_run_queue() instead of blk_run_queue_async() from such functions does not trigger recursion. Signed-off-by: Bart Van Assche

[PATCH v2 2/2] dm: Avoid running the md queue after the last dm_put()

2013-02-27 Thread Bart Van Assche
dm_request_fn() safe. Signed-off-by: Bart Van Assche Cc: Alasdair G Kergon Cc: Jens Axboe Cc: Mike Snitzer Cc: Tejun Heo Cc: James Bottomley Cc: Jun'ichi Nomura --- drivers/md/dm.c |8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c

Re: [PATCH v2 0/2] dm: Avoid use-after-free of a mapped device

2013-02-28 Thread Bart Van Assche
On 02/28/13 01:42, Jun'ichi Nomura wrote: Hi Bart, On 02/27/13 23:45, Bart Van Assche wrote: This mini-series of two patches avoids that the device mapper implementation can trigger a use-after-free during removal of a mapped device. The two patches in this series are: - block: Co

Re: [GIT PULL] Final round of SCSI updates for the 3.8+ merge window

2013-03-01 Thread Bart Van Assche
On 03/01/13 10:19, James Bottomley wrote: This is an assorted set of stragglers into the merge window with driver updates for qla2xxx, megaraid_sas, storvsc and ufs. It also includes pulls of the uapi tree (all the remaining SCSI pieces) and the fcoe tree (updates to fcoe and libfc) Hello Jame

Re: [PATCH] scsi_transport_fc: Make 'port_state' writeable

2013-03-15 Thread Bart Van Assche
On 03/15/13 12:55, Hannes Reinecke wrote: And the LLDD is forced into error recovery which'll take _ages_ as each and every command send during error recovery will time out. Hello Hannes, I'm analyzing a related but not identical issue with SRP. It would help if you could tell with which LLDD

Re: [PATCH] scsi_transport_fc: Make 'port_state' writeable

2013-03-15 Thread Bart Van Assche
On 03/15/13 13:37, Bryn M. Reeves wrote: On 03/15/2013 12:24 PM, Bart Van Assche wrote: On 03/15/13 12:55, Hannes Reinecke wrote: And the LLDD is forced into error recovery which'll take _ages_ as each and every command send during error recovery will time out. Hello Hannes, I'm a

<    3   4   5   6   7   8   9   10   11   12   >