Ya happens as stated by Yoshino: This problem occurs especially when proc filesystem is mounted inside a chrooted environment; affecting pbuilder/cowbuilder.

When you mount proc in a mountpoint via chroot, the /etv/mtab entry doesn't contains the newly mounted proc (as debootstrap do, for example).

# chroot /var/cache/pbuilder/build/1631 mount -t proc proc /proc
# cat /etc/fstab
proc            /proc           proc    nodev,noexec,nosuid 0       0
.
.
.
(the /etc/mtab entry doesn't contains newly mounted proc, only the system one is present)

now, if i try to umount /var/cache/pbuilder/build/1631/proc when my cwd is /var/cache/pbuilder/build/1631 it fails:

root@pr0gg3d:/var/cache/pbuilder/build/1631# umount -vv /var/cache/pbuilder/build/1631/proc
Trying to unmount /var/cache/pbuilder/build/1631/proc
umount: /proc: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Notice *how it tries to umount /proc*. But if i change my working dir, it works:

root@pr0gg3d:/var/cache/pbuilder/build/1631# cd ..
root@pr0gg3d:/var/cache/pbuilder/build# umount -vv /var/cache/pbuilder/build/1631/proc
Trying to unmount /var/cache/pbuilder/build/1631/proc
Could not find /var/cache/pbuilder/build/1631/proc in mtab
/var/cache/pbuilder/build/1631/proc has been unmounted
root@pr0gg3d:/var/cache/pbuilder/build#

Imho this problem was introduced from the 2.19.1-rc1. The commit is

http://anonscm.debian.org/gitweb/?p=users/lamont/util-linux.git;a=commitdiff;h=06b814cc5c7cfcf6f4284aa1a0d140f322e66594;hp=f7e08f83faae3def36423bee75638f7e69f495a2

Introducing the canonicalization of fsname(s) in getmntdevbackward(), the standard proc entry it's seen as non-canonical name and canonicalize() tries to match with the cwd path.

If there's a match (/var/cache/pbuilder/build/1631/proc) it tries to umount the associated mountpoint /proc but this is wrong.

Changing the working path, as in my example above, the /var/cache/pbuilder/build/proc doesn't exists, and the code assumes that there's no match in /etc/mtab, prints "Could not find /var/cache/pbuilder/build/1631/proc in mtab" and tries to unmount the passed mountpoint.

It sounds like a bug for me. Consider that we have this behaviour also for the others spec as "none" "sysfs" and so on...

Maybe we should use the canonicalize_spec() in getmntdevbackward() instead of a plain canonicalize(), because proc (and others) shouldn't considered as a non-canonical-path but as a spec one (as canonicalize_spec() does).

Here is a patch against git

diff --git a/mount/fstab.c b/mount/fstab.c
index 8ce733b..32cf467 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -314,9 +314,11 @@ getmntdevbackward (const char *name, struct mntentchn *mcprev) {
             return mc;
     }

-    /* non-canonical names in mtab (this is BAD THING!) */
+    /* non-canonical names in mtab (this is BAD THING!)
+         * but it should be allowed only for spec fsname(s)
+         */
     for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev) {
-        char *cn = canonicalize(mc->m.mnt_fsname);
+        char *cn = canonicalize_spec(mc->m.mnt_fsname);
         int res = cn ? streq(cn, name) : 0;

         free(cn);







--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to