[PATCH] eject -T support
Denis Vlasenko
vda.linux at googlemail.com
Sat Oct 7 14:42:49 UTC 2006
> About this comment:
> // FIXME: what if something is mounted OVER our cdrom?
> // We will unmount something else??!
> // What if cdrom is mounted many times?
>
> 1) something mounted OVER our cdrom:
>
> /dev/hdd on /media/cdrom1 type iso9660 (ro,noexec,nosuid,nodev)
> /dev/hdb1 on /media/cdrom1 type reiserfs (rw)
>
> ./busybox eject
> eject: /dev/cdrom: Input/output error
>
> /dev/hdd on /media/cdrom1 type iso9660 (ro,noexec,nosuid,nodev)
>
> the overmounted block device is unmounted and eject fails.
This is grossly incorrect.
> 2) cdrom is mounted many times:
>
> /dev/hdd on /media/cdrom1 type iso9660 (ro)
> /dev/hdd on /media/cdrom0 type iso9660 (ro)
>
> root at localhost:/dev/pts/1:/root/Desktop/busybox# ./busybox eject
> eject: /dev/cdrom: Input/output error
>
> cat /proc/mounts
> /dev/hdd /media/cdrom1 iso9660 ro 0 0
>
> cat /etc/mtab
>
> /dev/hda1 on / type ext3 (rw,noatime,errors=remount-ro)
> proc on /proc type proc (rw)
> /sys on /sys type sysfs (rw)
> varrun on /var/run type tmpfs (rw)
> varlock on /var/lock type tmpfs (rw)
> udev on /dev type tmpfs (rw)
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
> devshm on /dev/shm type tmpfs (rw)
> /dev/hda2 on /boot type ext2 (rw)
>
> block device is unmounted one time, eject fails,
> mtab is not updated correctly.
Also very bad.
> These corner cases seems to be fixed by this example code,
> but it is rather bloated as it imports half of umount's code
> and is not well tested.
> If you want to take a look at it....maybe you can squeeze it
> or you have some better idea.
I have an idea: remove that code entirely, then:
#!/bin/sh
umount /dev/cdrom
eject
Would this work?
--
vda
More information about the busybox
mailing list