linux/include/scsi
Damien Le Moal 0c76106cb9 scsi: sd: Fix TCG OPAL unlock on system resume
Commit 3cc2ffe5c1 ("scsi: sd: Differentiate system and runtime start/stop
management") introduced the manage_system_start_stop scsi_device flag to
allow libata to indicate to the SCSI disk driver that nothing should be
done when resuming a disk on system resume. This change turned the
execution of sd_resume() into a no-op for ATA devices on system
resume. While this solved deadlock issues during device resume, this change
also wrongly removed the execution of opal_unlock_from_suspend().  As a
result, devices with TCG OPAL locking enabled remain locked and
inaccessible after a system resume from sleep.

To fix this issue, introduce the SCSI driver resume method and implement it
with the sd_resume() function calling opal_unlock_from_suspend(). The
former sd_resume() function is renamed to sd_resume_common() and modified
to call the new sd_resume() function. For non-ATA devices, this result in
no functional changes.

In order for libata to explicitly execute sd_resume() when a device is
resumed during system restart, the function scsi_resume_device() is
introduced. libata calls this function from the revalidation work executed
on devie resume, a state that is indicated with the new device flag
ATA_DFLAG_RESUMING. Doing so, locked TCG OPAL enabled devices are unlocked
on resume, allowing normal operation.

Fixes: 3cc2ffe5c1 ("scsi: sd: Differentiate system and runtime start/stop management")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218538
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20240319071209.1179257-1-dlemoal@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-03-25 15:46:12 -04:00
..
fc
fc_frame.h
fcoe_sysfs.h
iscsi_if.h
iscsi_proto.h
iser.h
libfc.h
libfcoe.h
libiscsi_tcp.h
libiscsi.h
libsas.h
sas_ata.h
sas.h
scsi_bsg_iscsi.h
scsi_cmnd.h
scsi_common.h
scsi_dbg.h
scsi_device.h SCSI misc on 20240322 2024-03-22 13:31:07 -07:00
scsi_devinfo.h
scsi_dh.h
scsi_driver.h scsi: sd: Fix TCG OPAL unlock on system resume 2024-03-25 15:46:12 -04:00
scsi_eh.h
scsi_host.h scsi: sd: Fix TCG OPAL unlock on system resume 2024-03-25 15:46:12 -04:00
scsi_ioctl.h
scsi_proto.h
scsi_status.h
scsi_tcq.h
scsi_transport_fc.h
scsi_transport_iscsi.h
scsi_transport_sas.h
scsi_transport_spi.h
scsi_transport_srp.h
scsi_transport.h
scsi.h
scsicam.h
sg.h
srp.h
viosrp.h