Code Monkey home page Code Monkey logo

Comments (15)

hanwen avatar hanwen commented on June 9, 2024

thanks for your report. This is an interesting trace. It shows that it's calling fusermount despite specifying DirectMount. This is because there is a fallback; did you try using StrictDirectMount ?

Subprocessing with FUSE is a known source of deadlocks, see https://pkg.go.dev/github.com/hanwen/go-fuse/v2/fs#hdr-Deadlocks. Obviously, the umount operation should work, but if you force direct mounting, I think the problem will go away.

I'll try to have a detailed look later this week.

from go-fuse.

bduffany avatar bduffany commented on June 9, 2024

Switching to DirectMountStrict: true indeed fixes things. Thanks!

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

Some debugging:

  • problem is related to the subprocess for the mount; the unmount seems OK
  • problem goes away if we disable the poll hack

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

found a trace here:

syscall.Syscall6(0x100c000143818?, 0x7f7bbc608718?, 0xc0000cc4e0?, 0xc000034000?, 0x47e970?, 0xc0000b5bb0?, 0xc0000b5c28?)
	/usr/lib/golang/src/syscall/syscall_linux.go:91 +0x30 fp=0xc0000b5b70 sp=0xc0000b5ae8 pc=0x47e970
syscall.Syscall6(0x10f, 0xc0000b5ce0, 0x1, 0xc0000b5c90, 0x0, 0x0, 0x0)
	<autogenerated>:1 +0x3d fp=0xc0000b5bb8 sp=0xc0000b5b70 pc=0x47eefd
golang.org/x/sys/unix.ppoll(0xc0000225c0?, 0x38?, 0x38?, 0xc0000225c0?)
	/home/hanwen/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_linux.go:124 +0x57 fp=0xc0000b5c38 sp=0xc0000b5bb8 pc=0x5391f7
golang.org/x/sys/unix.Ppoll({0xc0000b5ce0?, 0x0?, 0xc0000225c0?}, 0x0?, 0xffffffffffffff9c?)
	/home/hanwen/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:148 +0x38 fp=0xc0000b5c68 sp=0xc0000b5c38 pc=0x539078
golang.org/x/sys/unix.Poll({0xc0000b5ce0?, 0xc0000225c0?, 0xc000067438?}, 0x10?)
	/home/hanwen/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:157 +0x8d fp=0xc0000b5cb0 sp=0xc0000b5c68 pc=0x53914d
github.com/hanwen/go-fuse/v2/fuse.pollHack({0xc0000203c0?, 0xc00012aac0?})
	/home/hanwen/vc/go-fuse/fuse/poll_linux.go:22 +0xaf fp=0xc0000b5d18 sp=0xc0000b5cb0 pc=0x543ecf
github.com/hanwen/go-fuse/v2/fuse.(*Server).WaitMount(0xc000161ba0)
//sys   ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)

func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
        if len(fds) == 0 {
                return ppoll(nil, 0, timeout, sigmask)
        }
        return ppoll(&fds[0], len(fds), timeout, sigmask)
}

if ppoll has special support for nonblocking i/o again, we are hosed again.

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

This is probably the scenario that involves dup3 documented at https://pkg.go.dev/github.com/hanwen/go-fuse/v2/fs#hdr-Deadlocks

When writing that section, I didn´t realize that fusermount itself uses inherited file descriptors.

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

further detail of why the pollhack is involved: consider 2 threads (t1, t2). If t1 initiates the pollhack, it might get fd 3 for the poll hack. Then, if t2 calls fusermount, the mechanism above causes a FLUSH on the pollhack fd.

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

see https://review.gerrithub.io/c/hanwen/go-fuse/+/1186976

from go-fuse.

rfjakob avatar rfjakob commented on June 9, 2024

Posting on Gerrithub failed for some obscure reason [1] so posting here:

I tested https://review.gerrithub.io/c/hanwen/go-fuse/+/1186976 . TestParallelMount passes with the init() change and hangs without it. LGTM.

[1]:

An error occurred
Error submitting review Error: selector 'gr-label-scores' did not match anything'

from go-fuse.

rfjakob avatar rfjakob commented on June 9, 2024

PS: gocryptfs already has something similar for different reasons. It's so things don't completely explode when fds 0,1,2 are not open.

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

thanks, I wonder what is up with gerrithub. I couldnt add you to the review yesterday.

the "collapse" button on the reply dialog is also broken.
review gerrithub io_c_hanwen_go-fuse_+_1186976

@lucamilanesio

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

fixed in 36b3591

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

i've tagged v2.5.1 for this.

from go-fuse.

rfjakob avatar rfjakob commented on June 9, 2024

The open question is: why doesn't DirectMount work? I looked at the code and I don't see how this can do the wrong thing.

from go-fuse.

hanwen avatar hanwen commented on June 9, 2024

not an open question. I think the tests were run as a normal user, so DirectMount fails with permission error. Then we fallback to fusermount.

from go-fuse.

rfjakob avatar rfjakob commented on June 9, 2024

from go-fuse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.