Michal Suchánek wrote: > On Mon, 2 Oct 2017 15:06:33 +0200 > Stanislav Brabec <sbrabec@xxxxxxx> wrote: > >> Michal Suchánek wrote: >>> 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). >>> >> But then, what is the purpose of /proc/sys/dev/cdrom/autoclose? > > It can be used as a hint in mount if closing the tray is desired or > not. Such feature could be completely implemented in the user space, so there is no reason to stay in the kernel in such a limited form. 20 years ago, it was a completely working implementation inside the kernel. User space just called mount(), and it succeeded. If that requires user space loop loop, then there is no reason to implement sysfs entry just to perform tray close inside mount() syscall and then fail anyway. > I guess this used to work with IDE drivers not using SCSI emulation. > > With SCSI the close tray command is executed like any other with > default timeout and obviously does time out in most cases. > > But how long should the kernel wait? Is 1 minute ok? Should it wait 5 > minutes in case the user did not align the medium properly and needs to > realign it? Who should set this timeout, where? > The timeout should be equal to the time to close tray on the slowest device. Guessing something about 3 to 5 seconds may be fine. After that time (or several times until that time), just check when the tray starts to report that it is closed. By the way, most drives open the tray in the case of medium misalignment. -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: sbrabec@xxxxxxxx Křižíkova 148/34 (Corso IIa) tel: +49 911 7405384547 186 00 Praha 8-Karlín fax: +420 284 084 001 Czech Republic http://www.suse.cz/ PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76 -- 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