Skip to content

Linux 6.12:fuse: do not zero-fill another node's bytes past a stale E… - #248

Merged
hbirth merged 1 commit into
DDNStorage:redfs-rhel10_0from
yongzech:ior-hard-write-6.12
Oct 10, 2026
Merged

hbirth merged 1 commit into
DDNStorage:redfs-rhel10_0from
yongzech:ior-hard-write-6.12

Conversation

@yongzech

Copy link
Copy Markdown
Collaborator
Linux 6.12:fuse: do not zero-fill another node's bytes past a stale EOF under DLM

With the writeback cache and DLM, ior-hard (47008-byte transfers into
one shared file from several clients) reads back zeros in pages that
ranks on two client nodes share.  Under DLM the local i_size is only
this node's view: a write refreshes STATX_MODE, not the size, and the
grant does not carry it.  Once another node has extended the file, two
paths trust the stale size and zero that node's bytes, and writeback
sends the zeros over them once this node's i_size covers the folio.

fuse_write_begin() skips the read-modify-write READ for a partial
folio that starts at or past the local i_size and zero-fills it
instead.  Under DLM, read it.  The write grant is page-aligned and was
granted only after the previous holder's revoke flushed the page, so
the read is coherent, and a true hole still reads back as zeros.  It
adds no new kind of wait under the LOCKED range: the same READ is
already issued for every partial folio inside the known size.  The
cost is at most two READs per write beyond the local i_size.

fuse_zero_eof_gap() zeroes the cached old-EOF folio from the local
i_size to its end before an extending write, assuming the server's
side of that gap is a hole.  Under DLM a folio read from the server
can hold another node's bytes there, and the read above makes that
common.  The bytes this function exists to clear can only come from a
shared writable mapping, so add FUSE_I_SHARED_WRITE_MMAP, set in
fuse_file_mmap() for such a mapping and never cleared, and skip the
zeroing under DLM with the writeback cache unless it is set.  A file
both mapped shared-writable and written from several nodes keeps the
old behavioour.

…OF under DLM

With the writeback cache and DLM, ior-hard (47008-byte transfers into
one shared file from several clients) reads back zeros in pages that
ranks on two client nodes share.  Under DLM the local i_size is only
this node's view: a write refreshes STATX_MODE, not the size, and the
grant does not carry it.  Once another node has extended the file, two
paths trust the stale size and zero that node's bytes, and writeback
sends the zeros over them once this node's i_size covers the folio.

fuse_write_begin() skips the read-modify-write READ for a partial
folio that starts at or past the local i_size and zero-fills it
instead.  Under DLM, read it.  The write grant is page-aligned and was
granted only after the previous holder's revoke flushed the page, so
the read is coherent, and a true hole still reads back as zeros.  It
adds no new kind of wait under the LOCKED range: the same READ is
already issued for every partial folio inside the known size.  The
cost is at most two READs per write beyond the local i_size.

fuse_zero_eof_gap() zeroes the cached old-EOF folio from the local
i_size to its end before an extending write, assuming the server's
side of that gap is a hole.  Under DLM a folio read from the server
can hold another node's bytes there, and the read above makes that
common.  The bytes this function exists to clear can only come from a
shared writable mapping, so add FUSE_I_SHARED_WRITE_MMAP, set in
fuse_file_mmap() for such a mapping and never cleared, and skip the
zeroing under DLM with the writeback cache unless it is set.  A file
both mapped shared-writable and written from several nodes keeps the
old behavioour.

Signed-off-by: <Yong Ze Chen> <yochen@ddn.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cding-ddn cding-ddn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@hazhou-ddn hazhou-ddn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hbirth
hbirth merged commit 5a8c721 into DDNStorage:redfs-rhel10_0 Oct 10, 2026
1 of 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.

4 participants