]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb3: fix cached file size problems in duplicate extents (reflink)
authorSteve French <stfrench@microsoft.com>
Fri, 26 Mar 2021 23:41:55 +0000 (18:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:30:29 +0000 (14:30 +0200)
commitd6e8a2fa5ee3bfdbc274d2b424c12383e4feefba
tree107cca5f517811d3930677dbfc874786452791b4
parent9e2cb7ab9add7d08e4f562cb73b967c10233f2ee
smb3: fix cached file size problems in duplicate extents (reflink)

commit cfc63fc8126a93cbf95379bc4cad79a7b15b6ece upstream.

There were two problems (one of which could cause data corruption)
that were noticed with duplicate extents (ie reflink)
when debugging why various xfstests were being incorrectly skipped
(e.g. generic/138, generic/140, generic/142). First, we were not
updating the file size locally in the cache when extending a
file due to reflink (it would refresh after actimeo expires)
but xfstest was checking the size immediately which was still
0 so caused the test to be skipped.  Second, we were setting
the target file size (which could shrink the file) in all cases
to the end of the reflinked range rather than only setting the
target file size when reflink would extend the file.

CC: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2ops.c