aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNakajima Akira <nakajima.akira@nttcom.co.jp>2015-04-22 02:24:44 -0400
committerSteve French <smfrench@gmail.com>2015-05-20 14:05:25 -0400
commit7196ac113a4f38b7ca1a3282fd9edf328bd22287 (patch)
tree178e1b3431d73f91c704e093955da6632919a8d3 /fs
parent65c3b205ebe06a389a29544e71a8071da0ce4155 (diff)
Fix to check Unique id and FileType when client refer file directly.
When you refer file directly on cifs client, (e.g. ls -li <filename>, cd <dir>, stat <filename>) the function return old inode number and filetype from old inode cache, though server has different inode number or filetype. When server is Windows, cifs client has same problem. When Server is Windows , This patch fixes bug in different filetype, but does not fix bug in different inode number. Because QUERY_PATH_INFO response by Windows does not include inode number(Index Number) . BUG INFO https://bugzilla.kernel.org/show_bug.cgi?id=90021 https://bugzilla.kernel.org/show_bug.cgi?id=90031 Reported-by: Nakajima Akira <nakajima.akira@nttcom.co.jp> Signed-off-by: Nakajima Akira <nakajima.akira@nttcom.co.jp> Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/inode.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index ef71aa1515f6..f621b44cb800 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -401,9 +401,25 @@ int cifs_get_inode_info_unix(struct inode **pinode,
401 rc = -ENOMEM; 401 rc = -ENOMEM;
402 } else { 402 } else {
403 /* we already have inode, update it */ 403 /* we already have inode, update it */
404
405 /* if uniqueid is different, return error */
406 if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM &&
407 CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) {
408 rc = -ESTALE;
409 goto cgiiu_exit;
410 }
411
412 /* if filetype is different, return error */
413 if (unlikely(((*pinode)->i_mode & S_IFMT) !=
414 (fattr.cf_mode & S_IFMT))) {
415 rc = -ESTALE;
416 goto cgiiu_exit;
417 }
418
404 cifs_fattr_to_inode(*pinode, &fattr); 419 cifs_fattr_to_inode(*pinode, &fattr);
405 } 420 }
406 421
422cgiiu_exit:
407 return rc; 423 return rc;
408} 424}
409 425
@@ -838,6 +854,15 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
838 if (!*inode) 854 if (!*inode)
839 rc = -ENOMEM; 855 rc = -ENOMEM;
840 } else { 856 } else {
857 /* we already have inode, update it */
858
859 /* if filetype is different, return error */
860 if (unlikely(((*inode)->i_mode & S_IFMT) !=
861 (fattr.cf_mode & S_IFMT))) {
862 rc = -ESTALE;
863 goto cgii_exit;
864 }
865
841 cifs_fattr_to_inode(*inode, &fattr); 866 cifs_fattr_to_inode(*inode, &fattr);
842 } 867 }
843 868