All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: sr: Fix some cdroms automatically ejected when booting into the system
@ 2022-04-27  9:09 jinxiaobo
  2022-04-28  2:51 ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: jinxiaobo @ 2022-04-27  9:09 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, jinxiaobo

sr_get_events() has been called before udev starts when SCSI CDROM is
built-in and AHCI SATA is bulit-in,so sr events propagated to 
user space are not handled.
if both is loadable, udev will handle sr events, some cdroms may eject.
We need call sr_get_events() once before device_add_disk() 
to keep the same result, whether both are built-in or loadable.

Signed-off-by: jinxiaobo <jinxiaobo@uniontech.com>
---
 drivers/scsi/sr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index cbd92891a762..043b3ab72d7a 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -676,6 +676,7 @@ static int sr_probe(struct device *dev)
 	set_capacity(disk, cd->capacity);
 	disk->private_data = cd;
 
+	sr_get_events(sdev);
 	if (register_cdrom(disk, &cd->cdi))
 		goto fail_minor;
 
-- 
2.20.1




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

* Re: [PATCH] scsi: sr: Fix some cdroms automatically ejected when booting into the system
  2022-04-27  9:09 [PATCH] scsi: sr: Fix some cdroms automatically ejected when booting into the system jinxiaobo
@ 2022-04-28  2:51 ` Martin K. Petersen
  2022-05-05  3:01   ` job jin
  0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2022-04-28  2:51 UTC (permalink / raw)
  To: jinxiaobo; +Cc: jejb, martin.petersen, linux-scsi, linux-kernel


Hi jinxiaobo!

> sr_get_events() has been called before udev starts when SCSI CDROM is
> built-in and AHCI SATA is bulit-in,so sr events propagated to user
> space are not handled.  if both is loadable, udev will handle sr
> events, some cdroms may eject.  We need call sr_get_events() once
> before device_add_disk() to keep the same result, whether both are
> built-in or loadable.

I am not sure how calling sr_get_events() and throwing away the result
ensures that events get propagated to udev. Isn't this just changing
timing slightly?

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: sr: Fix some cdroms automatically ejected when booting into the system
  2022-04-28  2:51 ` Martin K. Petersen
@ 2022-05-05  3:01   ` job jin
  0 siblings, 0 replies; 3+ messages in thread
From: job jin @ 2022-05-05  3:01 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: jejb, linux-scsi, linux-kernel

Hi Martin K. Petersen!

As things stand, we cannot guarantee that all events will be propagated
 to udev. So I think, we don't need to ensure that all events are received
 by udev, we only need to ensure that events after sr probe can be received
 by udev and actively discard events before sr probe.



>
>
> Hi jinxiaobo!
>
> > sr_get_events() has been called before udev starts when SCSI CDROM is
> > built-in and AHCI SATA is bulit-in,so sr events propagated to user
> > space are not handled.  if both is loadable, udev will handle sr
> > events, some cdroms may eject.  We need call sr_get_events() once
> > before device_add_disk() to keep the same result, whether both are
> > built-in or loadable.
>
> I am not sure how calling sr_get_events() and throwing away the result
> ensures that events get propagated to udev. Isn't this just changing
> timing slightly?
>
> --
> Martin K. Petersen      Oracle Linux Engineering
>



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

end of thread, other threads:[~2022-05-05  3:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27  9:09 [PATCH] scsi: sr: Fix some cdroms automatically ejected when booting into the system jinxiaobo
2022-04-28  2:51 ` Martin K. Petersen
2022-05-05  3:01   ` job jin

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.