All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 213759] New: CD tray ejected on hibernate resume
@ 2021-07-16 22:37 bugzilla-daemon
  2021-07-16 22:38 ` [Bug 213759] " bugzilla-daemon
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: bugzilla-daemon @ 2021-07-16 22:37 UTC (permalink / raw)
  To: linux-scsi

https://bugzilla.kernel.org/show_bug.cgi?id=213759

            Bug ID: 213759
           Summary: CD tray ejected on hibernate resume
           Product: SCSI Drivers
           Version: 2.5
    Kernel Version: 5.10.48
          Hardware: x86-64
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: scsi_drivers-other@kernel-bugs.osdl.org
          Reporter: computerpro_58@hotmail.com
        Regression: No

After resuming from hibernation (shutdown-disk), CD tray (which is empty and
untouched) is ejected on resume. I use a LUKS-encrypted root partition, and the
tray is always ejected before my distro NixOS (cryptsetup) prompts for my key.

I bi-sect'd the problem commit down to this one:

From: ManYi Li <limanyi@uniontech.com>
To: axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
        ManYi Li <limanyi@uniontech.com>
Subject: [PATCH] sr: Fix get the error media event code
Date: Fri, 11 Jun 2021 17:44:02 +0800
Message-ID: <20210611094402.23884-1-limanyi@uniontech.com> (raw)

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


That commit was backported onto a number of kernels, so I can reproduce this on
a number of different kernels (master, stable, LTS). I'm not sure if this is a
bug in the CD-reader (tossing back an incorrect status), or if the bug is
within this driver?

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

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

end of thread, other threads:[~2021-10-15 17:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 22:37 [Bug 213759] New: CD tray ejected on hibernate resume bugzilla-daemon
2021-07-16 22:38 ` [Bug 213759] " bugzilla-daemon
2021-07-17 21:58 ` bugzilla-daemon
2021-07-20  3:58 ` bugzilla-daemon
2021-07-20  5:24 ` bugzilla-daemon
2021-07-23 15:51 ` bugzilla-daemon
2021-07-24  9:42 ` bugzilla-daemon
2021-07-24 10:31 ` bugzilla-daemon
2021-07-26 11:01 ` bugzilla-daemon
2021-07-27 14:55 ` bugzilla-daemon
2021-08-25  5:34 ` bugzilla-daemon
2021-08-28 22:40 ` bugzilla-daemon
2021-09-15  3:55 ` bugzilla-daemon
2021-09-22 18:27 ` bugzilla-daemon
2021-10-15 17:59 ` bugzilla-daemon

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.