Files
twx-linux/fs
David Howells c8f7c80bb8 cifs: Fix missing set of remote_i_size
[ Upstream commit 93a4315512 ]

Occasionally, the generic/001 xfstest will fail indicating corruption in
one of the copy chains when run on cifs against a server that supports
FSCTL_DUPLICATE_EXTENTS_TO_FILE (eg. Samba with a share on btrfs).  The
problem is that the remote_i_size value isn't updated by cifs_setsize()
when called by smb2_duplicate_extents(), but i_size *is*.

This may cause cifs_remap_file_range() to then skip the bit after calling
->duplicate_extents() that sets sizes.

Fix this by calling netfs_resize_file() in smb2_duplicate_extents() before
calling cifs_setsize() to set i_size.

This means we don't then need to call netfs_resize_file() upon return from
->duplicate_extents(), but we also fix the test to compare against the pre-dup
inode size.

[Note that this goes back before the addition of remote_i_size with the
netfs_inode struct.  It should probably have been setting cifsi->server_eof
previously.]

Fixes: cfc63fc812 ("smb3: fix cached file size problems in duplicate extents (reflink)")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.com>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:39:44 +02:00
..
2024-04-22 15:34:27 +00:00
2024-03-27 13:17:15 +01:00
2024-05-30 09:44:24 +02:00
2024-03-27 13:17:15 +01:00
2024-05-30 09:44:04 +02:00
2024-03-27 13:17:15 +01:00
2024-03-27 13:17:15 +01:00
2024-03-06 10:52:12 +01:00
2024-05-30 09:44:56 +02:00
2024-03-13 12:53:53 -07:00
2024-05-30 09:44:06 +02:00
2024-03-13 12:53:53 -07:00
2024-03-13 12:53:53 -07:00
2024-03-27 13:17:15 +01:00