summaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a81a9df997c1..13fb59aadebc 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -333,7 +333,7 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
333 fattr->cf_mtime = timespec64_trunc(fattr->cf_mtime, sb->s_time_gran); 333 fattr->cf_mtime = timespec64_trunc(fattr->cf_mtime, sb->s_time_gran);
334 fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime; 334 fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime;
335 fattr->cf_nlink = 2; 335 fattr->cf_nlink = 2;
336 fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL; 336 fattr->cf_flags = CIFS_FATTR_DFS_REFERRAL;
337} 337}
338 338
339static int 339static int
@@ -730,7 +730,6 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
730 FILE_ALL_INFO *data, struct super_block *sb, int xid, 730 FILE_ALL_INFO *data, struct super_block *sb, int xid,
731 const struct cifs_fid *fid) 731 const struct cifs_fid *fid)
732{ 732{
733 bool validinum = false;
734 __u16 srchflgs; 733 __u16 srchflgs;
735 int rc = 0, tmprc = ENOSYS; 734 int rc = 0, tmprc = ENOSYS;
736 struct cifs_tcon *tcon; 735 struct cifs_tcon *tcon;
@@ -821,7 +820,6 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
821 (FILE_DIRECTORY_INFO *)data, cifs_sb); 820 (FILE_DIRECTORY_INFO *)data, cifs_sb);
822 fattr.cf_uniqueid = le64_to_cpu( 821 fattr.cf_uniqueid = le64_to_cpu(
823 ((SEARCH_ID_FULL_DIR_INFO *)data)->UniqueId); 822 ((SEARCH_ID_FULL_DIR_INFO *)data)->UniqueId);
824 validinum = true;
825 823
826 cifs_buf_release(srchinf->ntwrk_buf_start); 824 cifs_buf_release(srchinf->ntwrk_buf_start);
827 } 825 }
@@ -840,31 +838,29 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
840 */ 838 */
841 if (*inode == NULL) { 839 if (*inode == NULL) {
842 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { 840 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
843 if (validinum == false) { 841 if (server->ops->get_srv_inum)
844 if (server->ops->get_srv_inum) 842 tmprc = server->ops->get_srv_inum(xid,
845 tmprc = server->ops->get_srv_inum(xid, 843 tcon, cifs_sb, full_path,
846 tcon, cifs_sb, full_path, 844 &fattr.cf_uniqueid, data);
847 &fattr.cf_uniqueid, data); 845 if (tmprc) {
848 if (tmprc) { 846 cifs_dbg(FYI, "GetSrvInodeNum rc %d\n",
849 cifs_dbg(FYI, "GetSrvInodeNum rc %d\n", 847 tmprc);
850 tmprc); 848 fattr.cf_uniqueid = iunique(sb, ROOT_I);
851 fattr.cf_uniqueid = iunique(sb, ROOT_I); 849 cifs_autodisable_serverino(cifs_sb);
852 cifs_autodisable_serverino(cifs_sb); 850 } else if ((fattr.cf_uniqueid == 0) &&
853 } else if ((fattr.cf_uniqueid == 0) && 851 strlen(full_path) == 0) {
854 strlen(full_path) == 0) { 852 /* some servers ret bad root ino ie 0 */
855 /* some servers ret bad root ino ie 0 */ 853 cifs_dbg(FYI, "Invalid (0) inodenum\n");
856 cifs_dbg(FYI, "Invalid (0) inodenum\n"); 854 fattr.cf_flags |=
857 fattr.cf_flags |= 855 CIFS_FATTR_FAKE_ROOT_INO;
858 CIFS_FATTR_FAKE_ROOT_INO; 856 fattr.cf_uniqueid =
859 fattr.cf_uniqueid = 857 simple_hashstr(tcon->treeName);
860 simple_hashstr(tcon->treeName);
861 }
862 } 858 }
863 } else 859 } else
864 fattr.cf_uniqueid = iunique(sb, ROOT_I); 860 fattr.cf_uniqueid = iunique(sb, ROOT_I);
865 } else { 861 } else {
866 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) && 862 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
867 validinum == false && server->ops->get_srv_inum) { 863 && server->ops->get_srv_inum) {
868 /* 864 /*
869 * Pass a NULL tcon to ensure we don't make a round 865 * Pass a NULL tcon to ensure we don't make a round
870 * trip to the server. This only works for SMB2+. 866 * trip to the server. This only works for SMB2+.