On 12/08/2017 06:21 PM, Bart Van Assche wrote:
> The scsi_sd_probe_domain allows to wait until all disk-probing
> activity has finished system-wide. This slows down SCSI host removal
> that occurs concurrently with SCSI disk probing because sd_remove()
> waits on scsi_sd_probe_domain. Additionally, since each function that
> waits on scsi_sd_probe_domain specifies for which disk to wait until
> probing has finished, replace waiting on scsi_sd_probe_domain by
> waiting until probing for a specific disk has finished. Introduce a
> .sync() function pointer in struct scsi_driver to make it possible
> for the SCSI power management code to wait until probing of a
> specific disk has finished.
> 
> Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com>
> Cc: Christoph Hellwig <h...@lst.de>
> Cc: Hannes Reinecke <h...@suse.com>
> Cc: Johannes Thumshirn <jthumsh...@suse.de>
> ---
>  drivers/scsi/scsi.c        |  5 -----
>  drivers/scsi/scsi_pm.c     |  6 ++++--
>  drivers/scsi/scsi_priv.h   |  1 -
>  drivers/scsi/sd.c          | 26 +++++++++++++++++++++-----
>  drivers/scsi/sd.h          |  1 +
>  include/scsi/scsi_driver.h |  1 +
>  6 files changed, 27 insertions(+), 13 deletions(-)
> 
You know what, I have been working on a similar patch for quite some
time now; however, I've taken the simpler approach of not using
async_synchronize_full_domain() but rather async_synchronize_cookie(),
which makes for a simpler patch :-)

However, in doing so I have encountered several issues which have been
exposed by that; the most trivial one being that del_gendisk() doesn't
check if GENHD_FL_UP is set, so it'll crash if sd_remove is called
before sd_async_probe() is run.

The other one is an imbalance between sd_probe and sd_remove;
when sd_probe_async() is called _after_ scsi_device_remove_device()
(which it will as the synchronization is only after device_del() has
been called) it will trip over non-existent sysfs directories in add_disk().
So one need to short-circuit sd_probe_async() for devices in SDEV_CANCEL
or SDEV_DEL.

However, I'm still waiting for a final confirmation on the latter issue,
hence I haven't posted the patchset.
If there's interest I can post them, though.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Teamlead Storage & Networking
h...@suse.com                                  +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

Reply via email to