On Wed, 2018-06-20 at 09:18 +0530, Chaitra Basappa wrote: > We have tried with calling scsi_internal_device_block_nowait() API before > doing IOC reset (i.e. host reset) and called > scsi_internal_device_unblock_nowait() after performing IOC reset. > We have tested this code change with various test cases such as > adding/removing target drives or expanders during diag reset with and > without IOs and at high level we see all are working but we observe below > error messages while performing hibernation operation, > > sd 1:0:0:0: device_block, handle(0x0028) > BRCM Debug: sdev->sdev_state: 5 before device_block_nowait > BRCM Debug: sdev->sdev_state: 5 after_device_block_nowait > sd 1:0:0:0: device_block failed with return(-22) for handle(0x0028) > . > . > sd 0:0:0:0: device_unblock and setting to running, handle(0x0028) > sd 0:0:0:0: device_unblock failed with return(-22) for handle(0x0028) > performing a block followed by an unblock > sd 0:0:0:0: retried device_block failed with return(-22) for handle(0x0028) > sd 0:0:0:0: retried device_unblock failed with return(-22) for > handle(0x0028) > > We are observing these messages during of system resume time, during which > driver issues IOC reset operation in the .resume() callback function. > In the above error messages we see that drives are in SDEV_QUIESCE state. > When drives are SDEV_QUIESCE state then moving these drives to > SDEV_BLOCK state is not allowed and hence we observe above error messages. > > SDEV_QUIESCE state means that Device quiescent. No block commands will be > accepted, only specials (which originate in the midlayer). Neither scsi_internal_device_block_nowait() nor scsi_internal_device_unblock_nowait() should ever have been changed from static into exported functions. But that's another discussion. Regarding the adverse interaction of scsi_internal_device_block_nowait() and scsi_internal_device_unblock_nowait() with the power management code, have you considered to surround code that blocks and unblocks SCSI devices with lock_system_sleep() / unlock_system_sleep() to avoid that these functions fail with error code -22? Thanks, Bart.