]> git.itanic.dy.fi Git - linux-stable/commit
scsi: sr: Return correct event when media event code is 3
authorLi Manyi <limanyi@uniontech.com>
Mon, 26 Jul 2021 11:49:13 +0000 (19:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 Aug 2021 11:01:01 +0000 (13:01 +0200)
commitc5831fbf4402bf59d35aa92082177f2edfbb0879
tree0a5a12498c8f4b8216c331dd63c56c7fda6b291c
parentd309b6a2658cd5dfd3ecdcbe698e5ee645d933b1
scsi: sr: Return correct event when media event code is 3

[ Upstream commit 5c04243a56a7977185b00400e59ca7e108004faf ]

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: 7dd753ca59d6 ("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/20210726114913.6760-1-limanyi@uniontech.com
Signed-off-by: Li Manyi <limanyi@uniontech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/sr.c