* [PATCH] sr: Fix get the error media event code
@ 2021-06-11 9:44 ManYi Li
2021-06-19 3:36 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: ManYi Li @ 2021-06-11 9:44 UTC (permalink / raw)
To: axboe, jejb, martin.petersen; +Cc: linux-kernel, linux-scsi, ManYi Li
Eject the specified slot or media through a mechanical switch on the Drive,
med->media_event_code is 3 not 1 in the sr_get_events().
If disk_flush_events() and sr_block_open() are called,
clearing is 1 or 3 in the sr_check_events(),then it report
DISK_EVENT_MEDIA_CHANGE not DISK_EVENT_EJECT_REQUEST.
If disk_flush_events() and sr_block_open() aren't called,
clearing is 0 in the sr_check_events(),then it doesn't
report any event.
Signed-off-by: ManYi Li <limanyi@uniontech.com>
---
drivers/scsi/sr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 482a07b662a9..94c254e9012e 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.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sr: Fix get the error media event code
2021-06-11 9:44 [PATCH] sr: Fix get the error media event code ManYi Li
@ 2021-06-19 3:36 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-06-19 3:36 UTC (permalink / raw)
To: axboe, jejb, ManYi Li; +Cc: Martin K . Petersen, linux-kernel, linux-scsi
On Fri, 11 Jun 2021 17:44:02 +0800, ManYi Li wrote:
> Eject the specified slot or media through a mechanical switch on the Drive,
> med->media_event_code is 3 not 1 in the sr_get_events().
>
> If disk_flush_events() and sr_block_open() are called,
> clearing is 1 or 3 in the sr_check_events(),then it report
> DISK_EVENT_MEDIA_CHANGE not DISK_EVENT_EJECT_REQUEST.
>
> [...]
Applied to 5.13/scsi-fixes, thanks!
[1/1] sr: Fix get the error media event code
https://git.kernel.org/mkp/scsi/c/7dd753ca59d6
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-19 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 9:44 [PATCH] sr: Fix get the error media event code ManYi Li
2021-06-19 3:36 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.