[systemd-devel] Considering fuse+sshfs mounts as "network"

Colin Guthrie gmane at colin.guthr.ie
Wed Jan 11 01:24:51 PST 2012


Hi,

I've got some users with fuse based sshfs mounts in their fstab which is
messing up their boot.

Obviously they can add "noauto" but then their argument is that they do
want them to be automatically mounted... I'm sure there are other ways
to solve this, but by the same token, there already exists a whitelist
in the code to consider certain filesystems as "network" and I was
wondering if we could extend this to fuse+sshfs too?

Would something like this be accepted if it was tidied up (and actually
tested!)?:

commit 488b5ba5f8fcb368185fabd14c32c3e12cf90c0b
Author: Colin Guthrie <colin at mageia.org>
Date:   Mon Jan 9 11:14:15 2012 +0000

    mount: Consider some fuse mounts as network (sshfs)

diff --git a/src/mount.c b/src/mount.c
index f72c50a..15163d3 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -285,8 +285,22 @@ static bool mount_is_network(MountParameters *p) {
         if (mount_test_option(p->options, "_netdev"))
                 return true;

-        if (p->fstype && fstype_is_network(p->fstype))
-                return true;
+        if (p->fstype) {
+                if (p->what && streq(p->fstype, "fuse")) {
+                        char *fstype;
+                        if (asprintf(&fstype, "fuse@%s", p->what) >= 0) {
+                                fstype[strcspn(fstype, "#")] = 0;
+                                if (fstype_is_network(fstype)) {
+                                        free(fstype);
+                                        return true;
+                                }
+                                free(fstype);
+                        }
+
+                }
+                else if (fstype_is_network(p->fstype))
+                        return true;
+        }

         return false;
 }
diff --git a/src/util.c b/src/util.c
index b4c5e2e..ee29eea 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2312,7 +2312,8 @@ bool fstype_is_network(const char *fstype) {
                 "nfs",
                 "nfs4",
                 "gfs",
-                "gfs2"
+                "gfs2",
+                "fuse at sshfs"
         };

         unsigned i;





-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list