smb3: fix temporary data corruption in collapse range
authorSteve French <stfrench@microsoft.com>
Tue, 23 Aug 2022 13:07:41 +0000 (14:07 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 29 Aug 2022 03:34:07 +0000 (22:34 -0500)
commitfa30a81f255a56cccd89552cd6ce7ea6e8d8acc4
tree7cfd66e49ee222d5ca364c2ae0fd507194e744fa
parentc3a72bb213209adfe981a4a92ea5746a778323e4
smb3: fix temporary data corruption in collapse range

collapse range doesn't discard the affected cached region
so can risk temporarily corrupting the file data. This
fixes xfstest generic/031

I also decided to merge a minor cleanup to this into the same patch
(avoiding rereading inode size repeatedly unnecessarily) to make it
clearer.

Cc: stable@vger.kernel.org
Fixes: 5476b5dd82c8b ("cifs: add support for FALLOC_FL_COLLAPSE_RANGE")
Reported-by: David Howells <dhowells@redhat.com>
Tested-by: David Howells <dhowells@redhat.com>
Reviewed-by: David Howells <dhowells@redhat.com>
cc: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c