lkml.org 
[lkml]   [2019]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2019-10-24 15:14    [W:0.047 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site