Package: schroot
Version: 1.0.2-1
Severity: normal
Tags: patch

While using schroot on LVM snapshots with sbuild, I have sometimes run into
situations where build deps start up services (like cron, dbus, etc).
Once the build is finished, schroot attempts to umount and destroy the
LVM snapshot, but since there are still processes running in the chroot,
the umount fails.

Since the chroot is "over", it seems like it makes sense to kill all the
processes left in the chroot, and then reattempt to umount.  This patch
implements that.  Does this seem like a sensible change?

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-10-generic
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Index: schroot/setup/10mount
===================================================================
--- schroot/setup/10mount       (revision 1032)
+++ schroot/setup/10mount       (working copy)
@@ -32,7 +32,15 @@
        if [ "$AUTH_VERBOSITY" = "verbose" ]; then
            echo "Unmounting $mountloc"
        fi
-       umount "$mountloc" || exit 1
+       if ! umount "$mountloc" 2>/dev/null; then
+           FUSER_OPTS="-mk"
+           if [ "$AUTH_VERBOSITY" = "verbose" ]; then
+               echo "Killing processes on $mountloc"
+               FUSER_OPTS="$FUSER_OPTS -v"
+           fi
+           fuser $FUSER_OPTS $mountloc
+           umount "$mountloc" || exit 1
+       fi
     done || exit 1
 }
 

Reply via email to