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

Karel Zak kzak at redhat.com
Wed Jan 11 04:13:03 PST 2012


On Wed, Jan 11, 2012 at 09:24:51AM +0000, 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 <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);
> +                        }

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  <kzak at redhat.com>
 http://karelzak.blogspot.com


More information about the systemd-devel mailing list