Print a more helpful message in case the kernel doesn't support the 'fuseblk' filesys...
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 29 Nov 2006 16:01:23 +0000 (16:01 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Wed, 29 Nov 2006 16:01:23 +0000 (16:01 +0000)
ChangeLog
kernel/dir.c
util/fusermount.c

index dc1737d6fbf05adb3309aed85f181d1f2974d8e6..ef3acf522e5de28b3db36309224f113469053806 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-11-29  Miklos Szeredi <miklos@szeredi.hu>
+
+       * fusermount: Print a more helpful message in case the kernel
+       doesn't support the 'fuseblk' filesystem type.  This has been
+       biting ntfs-3g users.  Reported by Yura Pakhuchiy
+
 2006-11-19  Miklos Szeredi <miklos@szeredi.hu>
 
        * Fix bug in certain error paths of lookup routines.  The request
index bc69a0661dbfebccfb329e0caf362dbd05576b18..0f0168874f626a157e50de975b21739e5adfb673 100644 (file)
@@ -1086,6 +1086,9 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
 
        memset(&inarg, 0, sizeof(inarg));
        iattr_to_fattr(attr, &inarg);
+       /* Defend against future expansion of ATTR_FILE use */
+       if (S_ISDIR(inode->i_mode))
+               inarg.valid &= ~FATTR_FH;
        req->in.h.opcode = FUSE_SETATTR;
        req->in.h.nodeid = get_node_id(inode);
        req->in.numargs = 1;
index 014d4eafe5f8f7385d29c22bb49793c5c752d55e..9326037fdaa3839d55569f634df37944d537c5df 100644 (file)
@@ -575,6 +575,23 @@ static int check_mountpoint_empty(const char *mnt, mode_t rootmode,
     return 0;
 }
 
+static int has_fuseblk(void)
+{
+    char buf[256];
+    FILE *f = fopen("/proc/filesystems", "r");
+    if (!f)
+        return 1;
+
+    while (fgets(buf, sizeof(buf), f))
+        if (strcmp(buf, "fuseblk\n") == 0) {
+            fclose(f);
+            return 1;
+        }
+
+    fclose(f);
+    return 0;
+}
+
 static int do_mount(const char *mnt, const char **type, mode_t rootmode,
                     int fd, const char *opts, const char *dev, char **fsnamep,
                     char **mnt_optsp, off_t rootsize)
@@ -686,7 +703,11 @@ static int do_mount(const char *mnt, const char **type, mode_t rootmode,
         res = mount(fsname, mnt, *type, flags, optbuf);
     }
     if (res == -1) {
-        fprintf(stderr, "%s: mount failed: %s\n", progname, strerror(errno));
+        int errno_save = errno;
+        if (blkdev && errno == ENODEV && !has_fuseblk())
+            fprintf(stderr, "%s: 'fuseblk' support missing; try the kernel module from fuse-2.6.0 or later\n", progname);
+        else
+            fprintf(stderr, "%s: mount failed: %s\n", progname, strerror(errno_save));
         goto err;
     } else {
         *fsnamep = fsname;