summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Shilovsky <piastryyy@gmail.com>2019-09-30 13:06:19 -0400
committerSteve French <stfrench@microsoft.com>2019-10-09 01:10:50 -0400
commitc82e5ac7fe3570a269c0929bf7899f62048e7dbc (patch)
tree082eed52a943822ccc76ac8ab719a7dfa17da54e
parentd4cfbf04b2aafcb657eb8ea0835e5cf51d371448 (diff)
CIFS: Force revalidate inode when dentry is stale
Currently the client indicates that a dentry is stale when inode numbers or type types between a local inode and a remote file don't match. If this is the case attributes is not being copied from remote to local, so, it is already known that the local copy has stale metadata. That's why the inode needs to be marked for revalidation in order to tell the VFS to lookup the dentry again before openning a file. This prevents unexpected stale errors to be returned to the user space when openning a file. Cc: <stable@vger.kernel.org> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/cifs/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 3bae2e53f0b8..5dcc95b38310 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -414,6 +414,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
414 /* if uniqueid is different, return error */ 414 /* if uniqueid is different, return error */
415 if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && 415 if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM &&
416 CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) { 416 CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) {
417 CIFS_I(*pinode)->time = 0; /* force reval */
417 rc = -ESTALE; 418 rc = -ESTALE;
418 goto cgiiu_exit; 419 goto cgiiu_exit;
419 } 420 }
@@ -421,6 +422,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
421 /* if filetype is different, return error */ 422 /* if filetype is different, return error */
422 if (unlikely(((*pinode)->i_mode & S_IFMT) != 423 if (unlikely(((*pinode)->i_mode & S_IFMT) !=
423 (fattr.cf_mode & S_IFMT))) { 424 (fattr.cf_mode & S_IFMT))) {
425 CIFS_I(*pinode)->time = 0; /* force reval */
424 rc = -ESTALE; 426 rc = -ESTALE;
425 goto cgiiu_exit; 427 goto cgiiu_exit;
426 } 428 }
@@ -933,6 +935,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
933 /* if uniqueid is different, return error */ 935 /* if uniqueid is different, return error */
934 if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && 936 if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM &&
935 CIFS_I(*inode)->uniqueid != fattr.cf_uniqueid)) { 937 CIFS_I(*inode)->uniqueid != fattr.cf_uniqueid)) {
938 CIFS_I(*inode)->time = 0; /* force reval */
936 rc = -ESTALE; 939 rc = -ESTALE;
937 goto cgii_exit; 940 goto cgii_exit;
938 } 941 }
@@ -940,6 +943,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
940 /* if filetype is different, return error */ 943 /* if filetype is different, return error */
941 if (unlikely(((*inode)->i_mode & S_IFMT) != 944 if (unlikely(((*inode)->i_mode & S_IFMT) !=
942 (fattr.cf_mode & S_IFMT))) { 945 (fattr.cf_mode & S_IFMT))) {
946 CIFS_I(*inode)->time = 0; /* force reval */
943 rc = -ESTALE; 947 rc = -ESTALE;
944 goto cgii_exit; 948 goto cgii_exit;
945 } 949 }