Skip to content

Commit 5c04243

Browse files
Manyi-Limartinkpetersen
authored andcommitted
scsi: sr: Return correct event when media event code is 3
Media event code 3 is defined in the MMC-6 spec as follows: "MediaRemoval: The media has been removed from the specified slot, and the Drive is unable to access the media without user intervention. This applies to media changers only." This indicated that treating the condition as an EJECT_REQUEST was appropriate. However, doing so had the unfortunate side-effect of causing the drive tray to be physically ejected on resume. Instead treat the event as a MEDIA_CHANGE request. Fixes: 7dd753c ("scsi: sr: Return appropriate error code when disk is ejected") Link: https://bugzilla.kernel.org/show_bug.cgi?id=213759 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Li Manyi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a264cf5 commit 5c04243

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/sr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev)
221221
else if (med->media_event_code == 2)
222222
return DISK_EVENT_MEDIA_CHANGE;
223223
else if (med->media_event_code == 3)
224-
return DISK_EVENT_EJECT_REQUEST;
224+
return DISK_EVENT_MEDIA_CHANGE;
225225
return 0;
226226
}
227227

0 commit comments

Comments
 (0)