Commit 7dd753ca authored by ManYi Li's avatar ManYi Li Committed by Martin K. Petersen

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.comSigned-off-by: default avatarManYi Li <limanyi@uniontech.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 1e0d4e62
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment