All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-scsi@vger.kernel.org
Subject: [Bug 213759] New: CD tray ejected on hibernate resume
Date: Fri, 16 Jul 2021 22:37:05 +0000	[thread overview]
Message-ID: <bug-213759-11613@https.bugzilla.kernel.org/> (raw)

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.

             reply	other threads:[~2021-07-16 22:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 22:37 bugzilla-daemon [this message]
2021-07-16 22:38 ` [Bug 213759] CD tray ejected on hibernate resume 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-213759-11613@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.