Skip to contentSkip to conversation

netfs, cifs: Fix mtime/ctime update for mmapped writes

PATCH Applied David Howells 4 participants 4 messages Sep 17, 2024

Subsystems (4)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 netfs, cifs: Fix mtime/ctime update for mmapped writes

The cifs flag CIFS_INO_MODIFIED_ATTR, which indicates that the mtime and ctime need to be written back on close, got taken over by netfs as NETFS_ICTX_MODIFIED_ATTR to avoid the need to call a function pointer to set it.

The flag gets set correctly on buffered writes, but doesn't get set by netfs_page_mkwrite(), leading to occasional failures in generic/080 and generic/215.

Fix this by setting the flag in netfs_page_mkwrite().

Fixes 73425800ac94 ("netfs, cifs: Move CIFS_INO_MODIFIED_ATTR to netfs_inode")
cc Jeff Layton <[email protected]>
cc Steve French <[email protected]>
cc Paulo Alcantara <[email protected]>
---
 fs/netfs/buffered_write.c |    1 +
 1 file changed, 1 insertion(+)
fs/netfs/buffered_write.c +1 -0
index d7eae597e54d..b3910dfcb56d 100644
@@ -552,6 +552,7 @@ vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf, struct netfs_group *netfs_gr
 		trace_netfs_folio(folio, netfs_folio_trace_mkwrite);
 	netfs_set_group(folio, netfs_group);
 	file_update_time(file);
+	set_bit(NETFS_ICTX_MODIFIED_ATTR, &ictx->flags);
 	if (ictx->ops->post_modify)
 		ictx->ops->post_modify(inode);
 	ret = VM_FAULT_LOCKED;
maintainer Applied
#1 lore raw
Quoted 10 lines · David Howells

The cifs flag CIFS_INO_MODIFIED_ATTR, which indicates that the mtime and ctime need to be written back on close, got taken over by netfs as NETFS_ICTX_MODIFIED_ATTR to avoid the need to call a function pointer to set it.

The flag gets set correctly on buffered writes, but doesn't get set by netfs_page_mkwrite(), leading to occasional failures in generic/080 and generic/215.

[...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] netfs, cifs: Fix mtime/ctime update for mmapped writes

      https://git.kernel.org/vfs/vfs/c/edd297c2764c
Reviewed-by on v1 1/1
#2 lore raw
In reply to David Howells
Quoted 21 lines · David Howells

The cifs flag CIFS_INO_MODIFIED_ATTR, which indicates that the mtime and ctime need to be written back on close, got taken over by netfs as NETFS_ICTX_MODIFIED_ATTR to avoid the need to call a function pointer to set it.

The flag gets set correctly on buffered writes, but doesn't get set by netfs_page_mkwrite(), leading to occasional failures in generic/080 and generic/215.

Fix this by setting the flag in netfs_page_mkwrite().

Fixes 73425800ac94 ("netfs, cifs: Move CIFS_INO_MODIFIED_ATTR to netfs_inode")
cc Jeff Layton <[email protected]>
cc Steve French <[email protected]>
cc Paulo Alcantara <[email protected]>
Quoted 3 lines
---
 fs/netfs/buffered_write.c |    1 +
 1 file changed, 1 insertion(+)
#3 lore raw

You can also add "Tested-by: Steve French <[email protected]>"

Quoted 30 lines · Paulo Alcantara
Quoted 21 lines · David Howells

The cifs flag CIFS_INO_MODIFIED_ATTR, which indicates that the mtime and ctime need to be written back on close, got taken over by netfs as NETFS_ICTX_MODIFIED_ATTR to avoid the need to call a function pointer to set it.

The flag gets set correctly on buffered writes, but doesn't get set by netfs_page_mkwrite(), leading to occasional failures in generic/080 and generic/215.

Fix this by setting the flag in netfs_page_mkwrite().

Fixes 73425800ac94 ("netfs, cifs: Move CIFS_INO_MODIFIED_ATTR to netfs_inode")
cc Jeff Layton <[email protected]>
cc Steve French <[email protected]>
cc Paulo Alcantara <[email protected]>
Quoted 3 lines
---
 fs/netfs/buffered_write.c |    1 +
 1 file changed, 1 insertion(+)
Signature · 3 lines
Thanks,

Steve