lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191127081144.GZ11661@kitsune.suse.cz>
Date:   Wed, 27 Nov 2019 09:11:44 +0100
From:   Michal Suchánek <msuchanek@...e.de>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     linux-scsi@...r.kernel.org, linux-block@...r.kernel.org,
        Jonathan Corbet <corbet@....net>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Eric Biggers <ebiggers@...gle.com>,
        "J. Bruce Fields" <bfields@...hat.com>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        Benjamin Coddington <bcodding@...hat.com>,
        Ming Lei <ming.lei@...hat.com>,
        Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
        Bart Van Assche <bvanassche@....org>,
        Damien Le Moal <damien.lemoal@....com>,
        Hou Tao <houtao1@...wei.com>,
        Pavel Begunkov <asml.silence@...il.com>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Jan Kara <jack@...e.cz>, Hannes Reinecke <hare@...e.com>,
        "Ewan D. Milne" <emilne@...hat.com>,
        Christoph Hellwig <hch@...radead.org>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v4 rebase 00/10] Fix cdrom autoclose

On Tue, Nov 26, 2019 at 04:13:32PM -0700, Jens Axboe wrote:
> On 11/26/19 1:21 PM, Michal Suchánek wrote:
> > On Tue, Nov 26, 2019 at 01:01:42PM -0700, Jens Axboe wrote:
> >> On 11/26/19 12:54 PM, Michal Suchanek wrote:
> >>> 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.
> >>
> >> I think the main complaint with this is that it's kind of a stretch to
> >> add core functionality for a device type that's barely being
> >> manufactured anymore and is mostly used in a virtualized fashion. I
> >> think it you could fix this without 10 patches of churn and without
> >> adding a new ->open() addition to fops, then people would be a lot more
> >> receptive to the idea of improving cdrom auto-close.
> > 
> > I see no way to do that cleanly.
> > 
> > There are two open modes for cdrom devices - blocking and
> > non-blocking.
> > 
> > In blocking mode open() should analyze the medium so that it's ready
> > when it returns. In non-blocking mode it should return immediately so
> > long as you can talk to the device.
> > 
> > When waiting in open() with locks held the processes trying to open
> > the device are locked out regradless of the mode they use.
> > 
> > The only way to solve this is to pretend that the device is open and
> > do the wait afterwards with the device unlocked.
> 
> How is this any different from an open on a file that needs to bring in
> meta data on a busy rotating device, which can also take seconds?

First, accessing a file will take seconds only when your system is
seriously overloaded or misconfigured. The access time for rotational
storage is tens of milliseconds. With cdrom the access time after
closing the door is measured in tens of seconds on common hardware. It
can be shorter but also possibly longer. I am not aware of any limit
there. It may be reasonable to want to get device status during this
time.

Second, fetching the metadata for the file does not block operations that
don't need the metadata. Here waiting for the drive to get ready blocks
all access. You could get drive status if you did not try to open it
but once you do you can no longer talk to it.

Thanks

Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ