diff options
author | ManYi Li <limanyi@uniontech.com> | 2021-06-11 17:44:02 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-18 22:15:47 -0400 |
commit | 7dd753ca59d6c8cc09aa1ed24f7657524803c7f3 (patch) | |
tree | df1acc9e9ad96d9974627fb0744604456c66d6bd /drivers/scsi/sr.c | |
parent | 1e0d4e6225996f05271de1ebcb1a7c9381af0b27 (diff) | |
download | linux-7dd753ca59d6c8cc09aa1ed24f7657524803c7f3.tar.gz linux-7dd753ca59d6c8cc09aa1ed24f7657524803c7f3.tar.bz2 linux-7dd753ca59d6c8cc09aa1ed24f7657524803c7f3.zip |
scsi: sr: Return appropriate error code when disk is ejected
Handle a reported media event code of 3. This indicates that the media has
been removed from the drive and user intervention is required to proceed.
Return DISK_EVENT_EJECT_REQUEST in that case.
Link: https://lore.kernel.org/r/20210611094402.23884-1-limanyi@uniontech.com
Signed-off-by: ManYi Li <limanyi@uniontech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index e4633b84c556..7815ed642d43 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -220,6 +220,8 @@ static unsigned int sr_get_events(struct scsi_device *sdev) return DISK_EVENT_EJECT_REQUEST; else if (med->media_event_code == 2) return DISK_EVENT_MEDIA_CHANGE; + else if (med->media_event_code == 3) + return DISK_EVENT_EJECT_REQUEST; return 0; } |