Skip to content

fuse: disable local attribute cache override under DLM - #196

Merged
hbirth merged 1 commit into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hazhou-ddn:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1
Aug 12, 2026
Merged

fuse: disable local attribute cache override under DLM#196
hbirth merged 1 commit into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hazhou-ddn:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1

Conversation

@hazhou-ddn

Copy link
Copy Markdown

fuse_get_cache_mask() returned STATX_MTIME|CTIME|SIZE whenever writeback_cache was enabled, causing the kernel to trust its locally cached mtime/ctime/size over whatever the server returned in a GETATTR reply. This is unsafe under DLM: another node can hold a PW lock on the inode and modify its size/mtime independently, and the local writeback_cache values have no way of reflecting that.

Under the DLM protocol, however, this override is unnecessary in the first place: a GETATTR always acquires a PR sattr lock, which forces every node holding a conflicting PW lock -- including the local node, for its own buffered writes -- to flush dirty pages before the server renders the reply. So under DLM the server's answer is always at least as fresh as anything cached locally, for all three attributes, not just size.

Make fuse_get_cache_mask() return 0 whenever fc->dlm is set, when writeback_cache is enabled, so the kernel always trusts the server's attr/size reply in that case. The STATX_MTIME|CTIME|SIZE local-cache override remains only as a fallback for servers without DLM support, where no such flush-before-grant guarantee exists.

Signed-off-by Hai Zhong Zhou hazhou@ddn.com

fuse_get_cache_mask() returned STATX_MTIME|CTIME|SIZE whenever
writeback_cache was enabled, causing the kernel to trust its locally
cached mtime/ctime/size over whatever the server returned in a
GETATTR reply. This is unsafe under DLM: another node can hold a PW
lock on the inode and modify its size/mtime independently, and the
local writeback_cache values have no way of reflecting that.

Under the DLM protocol, however, this override is unnecessary in the
first place: a GETATTR always acquires a PR sattr lock, which forces
every node holding a conflicting PW lock -- including the local node,
for its own buffered writes -- to flush dirty pages before the server
renders the reply. So under DLM the server's answer is always at
least as fresh as anything cached locally, for all three attributes,
not just size.

Make fuse_get_cache_mask() return 0 whenever fc->dlm is set,
when writeback_cache is enabled, so the kernel always trusts the
server's attr/size reply in that case. The STATX_MTIME|CTIME|SIZE
local-cache override remains only as a fallback for servers without
DLM support, where no such flush-before-grant guarantee exists.

Signed-off-by Hai Zhong Zhou <hazhou@ddn.com>
@hbirth
hbirth merged commit dc73360 into DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 Aug 12, 2026
2 checks passed
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.

2 participants