Re: [PATCH v2 8/8] scsi: sr: wait for the medium to become ready

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux