[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191024131432.GF2963@bombadil.infradead.org>
Date: Thu, 24 Oct 2019 06:14:32 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Michal Suchánek <msuchanek@...e.de>
Cc: Christoph Hellwig <hch@...radead.org>, linux-scsi@...r.kernel.org,
Jonathan Corbet <corbet@....net>, Jens Axboe <axboe@...nel.dk>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Eric Biggers <ebiggers@...gle.com>,
"J. Bruce Fields" <bfields@...hat.com>,
Benjamin Coddington <bcodding@...hat.com>,
Hannes Reinecke <hare@...e.com>,
Omar Sandoval <osandov@...com>, Ming Lei <ming.lei@...hat.com>,
Damien Le Moal <damien.lemoal@....com>,
Bart Van Assche <bvanassche@....org>,
Tejun Heo <tj@...nel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2 8/8] scsi: sr: wait for the medium to become ready
On Thu, Oct 24, 2019 at 10:51:36AM +0200, Michal Suchánek wrote:
> On Wed, Oct 23, 2019 at 07:24:06PM -0700, Christoph Hellwig wrote:
> > On Wed, Oct 23, 2019 at 02:52:47PM +0200, Michal Suchanek wrote:
> > > +static int sr_block_open_finish(struct block_device *bdev, fmode_t mode,
> > > + int ret)
> > > +{
> > > + struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
> > > +
> > > + /* wait for drive to get ready */
> > > + if ((ret == -ENOMEDIUM) && !(mode & FMODE_NDELAY)) {
> > > + struct scsi_device *sdev = cd->device;
> > > + /*
> > > + * Cannot use sr_block_ioctl because it locks sr_mutex blocking
> > > + * out any processes trying to access the drive
> > > + */
> > > + scsi_autopm_get_device(sdev);
> > > + cdrom_ioctl(&cd->cdi, bdev, mode, CDROM_AUTOCLOSE, 0);
> > > + ret = __sr_block_open(bdev, mode);
> > > + scsi_autopm_put_device(sdev);
> >
> > Ioctls should never be used from kernel space. We have a few leftovers,
> > but we need to get rid of that and not add more.
>
> What is the alternative?
Call the function that would be called by the ioctl instead.
Powered by blists - more mailing lists