linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.12 1/5] scsi: sr: Return appropriate error code when disk is ejected
@ 2021-06-28 21:20 Sasha Levin
  2021-06-28 21:20 ` [PATCH AUTOSEL 5.12 2/5] s390/vfio-ap: clean up mdev resources when remove callback invoked Sasha Levin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Levin @ 2021-06-28 21:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: ManYi Li, Martin K . Petersen, Sasha Levin, linux-scsi

From: ManYi Li <limanyi@uniontech.com>

[ Upstream commit 7dd753ca59d6c8cc09aa1ed24f7657524803c7f3 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/sr.c | 2 ++
 1 file changed, 2 insertions(+)

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;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-28 21:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 21:20 [PATCH AUTOSEL 5.12 1/5] scsi: sr: Return appropriate error code when disk is ejected Sasha Levin
2021-06-28 21:20 ` [PATCH AUTOSEL 5.12 2/5] s390/vfio-ap: clean up mdev resources when remove callback invoked Sasha Levin
2021-06-28 21:20 ` [PATCH AUTOSEL 5.12 3/5] gpio: mxc: Fix disabled interrupt wake-up support Sasha Levin
2021-06-28 21:20 ` [PATCH AUTOSEL 5.12 4/5] drm/nouveau: fix dma_address check for CPU/GPU sync Sasha Levin
2021-06-28 21:20 ` [PATCH AUTOSEL 5.12 5/5] gpio: AMD8111 and TQMX86 require HAS_IOPORT_MAP Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).