Created attachment 146067 [details] fix |automounted| mount option was added in /head@270096 and is passed by automountd(8) without a way to opt-out. But fusefs chokes on it or any other unknown option. $ cat /etc/auto_master /media auto_media $ cat /etc/auto_media android -intr,fstype=mtpfs,allow_other,mountprog=/usr/local/bin/simple-mtpfs :nil $ ls /media/android/SD\ card load: 0.10 cmd: ls 1643 [autofs] 4.52r 0.00u 0.00s 0% 2832k $ automountd -d automountd: waiting for request from the kernel automountd: not forking due to -d flag; will exit after servicing a single request automountd: got request 2: from map auto_media, path /media/android/, prefix "/media", key "android", options "" automountd: parsing map "auto_media" automountd: map "auto_media" maps to "/etc/auto_media" automountd: done parsing map "auto_media" automountd: found node defined at auto_media:7; it is a mountpoint automountd: executing "mount -t mtpfs -o intr,allow_other,mountprog=/usr/local/bin/simple-mtpfs,automounted nil /media/android/" as pid 1644 fuse: unknown option `automounted' load: 0.06 cmd: simple-mtpfs 1645 [fu_ini] 28.84r 0.00u 0.00s 0% 4164k ^C simple-mtpfs command is from bug 192552 + bug 192851 hack.
Created attachment 146069 [details] poudriere testport log (9.3R i386)
With the patch applied, are automounted FUSE filesystems properly marked with "automounted" in mount(8) output?
One more thing: is there any mechanism to enumerate connected MTP devices? Would be nice to have a special mtpfs map, allowing to automatically mount whatever MTP devices are available. I'm working with Vermaden to do something like that for removable media.
(In reply to Edward Tomasz Napierala from comment #2) > With the patch applied, are automounted FUSE filesystems properly marked > with "automounted" in mount(8) output? No, |automounted| isn't propagated to the mountpoint unlike, say, |union| option. This severely reduces the usefulness of autofs + fuse. I'm currently trying to debug. And a .conf file under /etc/devd/ may still be required to handle device reattach. Not sure how to map devices back to $cdev and mountpoint on detach. (In reply to Edward Tomasz Napierala from comment #3) > One more thing: is there any mechanism to enumerate connected MTP devices? mtp-detect (from libmtp) or provided by implementation. mtp-* commands are very slow here. Here's what I use. $ simple-mtpfs --help |& fgrep device -l --list-devices print available devices --device select a device number to mount $ simple-mtpfs --list-devices 1: PhoneA MTP 2: PhoneB MTP+ADB $ simple-mtpfs --device 2 -o allow_other /mnt $ ls -F /mnt Internal storage/ SD card/ > Would be nice to have a special mtpfs map, allowing to automatically mount > whatever MTP devices are available. Yes, implementing /etc/autofs/special_simple-mtpfs shouldn't be hard. > I'm working with Vermaden to do something like that for removable media. A few network filesystems may benefit from special maps as well e.g., curlftpfs, sshfs, smbnetfs.
True. I already have the SMB map: https://github.com/trasz/autofs/blob/master/etc/autofs/special_smb
Not sure how far have you got with debugging the missing 'automounted' flag, but here's suggestion: the binary flag, MNT_AUTOMOUNTED, does not fit in int, so you have to pass it to nmount(2) as string, not in 'flags' field. This might be what breaks things for FUSE. It certainly breaks mount_fusefs(8).
(In reply to Edward Tomasz Napierala from comment #5) > True. I already have the SMB map: > https://github.com/trasz/autofs/blob/master/etc/autofs/special_smb Please, use |smbutil view //host| to list shares with smbfs in base. Leave smbclient(1) for smbnetfs (fuse) from ports. Also, autofs would choke on space (bug 192968) or may list bogus dirs (see below). $ nmblookup '*' querying * on 1.1.1.1 name_query failed to find name * $ /etc/autofs/special_smb name_query querying $ ls -F /smb name_query/ querying/
Created attachment 152412 [details] A patch to pass "automounted" flag properly so that auto*un*mountd DTRT. In order for auto-*un*mounting fusefs to work, we have to pass "automounted" flag properly, which the current implementation of mount_fusefs silently drops. This patch would not be needed if only nmount(2) accepted flags as 64-bits, sigh...
I confirm the patch in comment 8 addresses comment 2. My patch in comment 0 is still needed as well. Edward, can you review/land? $ mount | fgrep fuse /dev/fuse on /mtp/PhoneA (fusefs, local, synchronous, automounted)
A commit references this bug: Author: jbeich Date: Fri Feb 20 08:26:22 UTC 2015 New revision: 379415 URL: https://svnweb.freebsd.org/changeset/ports/379415 Log: Pass "automounted" mount option to mount_fusefs(8) This only addresses libfuse rejecting unknown option. mount_fusefs(8) still needs to be fixed separately. PR: 192852 Changes: head/sysutils/fusefs-libs/Makefile head/sysutils/fusefs-libs/files/patch-lib_mount_bsd.c
(In reply to Edward Tomasz Napierala from comment #6) libfuse doesn't use binary flags, options are passed to mount_fusefs(8) as arguments. As the bug has stalled for too long I've landed my fix (assuming no objection), the rest is yours.
Can you test an alternative version of the patch? Thanks! Index: mount_fusefs.c =================================================================== --- mount_fusefs.c (revision 279486) +++ mount_fusefs.c (working copy) @@ -73,6 +73,13 @@ { "subtype=", 0, ALTF_SUBTYPE, 1 }, #define ALTF_SYNC_UNMOUNT 0x80 { "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 }, + /* + * MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into + * the 'flags' argument to nmount(2). We have to abuse altflags + * to pass it, as string, via iovec. + */ + #define ALTF_AUTOMOUNTED 0x100 + { "automounted", 0, ALTF_AUTOMOUNTED, 1 }, /* Linux specific options, we silently ignore them */ { "fsname=", 0, 0x00, 1 }, { "fd=", 0, 0x00, 1 },
(Jan, your MTA is bouncing my emails.)
Tested. Comment #12 version also fixes the issue. # unpatched $ mount | fgrep fuse /dev/fuse on /mtp/PhoneA (fusefs, local, synchronous) # 10 mins later $ mount | fgrep fuse /dev/fuse on /mtp/PhoneA (fusefs, local, synchronous) # patched $ mount | fgrep fuse /dev/fuse on /mtp/PhoneA (fusefs, local, synchronous, automounted) # 10 mins later $ mount | fgrep fuse $ (In reply to Edward Tomasz Napierala from comment #13) (Jan, your MTA is bouncing my emails.) Hmm, bugzilla mail passes through...
A commit references this bug: Author: trasz Date: Sun Mar 1 18:26:27 UTC 2015 New revision: 279489 URL: https://svnweb.freebsd.org/changeset/base/279489 Log: Make the "automounted" flag work for FUSE filesystems. PR: 192852 Submitted by: taku at tackymt.homeip.net (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Changes: head/sbin/mount_fusefs/mount_fusefs.c
MFC ping!
A commit references this bug: Author: trasz Date: Fri May 15 11:00:13 UTC 2015 New revision: 282959 URL: https://svnweb.freebsd.org/changeset/base/282959 Log: MFC r279489: Make the "automounted" flag work for FUSE filesystems. PR: 192852 Submitted by: taku at tackymt.homeip.net (earlier version) Sponsored by: The FreeBSD Foundation Changes: _U stable/10/ stable/10/sbin/mount_fusefs/mount_fusefs.c