[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

            Bug ID: 212318
           Summary: sysutils/fusefs-libs: fails to unmount due to a uniq
                    dev node
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: [hidden email]
          Reporter: [hidden email]
                CC: [hidden email], [hidden email],
                    [hidden email]
             Flags: maintainer-feedback?([hidden email])

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

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

Melvyn Sopacua <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #1 from Melvyn Sopacua <[hidden email]> ---
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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #2 from Ben RUBSON <[hidden email]> ---
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...)

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #3 from Melvyn Sopacua <[hidden email]> ---
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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #4 from Ben RUBSON <[hidden email]> ---
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 !

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #5 from Ben RUBSON <[hidden email]> ---
Well uname -r is enough :)

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #6 from [hidden email] ---
(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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #7 from Ben RUBSON <[hidden email]> ---
encfs is calling fuse_unmount_compat22 :
https://github.com/vgough/encfs/blob/v1.9.1/encfs/main.cpp#L48

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #8 from Melvyn Sopacua <[hidden email]> ---
(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

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #9 from [hidden email] ---
(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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #10 from Ben RUBSON <[hidden email]> ---
Yep I think so too.
I also just saw that fuse_unmount_compat22 has gone from libfuse 3.0.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #11 from Ben RUBSON <[hidden email]> ---
(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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #12 from [hidden email] ---
Any news here?

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

--- Comment #13 from Ben RUBSON <[hidden email]> ---
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)

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

[Bug 212318] sysutils/fusefs-libs: fails to unmount due to a uniq dev node

bugzilla-noreply
In reply to this post by bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212318

Conrad Meyer <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Closed
                 CC|                            |[hidden email]
         Resolution|---                         |Overcome By Events

--- Comment #14 from Conrad Meyer <[hidden email]> ---
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.

--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "[hidden email]"