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

2012-01-11 Thread Colin Guthrie
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 co...@mageia.org
Date:   Mon Jan 9 11:14:15 2012 +

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@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/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2012-01-11 Thread Karel Zak
On Wed, Jan 11, 2012 at 09:24:51AM +, Colin Guthrie wrote:
 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 co...@mageia.org
 Date:   Mon Jan 9 11:14:15 2012 +
 
 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);
 +}

man fstab:

  mount(8) and umount(8) support filesystem subtypes. The subtype is
  defined by '.subtype' suffix. For example 'fuse.sshfs'. It's
  recommended to use subtype notation rather  than add any prefix to
  the first fstab field (for example 'sshfs#example.com' is deprecated).


Note that this feature has been requested by fuse developers, because
with this notation we can support subtype specific
/sbin/mount.type[.subtype] helpers. The 'sshfs#example.com' is
horrible hack.

Karel

-- 
 Karel Zak  k...@redhat.com
 http://karelzak.blogspot.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2012-01-11 Thread Mike Kazantsev
On Wed, 11 Jan 2012 09:24:51 +
Colin Guthrie gm...@colin.guthr.ie wrote:

 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?
 

Why not just add _netdev to mount options?
Iirc systemd respects that flag.


-- 
Mike Kazantsev // fraggod.net
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2012-01-11 Thread Colin Guthrie
'Twas brillig, and Karel Zak at 11/01/12 12:13 did gyre and gimble:
 man fstab:
 
   mount(8) and umount(8) support filesystem subtypes. The subtype is
   defined by '.subtype' suffix. For example 'fuse.sshfs'. It's
   recommended to use subtype notation rather  than add any prefix to
   the first fstab field (for example 'sshfs#example.com' is deprecated).
 
 
 Note that this feature has been requested by fuse developers, because
 with this notation we can support subtype specific
 /sbin/mount.type[.subtype] helpers. The 'sshfs#example.com' is
 horrible hack.

Cool, so in theory at least, this modified patch would support this
older syntax and still allow the newer syntax to work fine too?

If the deprecated format should not be supported at all, then the first
hunk (i.e. all changes in src/mount.c) can just be dropped (in order to
not break upgrades, I'd quite like to support the deprecated format at
least for this cycle, but I'm more than happy for that to be a
distro-applied patch and/or to do some funky awk/sed work on the fstab
on package upgrade... tho' I'm always a bit wary of messing with a
user's fstab if not 100% needed.).


commit ca4c47b568b126774941f51f495e0e41a6ab8bb9
Author: Colin Guthrie co...@mageia.org
Date:   Mon Jan 9 11:14:15 2012 +

mount: Consider some fuse mounts as network (sshfs)

diff --git a/src/mount.c b/src/mount.c
index f72c50a..ff3af39 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..fab698c 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.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/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel