diff options
Diffstat (limited to 'fs/cifs/readdir.c')
| -rw-r--r-- | fs/cifs/readdir.c | 45 | 
1 files changed, 12 insertions, 33 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 42ef03be089..b15862e0f68 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -134,22 +134,6 @@ out:  	dput(dentry);  } -/* - * Is it possible that this directory might turn out to be a DFS referral - * once we go to try and use it? - */ -static bool -cifs_dfs_is_possible(struct cifs_sb_info *cifs_sb) -{ -#ifdef CONFIG_CIFS_DFS_UPCALL -	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); - -	if (tcon->Flags & SMB_SHARE_IS_IN_DFS) -		return true; -#endif -	return false; -} -  static void  cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)  { @@ -159,27 +143,22 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)  	if (fattr->cf_cifsattrs & ATTR_DIRECTORY) {  		fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode;  		fattr->cf_dtype = DT_DIR; -		/* -		 * Windows CIFS servers generally make DFS referrals look -		 * like directories in FIND_* responses with the reparse -		 * attribute flag also set (since DFS junctions are -		 * reparse points). We must revalidate at least these -		 * directory inodes before trying to use them (if -		 * they are DFS we will get PATH_NOT_COVERED back -		 * when queried directly and can then try to connect -		 * to the DFS target) -		 */ -		if (cifs_dfs_is_possible(cifs_sb) && -		    (fattr->cf_cifsattrs & ATTR_REPARSE)) -			fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; -	} else if (fattr->cf_cifsattrs & ATTR_REPARSE) { -		fattr->cf_mode = S_IFLNK; -		fattr->cf_dtype = DT_LNK;  	} else {  		fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode;  		fattr->cf_dtype = DT_REG;  	} +	/* +	 * We need to revalidate it further to make a decision about whether it +	 * is a symbolic link, DFS referral or a reparse point with a direct +	 * access like junctions, deduplicated files, NFS symlinks. +	 */ +	if (fattr->cf_cifsattrs & ATTR_REPARSE) +		fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; + +	/* non-unix readdir doesn't provide nlink */ +	fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK; +  	if (fattr->cf_cifsattrs & ATTR_READONLY)  		fattr->cf_mode &= ~S_IWUGO; @@ -770,7 +749,7 @@ static int cifs_filldir(char *find_entry, struct file *file,  	}  	if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) && -	    CIFSCouldBeMFSymlink(&fattr)) +	    couldbe_mf_symlink(&fattr))  		/*  		 * trying to get the type and mode can be slow,  		 * so just call those regular files for now, and mark  | 
