]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cifs: Fix setting of zero_point after DIO write
authorDavid Howells <dhowells@redhat.com>
Fri, 19 Jul 2024 13:07:07 +0000 (14:07 +0100)
committerSteve French <stfrench@microsoft.com>
Fri, 19 Jul 2024 16:08:57 +0000 (11:08 -0500)
commit61ea6b3a3104fcd66364282391dd2152bc4c129a
treeb0c4cffb397f7e34df16f11fb0e1743b210ffb33
parentd2c5eb57b6da10f335c30356f9696bd667601e6a
cifs: Fix setting of zero_point after DIO write

At the moment, at the end of a DIO write, cifs calls netfs_resize_file() to
adjust the size of the file if it needs it.  This will reduce the
zero_point (the point above which we assume a read will just return zeros)
if it's more than the new i_size, but won't increase it.

With DIO writes, however, we definitely want to increase it as we have
clobbered the local pagecache and then written some data that's not
available locally.

Fix cifs to make the zero_point above the end of a DIO or unbuffered write.

This fixes corruption seen occasionally with the generic/708 xfs-test.  In
that case, the read-back of some of the written data is being
short-circuited and replaced with zeroes.

Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Cc: stable@vger.kernel.org
Reported-by: Steve French <sfrench@samba.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/file.c