Bug 2425

Summary: umount -a -r fails
Product: Busybox Reporter: a6436575
Component: OtherAssignee: unassigned
Status: RESOLVED WORKSFORME    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.13.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description a6436575 2010-08-24 07:39:30 UTC
calling umount -a -r fails. Output of strace:

...
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=397215, ...}) = 0
close(3)                                = 0
munmap(0x2aaae000, 1099)                = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=20694, ...}) = 0
mprotect(0x2ab5f000, 4096, PROT_READ)   = 0
mprotect(0x2aacc000, 4096, PROT_READ)   = 0
mprotect(0x2ac53000, 4096, PROT_READ)   = 0
mprotect(0x2aaec000, 4096, PROT_READ)   = 0
ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
getpid()                                = 8119
getrlimit(RLIMIT_STACK, {rlim_cur=2040*1024, rlim_max=RLIM_INFINITY}) = 0
rt_sigaction(SIGRT_0, {SIG_DFL, [RT_73 RT_74 RT_83 RT_84 RT_85 RT_89 RT_90 RT_91 RT_92 RT_93 RT_94], SA_STACK|SA_INTERRUPT|SA_SIGINFO|SA_NOCLDWAIT|0x2aabd60}, NULL, 16) = 0
rt_sigaction(SIGRT_1, {SIG_DFL, [RT_73 RT_74 RT_83 RT_84 RT_85 RT_89 RT_90 RT_91 RT_92 RT_93 RT_94], SA_STACK|SA_INTERRUPT|SA_SIGINFO|SA_NOCLDWAIT|0x2aabc70}, NULL, 16) = 0
rt_sigaction(SIGRT_2, {SIG_DFL, [RT_73 RT_74 RT_83 RT_84 RT_85 RT_89 RT_90 RT_91 RT_92 RT_93 RT_94], SA_STACK|SA_INTERRUPT|SA_SIGINFO|SA_NOCLDWAIT|0x2aaae54}, NULL, 16) = 0
rt_sigprocmask(SIG_BLOCK, [RT_0], NULL, 16) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 16) = 0
brk(0)                                  = 0x4bf000
brk(0x4c0000)                           = 0x4c0000
ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
getuid()                                = 0
brk(0x4c1000)                           = 0x4c1000
open("/proc/mounts", O_RDONLY)          = 3
ioctl(3, TIOCNXCL, 0x7fbd6a78)          = -1 ENOTTY (Inappropriate ioctl for device)
brk(0x4c2000)                           = 0x4c2000
read(3, "rootfs / rootfs rw 0 0\n/dev/root"..., 4096) = 285
read(3, "", 4096)                       = 0
close(3)                                = 0
exit(-1)                                = ?

Mointpoints:

rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
ramfs on /tmp type ramfs (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
devpts on /proc/bus/usb type usbfs (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
/dev/discs/disc0/part1 on /jffs type ext2 (rw)

Any idea whyt's wrong here? I noticed that a reboot does not umount drives. Looking at the busybox sources I noticed that default behaviour is to kill processes, call inittab actions e.g. umount -a -r and then stop.
Comment 1 Denys Vlasenko 2011-02-07 15:11:25 UTC
(In reply to comment #0)
> calling umount -a -r fails. Output of strace:
> 
> ...
> open("/proc/mounts", O_RDONLY)          = 3
> ioctl(3, TIOCNXCL, 0x7fbd6a78)          = -1 ENOTTY (Inappropriate ioctl for
> device)
> brk(0x4c2000)                           = 0x4c2000
> read(3, "rootfs / rootfs rw 0 0\n/dev/root"..., 4096) = 285
> read(3, "", 4096)                       = 0
> close(3)                                = 0
> exit(-1)                                = ?
> 
> Mointpoints:
> 
> rootfs on / type rootfs (rw)
> /dev/root on / type squashfs (ro)
> none on /dev type devfs (rw)
> proc on /proc type proc (rw)
> ramfs on /tmp type ramfs (rw)
> sysfs on /sys type sysfs (rw)
> devpts on /dev/pts type devpts (rw)
> devpts on /proc/bus/usb type usbfs (rw)
> /dev/mtdblock/4 on /jffs type jffs2 (rw)
> /dev/discs/disc0/part1 on /jffs type ext2 (rw)
> 
> Any idea whyt's wrong here?

Strange.
You can experiment by adding debugging here:


                while (getmntent_r(fp, &me, bb_common_bufsiz1, sizeof(bb_common_bufsiz1))) {
                        /* Match fstype if passed */
bb_error_msg("Matching '%s'", me.mnt_fsname);
                        if (!match_fstype(&me, fstype))
                                continue;
bb_error_msg("Matched '%s'", me.mnt_fsname);
                        m = xzalloc(sizeof(*m));
                        m->next = mtl;
                        m->device = xstrdup(me.mnt_fsname);
                        m->dir = xstrdup(me.mnt_dir);
                        mtl = m;
                }

in util-linux/umount.c. This will tell you whether /dev/mtdblock/4 is seen, and selected for umount.
Comment 2 Denys Vlasenko 2011-05-09 01:32:45 UTC
Closing this, since I have no reproducer.

Please reopen if you have more data.