Skip to content

fuse: add FUSE_STATX_LIGHT and FUSE_RELEASE_READ - #272

Merged
hbirth merged 2 commits into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hbirth:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1
Nov 11, 2026
Merged

hbirth merged 2 commits into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hbirth:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1

Conversation

@hbirth

@hbirth hbirth commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Under DLM the server owns the size, blocks, mtime and ctime of a file another node writes through its writeback cache. To answer a statx exactly, it has to revoke or downgrade that node's write grant, forcing a flush and a later re-acquire. A plain ls -l, find or monitoring agent on one node can so keep breaking the grant of a writer on another.

Add FUSE_STATX_LIGHT to fuse_statx_in.sx_flags, telling the server that the caller does not need cluster-coherent size, blocks and timestamps and that it may answer from its current values without recalling locks. It is only sent for a user stat() of a regular file without AT_STATX_FORCE_SYNC. Internal attribute updates (SEEK_END, O_APPEND, EOF checks, permission checks, setattr) keep sending full requests.

A light reply may lag behind writes, so it does not update the inode: a stale size must not shrink i_size or the page cache, and i_time, inval_mask and FUSE_I_DLM_LOCKED stay as they were. It only fills the kstat, taking the larger size and the later mtime/ctime of the reply and the inode, so this node still sees its own unflushed writes.

@hazhou-ddn

Copy link
Copy Markdown

Thanks, Horst, please hold on the merge, and let me create a page to make the whole story clear (from fuse kernel to redfsd client and server), then we can move forward.

@hbirth

hbirth commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

@hazhou-ddn don't worry! I'm not merging this. I am just testing this, so that we know that we have the code and you can see what I meant.

@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch 2 times, most recently from 4e7d8d3 to 685f8eb Compare October 27, 2026 17:56
@hbirth hbirth changed the title fuse: add FUSE_STATX_LIGHT for stat without recalling DLM grants fuse: add FUSE_STATX_LIGHT and FUSE_RELEASE_READ Oct 27, 2026
@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch 3 times, most recently from 6a34146 to a617517 Compare October 28, 2026 09:18
Comment thread fs/fuse/file.c Resolved
Comment thread fs/fuse/fuse_dlm_cache.c Resolved
@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch 2 times, most recently from d87c216 to c201772 Compare November 2, 2026 09:40
@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch 2 times, most recently from 45a597f to cac9742 Compare November 6, 2026 15:28
@hbirth

hbirth commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

@hazhou-ddn @yongzech tell me when you need this merged

@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch from cac9742 to 4817aad Compare November 10, 2026 10:42
@achhenderson
achhenderson self-requested a review November 10, 2026 17:48
Under DLM the server owns the size, blocks, mtime and ctime of a file
another node writes through its writeback cache.  To answer a statx
exactly, it has to revoke or downgrade that node's write grant, forcing
a flush and a later re-acquire.  A plain ls -l, find or monitoring agent
on one node can so keep breaking the grant of a writer on another.

Add FUSE_STATX_LIGHT to fuse_statx_in.sx_flags, telling the server that
the caller does not need cluster-coherent size, blocks and timestamps
and that it may answer from its current values without recalling locks.
It is only sent with the writeback cache on, for a user stat() of a
regular file without AT_STATX_FORCE_SYNC.  Internal attribute updates
(SEEK_END, O_APPEND, EOF checks, permission checks, setattr) keep sending
full requests.

A light reply with a zero attr_valid may lag behind writes, so it does
not update the inode: a stale size must not shrink i_size or the page
cache, and i_time, inval_mask and FUSE_I_DLM_LOCKED stay as they were.
It only fills the kstat, taking the larger size and the later mtime/ctime
of the reply and the inode, so this node still sees its own unflushed
writes.  A non-zero attr_valid says the values are coherent: the reply
updates the inode and is cached like a full one.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
A read served from the page cache never reaches the server, so the
server cannot update atime for it.

Record on the inode a cached read(2), splice, sendfile or read fault,
unless the file has O_NOATIME.  A FUSE_READ, a DLM read lock request,
a write, truncate, fallocate or an explicit atime set clears the
record.  The first release after it reports it with
FUSE_RELEASE_CACHED_READ and clears it, so the server stamps atime at
release.

Signed-off-by: Yan, Zheng <zyan@ddn.com>
Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
@hbirth
hbirth force-pushed the redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 branch from 4817aad to a844d31 Compare November 10, 2026 20:30
@hbirth
hbirth merged commit f7195c4 into DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants