mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
cifs: add revalidation on FSCTL failure in smb2_duplicate_extents()
smb2_duplicate_extents() has no handling for
FSCTL_DUPLICATE_EXTENTS_TO_FILE failure: when the FSCTL fails, local
inode metadata may be stale from the pre-extension or from concurrent
remote writes, but is never refreshed.
Force revalidation on FSCTL failure and use i_size_read() for the
pre-extension check.
Fixes: cfc63fc812 ("smb3: fix cached file size problems in duplicate extents (reflink)")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
This commit is contained in:
parent
45c13f3f9e
commit
53676a5e28
|
|
@ -2218,7 +2218,7 @@ smb2_duplicate_extents(const unsigned int xid,
|
|||
trgtfile->fid.volatile_fid, tcon->tid,
|
||||
tcon->ses->Suid, src_off, dest_off, len);
|
||||
inode = d_inode(trgtfile->dentry);
|
||||
if (inode->i_size < dest_off + len) {
|
||||
if (i_size_read(inode) < dest_off + len) {
|
||||
rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false);
|
||||
if (rc)
|
||||
goto duplicate_extents_out;
|
||||
|
|
@ -2235,7 +2235,10 @@ smb2_duplicate_extents(const unsigned int xid,
|
|||
if (ret_data_len > 0)
|
||||
cifs_dbg(FYI, "Non-zero response length in duplicate extents\n");
|
||||
|
||||
if (rc == 0) {
|
||||
if (rc) {
|
||||
CIFS_I(inode)->time = 0; /* force reval */
|
||||
cifs_invalidate_cache(inode, 0);
|
||||
} else {
|
||||
qrc = SMB2_query_info(xid, tcon, trgtfile->fid.persistent_fid,
|
||||
trgtfile->fid.volatile_fid, &file_inf);
|
||||
spin_lock(&inode->i_lock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user