Bug 238197 - [FUSEFS] fusefs supports neither chflags(2) not stat.st_birthtim
Summary: [FUSEFS] fusefs supports neither chflags(2) not stat.st_birthtim
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Alan Somers
URL: https://reviews.freebsd.org/D20453
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-28 20:21 UTC by Alan Somers
Modified: 2022-10-14 15:48 UTC (History)
4 users (show)

See Also:


Attachments
Add st_birthtime support to FUSEFS backwards-incompatibly (10.88 KB, patch)
2019-05-28 20:21 UTC, Alan Somers
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2019-05-28 20:21:39 UTC
Created attachment 204675 [details]
Add st_birthtime support to FUSEFS backwards-incompatibly

The FUSE protocol does not support chflags(2) at all, and the FUSE_GETATTR and FUSE_SETATTR messages have no fields for st_birthtime.  This is a direct result of its Linux-only origins.  OSXFuse extended the protocol to add those features (and others), but they had to fork libfuse to do it.  FreeBSD has thus far had a policy of no changes to libfuse.  Even if we were to abandon that policy, we can't add chflags and st_birthtime support without bumping the FUSE kernel API version past the most recently published version in libfuse.  The reason is because libfuse includes its own copy of the kernel API header.  Changing the FUSE protocol without reving the kernel API past what is already published by libfuse would thus break existing binaries.

Attached is a patch that adds st_birthtime support to fusefs(5).  However, it adds it at protocol version 7.9, so it breaks compatibility with existing binaries.  The patch also includes some OSX definitions.  I thought that including them would make it easier to update libfuse.
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2019-05-28 20:48:44 UTC
Can you post the patch on phabricator?
Comment 2 Alan Somers freebsd_committer freebsd_triage 2019-05-28 23:33:31 UTC
Review added.
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2019-05-28 23:34:47 UTC
Thanks!
Comment 4 jSML4ThWwBID69YC 2022-10-13 19:55:45 UTC
Is this why the chflags command does not work? 

EX: chflags schg directory

Expected behavior is the directory is immutable. Actual behavior is that nothing has changed, and the directory can be deleted as if the immutable flag is not set. 

Tested on FuseFS with MooseFS on FreeBSD 13.1-p2.
Comment 5 Alan Somers freebsd_committer freebsd_triage 2022-10-13 20:27:01 UTC
(In reply to jSML4ThWwBID69YC from comment #4)
Yes, exactly.
Comment 6 jSML4ThWwBID69YC 2022-10-13 20:35:52 UTC
(In reply to Alan Somers from comment #5)

Thank you for confirming. 

Here's a vote to implement this feature, assuming it's possible. It's really quite useful.
Comment 7 Alan Somers freebsd_committer freebsd_triage 2022-10-13 20:46:16 UTC
(In reply to jSML4ThWwBID69YC from comment #6)
It's possible.  In fact it isn't even difficult, technically.  The hard part is that the protocol change needs to be coordinated with the Linux and libfuse communities.  It's a people problem, not a coding problem.
Comment 8 jSML4ThWwBID69YC 2022-10-13 21:04:58 UTC
(In reply to Alan Somers from comment #7)

Is this something that needs to be brought up at https://github.com/libfuse/libfuse

A quick look and I don't see anything in relation to the chflags command. I'm not sure there is an equivalent in Linux.
Comment 9 Alan Somers freebsd_committer freebsd_triage 2022-10-13 22:13:22 UTC
(In reply to jSML4ThWwBID69YC from comment #8)
Actually, libfuse follows the Linux kernel.  So this is something that needs to be brought up with Linux.  Basically, we need to add an

struct fuse_attr {
....
#ifdef FreeBSD
uint32_t file_flags
uint64_t birthtime;
uint32_t birthtimensec;
#endif
}

along with the backwards-compatibility stuff.  None of those fields will be used for Linux.  Basically, we'll be asking Linux to be our documentation, so as to avoid the need to fork libfuse.
Comment 10 jSML4ThWwBID69YC 2022-10-14 15:44:29 UTC
Has this been brought up the Linux developers? 

Unfortunately, all I can do is provide testing, when and if this feature becomes available.
Comment 11 Alan Somers freebsd_committer freebsd_triage 2022-10-14 15:48:18 UTC
(In reply to jSML4ThWwBID69YC from comment #10)
Nope.  Nobody has volunteered to do the required cat herding.