linux-stable/fs/cifs
Zhang Xiaoxu acc91c2d8d cifs/smb3: Fix data inconsistent when punch hole
When punch hole success, we also can read old data from file:
  # strace -e trace=pread64,fallocate xfs_io -f -c "pread 20 40" \
           -c "fpunch 20 40" -c"pread 20 40" file
  pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40
  fallocate(3, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 20, 40) = 0
  pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40

CIFS implements the fallocate(FALLOCATE_FL_PUNCH_HOLE) with send SMB
ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the
remote file to zero, but local page caches not updated, then the
local page caches inconsistent with server.

Also can be found by xfstests generic/316.

So, we need to remove the page caches before send the SMB
ioctl(FSCTL_SET_ZERO_DATA) to server.

Fixes: 31742c5a33 ("enable fallocate punch hole ("fallocate -p") for SMB3")
Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Cc: stable@vger.kernel.org # v3.17
Signed-off-by: Steve French <stfrench@microsoft.com>
2020-06-23 19:06:27 -05:00
..
asn1.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cache.c smb3: extend fscache mount volume coherency check 2020-06-06 11:16:25 -05:00
cifs_debug.c cifs: Add get_security_type_str function to return sec type. 2020-06-08 23:57:21 -05:00
cifs_debug.h cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
cifs_dfs_ref.c cifs: fix potential mismatch of UNC paths 2020-02-24 14:20:38 -06:00
cifs_fs_sb.h smb3: add mount option to allow RW caching of share accessed by only 1 client 2019-09-16 11:43:38 -05:00
cifs_ioctl.h cifs: add SMB3 change notification support 2020-02-06 09:14:28 -06:00
cifs_spnego.c cifs: switch servers depending on binding state 2019-11-25 01:16:30 -06:00
cifs_spnego.h
cifs_unicode.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cifs_unicode.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cifs_uniupr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cifsacl.c cifs: fix chown and chgrp when idsfromsid mount option enabled 2020-06-12 13:21:32 -05:00
cifsacl.h smb3: allow uid and gid owners to be set on create with idsfromsid mount option 2020-06-12 13:21:15 -05:00
cifsencrypt.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
cifsfs.c smb3: fix typo in mount options displayed in /proc/mounts 2020-06-10 12:05:15 -05:00
cifsfs.h cifs: update internal module version number 2020-06-04 13:50:55 -05:00
cifsglob.h cifs: Add get_security_type_str function to return sec type. 2020-06-08 23:57:21 -05:00
cifspdu.h cifs: cifspdu.h: Replace zero-length array with flexible-array member 2020-03-22 22:49:10 -05:00
cifsproto.h smb3: allow uid and gid owners to be set on create with idsfromsid mount option 2020-06-12 13:21:15 -05:00
cifsroot.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
cifssmb.c cifs: minor fix to two debug messages 2020-06-01 00:10:18 -05:00
connect.c 22 changesets, 2 for stable. Includes big performance improvement for large i/o when using multichannel, also includes DFS fixes 2020-06-05 16:40:53 -07:00
dfs_cache.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
dfs_cache.h cifs: handle prefix paths in reconnect 2020-03-22 22:49:09 -05:00
dir.c smb311: add support for using info level for posix extensions query 2020-06-12 08:54:12 -05:00
dns_resolve.c keys: Pass the network namespace into request_key mechanism 2019-06-27 23:02:12 +01:00
dns_resolve.h
export.c docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
file.c cifs: Fix double add page to memcg when cifs_readpages 2020-06-23 12:04:52 -05:00
fscache.c smb3: extend fscache mount volume coherency check 2020-06-06 11:16:25 -05:00
fscache.h smb3: extend fscache mount volume coherency check 2020-06-06 11:16:25 -05:00
inode.c smb3: Add debug message for new file creation with idsfromsid mount option 2020-06-12 16:31:06 -05:00
ioctl.c cifs: add SMB3 change notification support 2020-02-06 09:14:28 -06:00
Kconfig smb3: smbdirect support can be configured by default 2020-04-07 13:39:00 -05:00
link.c smb311: add support for using info level for posix extensions query 2020-06-12 08:54:12 -05:00
Makefile cifs: Add support for root file systems 2019-09-16 11:43:38 -05:00
misc.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
netmisc.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
nterr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
nterr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
ntlmssp.h cifs: dynamic allocation of ntlmssp blob 2016-06-23 23:45:07 -05:00
readdir.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
rfc1002pdu.h
sess.c cifs: multichannel: try to rebind when reconnecting a channel 2020-06-04 13:50:55 -05:00
smb1ops.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
smb2file.c cifs: allow unlock flock and OFD lock across fork 2020-03-22 22:49:09 -05:00
smb2glob.h SMB311: Add support for query info using posix extensions (level 100) 2020-06-12 06:20:38 -05:00
smb2inode.c smb311: Add tracepoints for new compound posix query info 2020-06-12 08:55:18 -05:00
smb2maperror.c smb3: improve handling of share deleted (and share recreated) 2019-09-16 11:43:38 -05:00
smb2misc.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
smb2ops.c cifs/smb3: Fix data inconsistent when punch hole 2020-06-23 19:06:27 -05:00
smb2pdu.c smb3: Add debug message for new file creation with idsfromsid mount option 2020-06-12 16:31:06 -05:00
smb2pdu.h SMB311: Add support for query info using posix extensions (level 100) 2020-06-12 06:20:38 -05:00
smb2proto.h smb311: Add support for SMB311 query info (non-compounded) 2020-06-12 06:21:06 -05:00
smb2status.h cifs: don't use __constant_cpu_to_le32() 2019-05-07 23:24:54 -05:00
smb2transport.c smb3: remove overly noisy debug line in signing errors 2020-04-16 12:23:40 -05:00
smbdirect.c cifs: Standardize logging output 2020-06-01 00:10:18 -05:00
smbdirect.h cifs: smbd: Do not schedule work to send immediate packet on every receive 2020-04-07 12:41:16 -05:00
smbencrypt.c fs: cifs: move from the crypto cipher API to the new DES library interface 2019-08-22 14:57:34 +10:00
smberr.h
smbfsctl.h smb3: Add missing reparse tags 2019-09-24 23:31:32 -05:00
trace.c smb3: Cleanup license mess 2019-01-24 09:37:33 -06:00
trace.h smb311: Add tracepoints for new compound posix query info 2020-06-12 08:55:18 -05:00
transport.c 22 changesets, 2 for stable. Includes big performance improvement for large i/o when using multichannel, also includes DFS fixes 2020-06-05 16:40:53 -07:00
winucase.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
xattr.c CIFS: Add support for setting owner info, dos attributes, and create time 2020-01-26 19:24:17 -06:00