Commit fee50bf0 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher

Make pollHack work on read-only mounts

Use LOOKUP & OPEN instead of CREATE so it also
works on read-only mounts.

go-fuse/fs$ go test -run TestRoMount -v
=== RUN   TestRoMount
20:31:07.892736 rx 2: INIT i0 {7.31 Ra 0x20000 NO_OPEN_SUPPORT,ASYNC_READ,POSIX_LOCKS,EXPORT_SUPPORT,AUTO_INVAL_DATA,SPLICE_MOVE,SPLICE_READ,HANDLE_KILLPRIV,ABORT_ERROR,EXPLICIT_INVAL_DATA,BIG_WRITES,SPLICE_WRITE,READDIRPLUS,WRITEBACK_CACHE,IOCTL_DIR,READDIRPLUS_AUTO,ASYNC_DIO,PARALLEL_DIROPS,ATOMIC_O_TRUNC,DONT_MASK,FLOCK_LOCKS,POSIX_ACL,MAX_PAGES,CACHE_SYMLINKS,NO_OPENDIR_SUPPORT}
20:31:07.892799 tx 2:     OK, {7.28 Ra 0x20000 BIG_WRITES,READDIRPLUS,PARALLEL_DIROPS,ASYNC_READ,AUTO_INVAL_DATA,NO_OPEN_SUPPORT 0/0 Wr 0x10000 Tg 0x0}
20:31:07.892967 rx 4: LOOKUP i1 [".go-fuse-epoll-hack"] 20b
20:31:07.893002 tx 4:     OK, {i18446744073709551615 g0 tE=0s tA=0s {M0100644 SZ=0 L=1 0:0 B0*0 i0:18446744073709551615 A 0.000000 M 0.000000 C 0.000000}}
20:31:07.893030 rx 6: OPEN i18446744073709551615 {O_RDONLY,0x8000}
20:31:07.893037 tx 6:     OK, {Fh 18446744073709551615 }
20:31:07.893053 rx 8: POLL i18446744073709551615
20:31:07.893059 tx 8:     38=function not implemented
20:31:07.893074 rx 10: FLUSH i18446744073709551615 {Fh 18446744073709551615}
20:31:07.893079 tx 10:     34=numerical result out of range
20:31:07.893131 rx 12: RELEASE i18446744073709551615 {Fh 18446744073709551615 0x8000  L0}
20:31:07.893153 tx 12:     34=numerical result out of range
20:31:07.896705 received ENODEV (unmount request), thread exiting
20:31:07.896719 received ENODEV (unmount request), thread exiting
20:31:07.896888 received ENODEV (unmount request), thread exiting

Change-Id: I6de861bdccf03184a4ca3deeefb1cfdc930aabe3
--- PASS: TestRoMount (0.01s)
PASS
ok  	github.com/hanwen/go-fuse/v2/fs	0.015s

Change-Id: Ic66ca153f5b739e5e081988fdc48d51cde5470f0
parent 2beb8ed3
......@@ -12,3 +12,5 @@ example/loopback/loopback
example/multizip/multizip
example/bulkstat/bulkstat
example/zipfs/zipfs
# test binaries
*.test
......@@ -15,24 +15,19 @@ func doPollHackLookup(ms *Server, req *request) {
Nlink: 1,
}
switch req.inHeader.Opcode {
case _OP_CREATE:
out := (*CreateOut)(req.outData())
out.EntryOut = EntryOut{
case _OP_LOOKUP:
out := (*EntryOut)(req.outData())
*out = EntryOut{
NodeId: pollHackInode,
Attr: attr,
}
out.OpenOut = OpenOut{
req.status = OK
case _OP_OPEN:
out := (*OpenOut)(req.outData())
*out = OpenOut{
Fh: pollHackInode,
}
req.status = OK
case _OP_LOOKUP:
out := (*EntryOut)(req.outData())
*out = EntryOut{}
req.status = ENOENT
case _OP_GETATTR:
out := (*AttrOut)(req.outData())
out.Attr = attr
req.status = OK
case _OP_POLL:
req.status = ENOSYS
default:
......
......@@ -8,7 +8,7 @@ import (
)
func pollHack(mountPoint string) error {
fd, err := syscall.Creat(filepath.Join(mountPoint, pollHackName), syscall.O_CREAT)
fd, err := syscall.Open(filepath.Join(mountPoint, pollHackName), syscall.O_RDONLY, 0)
if err != nil {
return err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment