[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191024022406.GD11485@infradead.org>
Date: Wed, 23 Oct 2019 19:24:06 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Michal Suchanek <msuchanek@...e.de>
Cc: 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 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.
Powered by blists - more mailing lists