Skip to content

fuse: only refresh size on cached write when opened with O_APPEND - #193

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-wbc
Jul 29, 2026
Merged

fuse: only refresh size on cached write when opened with O_APPEND#193
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-wbc

Conversation

@hazhou-ddn

Copy link
Copy Markdown

In fuse_cache_write_iter, writeback_cache mode was always refreshing STATX_SIZE along with STATX_MODE before a buffered write. The size refresh is only needed for the O_APPEND path, where the kernel must know the current EOF before extending the file. For ordinary writes, fetching size is unnecessary work and can race with concurrent writes and then impact writeback performance.

Keep refreshing STATX_MODE in all cases so SUID clearing still sees an up-to-date mode. Request STATX_SIZE only when the file is opened with O_APPEND.

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

In fuse_cache_write_iter, writeback_cache mode was always refreshing
STATX_SIZE along with STATX_MODE before a buffered write. The size
refresh is only needed for the O_APPEND path, where the kernel must
know the current EOF before extending the file. For ordinary writes,
fetching size is unnecessary work and can race with concurrent writes
and then impact writeback performance.

Keep refreshing STATX_MODE in all cases so SUID clearing still sees an
up-to-date mode. Request STATX_SIZE only when the file is opened with
O_APPEND.

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

@achhenderson achhenderson 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.

Looks good. Thank you!

@hbirth
hbirth merged commit a41215d into DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1 Jul 29, 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.

3 participants