]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] fix async scan add/remove race resulting in an oops
authorJames Bottomley <James.Bottomley@suse.de>
Thu, 19 Nov 2009 22:48:29 +0000 (17:48 -0500)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 26 Nov 2009 15:43:39 +0000 (09:43 -0600)
commitab7477cb2ba283bace50ca5919c2253af39653a9
tree2527b226e1991c459ac02de4a6ba5c98a4639add
parenteb21af0c11c97f4c056fa5b3a1f4b21af4063c9b
[SCSI] fix async scan add/remove race resulting in an oops

Async scanning introduced a very wide window where the SCSI device is
up and running but has not yet been added to sysfs.  We delay the
adding until all scans have completed to retain the same ordering as
sync scanning.

This delay in visibility causes an oops if a device is removed before
we make it visible because the SCSI removal routines have an inbuilt
assumption that if a device is in SDEV_RUNNING state, it must be
visible (which is not necessarily true in the async scanning case).

Fix this by introducing an additional is_visible flag which we can use
to condition the tear down so we do the right thing for running but
not yet made visible.

Reported-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_sysfs.c
include/scsi/scsi_device.h