'fusermount -u' did not umount the filesystem if /etc/mtab was a symlink
authorMiklos Szeredi <miklos@szeredi.hu>
Mon, 12 Nov 2007 13:57:12 +0000 (13:57 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Mon, 12 Nov 2007 13:57:12 +0000 (13:57 +0000)
ChangeLog
lib/mount_util.c

index c0313d29a163cf16327204015fb317698be34a6b..5cdbc9ad9eab1af25aaa84506d253d5245d99ce6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-12  Miklos Szeredi <miklos@szeredi.hu>
+
+       * 'fusermount -u' did not umount the filesystem if /etc/mtab was a
+       symlink.  This bug was introduced in 2.7.1 by "Don't call
+       /bin/[u]mount if /etc/mtab is a symlink".  Found by robertsong.
+
 2007-10-16  Miklos Szeredi <miklos@szeredi.hu>
 
        * Released 2.7.1
index c7b2123d537189bc4c223de1008a8719f835f660..9ce431aeff48f8b9219fbdaa4fd129a2cfcae7da 100644 (file)
@@ -17,6 +17,7 @@
 #include <mntent.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <sys/mount.h>
 
 static int mtab_needs_update(const char *mnt)
 {
@@ -91,8 +92,13 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy)
     int res;
     int status;
 
-    if (!mtab_needs_update(mnt))
-        return 0;
+    if (!mtab_needs_update(mnt)) {
+        res = umount2(mnt, lazy ? 2 : 0);
+        if (res == -1)
+            fprintf(stderr, "%s: failed to unmount %s: %s\n", progname,
+                    mnt, strerror(errno));
+        return res;
+    }
 
     res = fork();
     if (res == -1) {