Hello, I found a bug with fusefs. In function fuse_unmount_compat22, the following command is used to find out the device to unmount : /usr/bin/fstat /dev/fuse* Here is its output with FreeBSD 11.0-RC2 : # fstat /dev/fuse* USER CMD PID FD MOUNT INUM MODE SZ|DV R/W NAME user1 encfs 15513 4 /dev 60 crw-rw---- fuse rw /dev/fuse user2 encfs 15504 4 /dev 60 crw-rw---- fuse rw /dev/fuse user3 encfs 15456 4 /dev 60 crw-rw---- fuse rw /dev/fuse user4 encfs 15431 4 /dev 60 crw-rw---- fuse rw /dev/fuse As you can see all users use the same dev node /dev/fuse. So when unmounting, user3 will get for example the following message : umount: unmount of /home/user2/encfs failed: Operation not permitted I'm not sure where is the issue, if we should expect a uniq dev node per mounted FS, or if the unmount command is to correct. Many thanks for your help ! Ben
Operation not permitted hints at the cause: are you unmounting the device as root or as the same user that mounted the node? I have no issues unmounting multiple fuse devices on 10.3.
Thank you for your feedback Melvyn. Every mount/unmount is done by users themselves, not by root. Look, in my example, when user3 tries to unmount, fuse tries to unmount FS of another user (user2 in my example). I think fuse tries to unmount the last one mounted. I think the bug is due to the fact that all FSs share the same /dev/fuse node. Do you have several fuse dev nodes on 10.3, one per fuse FS mounted ? (/dev/fuse0, /dev/fuse1, dev/fuse2...)
I have several nodes all using /dev/fuse, but I'm using an rc.d script to mount/unmount them, which is run by root. My unmounting part is this: ntfsmount_unmount() { # We can't check this, since mount -p with path argument only checks # nodes in fstab(5). # if /sbin/mount -p ${ntfsmount_mountpoint} >/dev/null 2>&1 # So we need to envoke mount -p without argument and grep for the # mountpoint instead. if check_is_mounted ${ntfsmount_mountpoint} then /sbin/umount ${ntfsmount_mountpoint} fi } check_is_mounted() { local mp is_mounted mp="$1" is_mounted=`/sbin/mount -p|sed -ne "s,^/dev/fuse.*[[:space:]]\(${mp}\)[[:space:]].*$,\\1,p"` if [ ! -z "${is_mounted}" -a x"${is_mounted}" = x"${mp}" ] then return 0 fi return 1 } This does the right thing for me. As for the code you've shown, it seems like a bug to use fstat, as you can never get the path it is mounted *on* from that.
Thank you for your feedback Melvyn ! What do the following command return when you have several fuse mounted ? ls -l /dev/fuse* fstat /dev/fuse* uname -a Thank you again !
Well uname -r is enough :)
(In reply to Ben RUBSON from comment #0) What is calling fuse_unmount_compat22? I think newly compiled code should end up calling fuse_kern_unmount, which should be fixed by files/patch-lib_mount_bsd.c.
encfs is calling fuse_unmount_compat22 : https://github.com/vgough/encfs/blob/v1.9.1/encfs/main.cpp#L48
(In reply to Ben RUBSON from comment #4) ls -l /dev/fuse* crw-rw---- 1 root staff 0x3a Dec 21 16:58 /dev/fuse sudo fstat /dev/fuse USER CMD PID FD MOUNT INUM MODE SZ|DV R/W NAME root ntfs-3g 1272 4 /dev 58 crw-rw---- fuse rw /dev/fuse root ntfs-3g 1255 4 /dev 58 crw-rw---- fuse rw /dev/fuse % mount -p|grep '^/dev/fuse' /dev/fuse /home/melvyn/Music/Windisk fusefs ro,sync 0 0 /dev/fuse /home/melvyn/win7 fusefs ro,sync 0 0 % pkg query '%n-%v' sysutils/fusefs-libs fusefs-libs-2.9.5 % uname -r 10.3-RELEASE-p12
(In reply to Ben RUBSON from comment #7) Yuck, looks like fuse_unmount_compat22 needs to be patched to just call unmount(mountpoint, MNT_FORCE) as well then.
Yep I think so too. I also just saw that fuse_unmount_compat22 has gone from libfuse 3.0.
(In reply to martin from comment #6) (In reply to Ben RUBSON from comment #7) As a workaround for encfs, I submitted a PR to avoid using (deprecated) fuse_unmount_compat22. (https://github.com/vgough/encfs/pull/267) For others, fuse_unmount_compat22 should still need to be patched, of they would need to use an alternate unmount method/function.
Any news here?
Can't your fuse program simply use fuse_unmount(mountpoint, NULL) instead of fuse_unmount_compat22(mountpoint) ? (as we did here : https://github.com/vgough/encfs/pull/293)
Either the compat22 routine was removed, or its use should be avoided, or if that absolutely fails maybe it can be patched not to be broken. Unclear if anything is still tripping over this broken path anymore. Sounds like encfs was fixed not to use it and fusefs-libs may have removed it too.