fuse
fuse copied to clipboard
FreeBSD Statfs etc operations seem to get wrong results for a brief period after mount
Putting a time.Sleep(100 * time.Millisecond) after the mount subprocess returns seems to make many more tests pass, but I refuse to resort to racy time-based criteria. How do we know when the mount is actually ready?
This may be a FreeBSD limitation. Needs a platform expert.
Attached is a log from TestStatfs run, note Blocks:0x0, Files:0x0 and no Statfs request for the first case calling syscall.Statfs, and Blocks:0x2a, Files:0xd a moment later with syscall.Fstatfs.
--- FAIL: TestStatfs (0.11s)
serve_test.go:164: Statfs got: syscall.Statfs_t{Version:0x20030518, Type:0xed, Flags:0x900a, Bsize:0x1000, Iosize:0x1000, Blocks:0x0, Bfree:0x0, Bavail:0, Files:0x0, Ffree:0, Syncwrites:0x0, Asyncwrites:0x0, Syncreads:0x0, Asyncre
ads:0x0, Spare:[10]uint64{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, Namemax:0x0, Owner:0x3e9, Fsid:syscall.Fsid{Val:[2]int32{0, 0}}, Charspare:[80]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Fstypename:[16]int8{102, 117, 115, 101, 102, 115, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0}, Mntfromname:[88]int8{47, 100, 101, 118, 47, 102, 117, 115, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Mntonname:[88]int8{47, 116, 109, 112, 47, 102, 117, 115, 101, 116, 101, 115, 116, 55, 52, 56, 55, 54, 55, 51, 49, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
serve_test.go:166: got Blocks = 0; want 42
serve_test.go:169: got Files = 0; want 13
mounted.go:109: FUSE: <- Init [ID=0x1 Node=0x0 Uid=1001 Gid=1001 Pid=3564] 7.8 ra=65536 fl=0
mounted.go:109: FUSE: -> ID=0x1 Init {MaxReadahead:0 Flags:InitBigWrites MaxWrite:131072}
mounted.go:109: FUSE: <- Open [ID=0x2 Node=0x1 Uid=1001 Gid=1001 Pid=3560] dir=true fl=OpenReadOnly
mounted.go:109: FUSE: -> ID=0x2 Open {Handle:1 Flags:0}
mounted.go:109: FUSE: <- Statfs [ID=0x3 Node=0x1 Uid=1001 Gid=1001 Pid=3560]
mounted.go:109: FUSE: -> ID=0x3 Statfs {Blocks:42 Bfree:0 Bavail:0 Files:13 Ffree:0 Bsize:0 Namelen:0 Frsize:0}
serve_test.go:184: Fstatfs got: syscall.Statfs_t{Version:0x20030518, Type:0xed, Flags:0x900a, Bsize:0x0, Iosize:0x1000, Blocks:0x2a, Bfree:0x0, Bavail:0, Files:0xd, Ffree:0, Syncwrites:0x0, Asyncwrites:0x0, Syncreads:0x0, Asyncrea
ds:0x0, Spare:[10]uint64{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, Namemax:0x0, Owner:0x3e9, Fsid:syscall.Fsid{Val:[2]int32{0, 0}}, Charspare:[80]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Fstypename:[16]int8{102, 117, 115, 101, 102, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0}, Mntfromname:[88]int8{47, 100, 101, 118, 47, 102, 117, 115, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Mntonname:[88]int8{47, 116, 109, 112, 47, 102, 117, 115, 101, 116, 101, 115, 116, 55, 52, 56, 55, 54, 55, 51, 49, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
mounted.go:109: FUSE: <- Release [ID=0x4 Node=0x1 Uid=1001 Gid=1001 Pid=3560] 0x1 fl=OpenReadOnly rfl=0 owner=0x0
mounted.go:109: FUSE: -> ID=0x4
mounted.go:109: FUSE: <- Forget [ID=0x5 Node=0x1 Uid=1001 Gid=1001 Pid=3560] 1
mounted.go:109: FUSE: -> ID=0x5
mounted.go:109: FUSE: <- Destroy [ID=0x6 Node=0x0 Uid=1001 Gid=1001 Pid=3560]
mounted.go:109: FUSE: -> ID=0x6
Also seen with any other similar operation giving zeroed results, e.g. TestStatRoot:
--- FAIL: TestStatRoot (0.03s)
serve_test.go:224: root has weird access mode: ----------
serve_test.go:229: root has wrong inode: 0
serve_test.go:232: root has wrong link count: 0
mounted.go:109: FUSE: <- Init [ID=0x1 Node=0x0 Uid=1001 Gid=1001 Pid=3565] 7.8 ra=65536 fl=0
mounted.go:109: FUSE: -> ID=0x1 Init {MaxReadahead:0 Flags:InitBigWrites MaxWrite:131072}
mounted.go:109: FUSE: <- Forget [ID=0x2 Node=0x1 Uid=1001 Gid=1001 Pid=3560] 1
mounted.go:109: FUSE: -> ID=0x2
mounted.go:109: FUSE: <- Destroy [ID=0x3 Node=0x0 Uid=1001 Gid=1001 Pid=3560]
mounted.go:109: FUSE: -> ID=0x3