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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 __scsi_check_remove_host_done(struct Scsi_Host *shost)
+{
+	lockdep_assert_held(shost->host_lock);
+
+	if (__scsi_remove_host_done(shost))
+		wake_up(&shost->remove_host);
+}

This being an one-time thing.  Using completion could be simpler.  e.g.

Sorry but I'm not sure that would work here. A user can e.g. delete
all SCSI devices associated with a SCSI host (echo 1
/sys/class/scsi_host/host<n>/device/target<m>/<lun>/delete) and
then issue a rescan to re-add LUNs. When using a completion the
completion would be set as soon as the last SCSI device has been
deleted instead of only after scsi_remove_host() finished removing
the re-added SCSI devices.

You can gate the whole thing with test on whether the host is being
removed.  Once removal begins, no device should be allowed to be added
and the completion triggers iff host removal is in progress.  That
should work, right?

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 scsi_remove_host() to wait for that completion only if the device list was not empty before the host state was changed into one of the four mentioned states. Do you really prefer this approach over the approach in the patch at the start of this thread ?

Thanks,

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux