Page MenuHomeFreeBSD

fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK
ClosedPublic

Authored by asomers on Dec 28 2020, 11:37 PM.

Details

Summary

fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK

FUSE_LSEEK reports holes on fuse file systems, and is used for example
by bsdtar.

MFC after: 2 weeks
Relnotes: yes

Test Plan

test cases added. Manual testing performed with tar, ktrace, and libfuse's passthrough file system

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/fs/fuse/fuse_ipc.h
280–281

Should we assert !notimpl?

sys/fs/fuse/fuse_vnops.c
329

style(9): extra blank line

341–344

Shouldn't any non-ENOSYS error path invoke fsess_set_impl(..., LSEEK)?

946

Is it safe to access *offp without copyin/copyout? For ordinary syscall arguments, I think it would not be. But maybe we copy in (and out) the a_data section of ioctl args?

1451–1452

style(9): brace goes on the end of the previous line

sys/kern/vfs_vnops.c
1645 ↗(On Diff #81281)

spurious added line? seems unreachable.

tests/sys/fs/fusefs/mockfs.cc
114

Could drop the constant and use nitems(). Not a big deal.

asomers added inline comments.
sys/fs/fuse/fuse_ipc.h
280–281

Maybe. But I worry that a schizophrenic server might change its mind about whether a particular RPC is supported and trigger a panic. That's not possible ATM, because fsess_set_impl is only called in one place, but it might be possible if we start using fsess_set_impl more widely.

sys/fs/fuse/fuse_vnops.c
341–344

No, because there are errors like ENOTCONN that can be returned even if the daemon never got the message.

946

Yes, it's safe. offp points to kernel space. See the fo_ioctl call about 75% of the way through vn_seek.

sys/kern/vfs_vnops.c
1645 ↗(On Diff #81281)

damn, yes that wasn't supposed to be submitted. You'd think the compiler would complain.

asomers marked 3 inline comments as done.
  • Respond to cem's comments, and fix a vnode locking inconsistency

Thanks!

sys/fs/fuse/fuse_ipc.h
280–281

Makes sense to me, thanks.

sys/fs/fuse/fuse_vnops.c
341–344

If the list of errors is known, we could still set impl in many more cases? Not a big deal I guess.

This revision is now accepted and ready to land.Dec 30 2020, 2:54 PM