Skip to content

Fix cdrom autoclose

Michal Suchanek linux-block linux-fsdevel linux-scsi lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest posting 2/210 patches 5 repliesIn review
  2. v4 posting 1/210 patches 2 repliesSuperseded
  3. v37 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v28 patches25 repliesSuperseded

Changes in v4 from the cover letter

- fix crash reported by kernel test robot
- fix the debug message logic while refactoring cdrom_open
- move repeated code out of __blkdev_get

Patches in v4 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10cdrom: add poll_event_interruptibledrivers/cdrom/cdrom.c+14 -00 replies
2/10cdrom: factor out common open_for_* codedrivers/cdrom/cdrom.c+40 -780 replies
3/10cdrom: wait for the tray to closedrivers/cdrom/cdrom.c+33 -30 replies
4/10cdrom: export autoclose logic as a separate functiondrivers/cdrom/cdrom.c include/linux/cdrom.h+61 -250 replies
5/10cdrom: unify log messages.drivers/cdrom/cdrom.c+128 -1580 replies
6/10bdev: reset first_open when looping in __blkget_devfs/block_dev.c+2 -10 replies
7/10bdev: separate parts of __blkdev_get as helper functionsfs/block_dev.c+24 -180 replies
8/10bdev: add open_finishDocumentation/filesystems/locking.rst fs/block_dev.c include/linux/blkdev.h+26 -40 replies
9/10scsi: blacklist: add VMware ESXi cdrom - broken tray emulationdrivers/scsi/scsi_devinfo.c drivers/scsi/sr.c include/scsi/scsi_devinfo.h+21 -70 replies
10/10scsi: sr: wait for the medium to become readydrivers/scsi/sr.c+42 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 rebase 00/10] Fix cdrom autoclose

Hello,

there is cdrom autoclose feature that is supposed to close the tray, wait for the disc to become ready, and then open the device.

This used to work in ancient times. Then in old times there was a hack in util-linux which worked around the breakage which probably resulted from switching to scsi emulation.

Currently util-linux maintainer refuses to merge another hack on the basis that kernel still has the feature so it should be fixed there. The code needs not be replicated in every userspace utility like mount or dd which has no business knowing which devices are CD-roms and where the autoclose setting is in the kernel.

This is rebase on top of current master.

Also it seems that most people think that this is fix for WMware because there is one patch dealing with WMware.

This is fix for Linux.

Expected (ca Linux 2.4):

eject
< put CD on tray >
mount /dev/cdrom
...
< cdrom now mounted >

Actual:
mount: /mnt: no medium found on /dev/sr0.

Thanks

Michal

v3:
- change the VMware workaround to use blacklist flag
- use exported function instead of ioctl
v4:
- fix crash reported by kernel test robot
- fix the debug message logic while refactoring cdrom_open
- move repeated code out of __blkdev_get

Michal Suchanek (10):
cdrom: add poll_event_interruptible
cdrom: factor out common open_for_* code
cdrom: wait for the tray to close
cdrom: export autoclose logic as a separate function
cdrom: unify log messages.
bdev: reset first_open when looping in __blkget_dev
bdev: separate parts of __blkdev_get as helper functions
bdev: add open_finish
scsi: blacklist: add VMware ESXi cdrom - broken tray emulation
scsi: sr: wait for the medium to become ready

 Documentation/filesystems/locking.rst |   2 +
 drivers/cdrom/cdrom.c                 | 471 +++++++++++++-------------
 drivers/scsi/scsi_devinfo.c           |  15 +-
 drivers/scsi/sr.c                     |  60 +++-
 fs/block_dev.c                        |  72 ++--
 include/linux/blkdev.h                |   1 +
 include/linux/cdrom.h                 |   1 +
 include/scsi/scsi_devinfo.h           |   7 +-
 8 files changed, 357 insertions(+), 272 deletions(-)
Signature · 1 line
2.23.0