Re: [PATCH v6 09/23] scsi: sd: Do not issue commands to suspended disks on shutdown

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

 



On 9/22/23 17:29, Damien Le Moal wrote:
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 5eea762f84d1..4d42392fae07 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -150,6 +150,7 @@ struct scsi_disk {
  	unsigned	urswrz : 1;
  	unsigned	security : 1;
  	unsigned	ignore_medium_access_errors : 1;
+	unsigned	suspended : 1;
  };
  #define to_scsi_disk(obj) container_of(obj, struct scsi_disk, disk_dev)

If the 'suspended' member is retained, please do not use a bitfield for the
but use type 'bool' instead. Updates of instances of type 'bool' are atomic
while there is no guarantee in the C standard that bitfield updates will be
atomic. Bitfield updates are typically translated into a combination of &,
| and ~ operations.

Additionally, I'm not convinced that we need the new 'suspended' member.
The Linux kernel runtime PM subsystem serializes I/O and system-wide power
operations. No I/O happens during system-wide suspend or resume operations
and no system-wide suspend or resume callbacks are invoked while I/O is
ongoing. The only exception is I/O that is initiated as the result of error
handling by suspend or resume callbacks, e.g. the SCSI commands submitted
by sd_shutdown(). Even if sd_shutdown() is called indirectly by a suspend
or resume callback, I don't think that it can happen that a suspend or
resume operation is ongoing for the device sd_shutdown() operates on. If
scsi_remove_host() is called from inside a resume callback, resuming of the
devices affected by sd_shutdown() will only be attempted after the host
adapter resume callback has finished.

Thanks,

Bart.



[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