Re: [PATCH] libmount: if ENOMEDIUM and tray is open, close tray and retry

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

 



On Fri, 28 Jul 2017 17:48:22 +0200
Stanislav Brabec <sbrabec@xxxxxxx> wrote:

> Dne 28.7.2017 v 17:26 Stanislav Brabec napsal(a):
> > Dne 27.7.2017 v 10:58 Yuriy M. Kaminskiy napsal(a):  
> >> (And, I used cdrom a long time ago, but IIRC there were some driver
> >> settings to automatically close tray on device open, so that this
> >> patch should not be needed?)  
> > 
> > Thanks for this hint. Yes, you are true:
> > /proc/sys/dev/cdrom/autoclose
> > /proc/sys/dev/cdrom/autoeject
> > 
> > But this does not work with the current mount. The mount request
> > will expire on timeout earlier than the tray of ordinary CDROM
> > closes.
> > 
> > But yes, it is possible to implement a different, simpler patch that
> > will make the autoclose feature working, and not cause delays in
> > case of no medium.
> >   
> 
> I did some testing.
> 
> The kernel autoclose feature should do exactly the same as my patch
> attempts. But kernel seems to be broken. Before the tray actually
> closes, kernel returns ENOMEDIUM.
> 
> From strace log when a standard DVD drive is open with a DVD laying on
> the tray:
> 
> 17:30:32.719041 access("/dev/sr0", F_OK) = 0 <0.000005>
> (here the tray starts to close)
> 17:30:32.719054 open("/dev/sr0", O_RDONLY|O_CLOEXEC) = -1 ENOMEDIUM
> (No medium found) <1.450436>
> ...
> 17:30:34.169943 mount("/dev/sr0", "/mnt", "vfat",
> MS_MGC_VAL|MS_SILENT, NULL) = -1 ENOMEDIUM (No medium found)
> <0.083741>
> 
> I am nearly sure that it worked ~20 years ago.
> 

Since we have facility for

 - telling if the drive is closed
 - telling if the drive can be closed
 - closing the drive

it is completely reasonable to return ENOMEDIUM from kernel when the
tray is open and let userspace decide if it wants to attempt to close
the tray and how long it wants to wait for the tray to close (it may be
blocked/broken).

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux