mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-17 22:41:25 +00:00
revalidate directories instiantiated via FIND_* in order to handle DFS referrals
We've had a long-standing problem with DFS referral points. CIFS servers generally try to make them look like directories in FIND_FIRST/NEXT responses. When you go to try to do a FIND_FIRST on them though, the server will then (correctly) return STATUS_PATH_NOT_COVERED. Mostly this manifests as spurious EREMOTE errors back to userland. This patch attempts to fix this by marking directories that are discovered via FIND_FIRST/NEXT for revaldiation. When the lookup code runs across them again, we'll reissue a QPathInfo against them and that will make it chase the referral properly. There is some performance penalty involved here and no I haven't measured it -- it'll be highly dependent upon the workload and contents of the mounted share. To try and mitigate that though, the code only marks the inode for revalidation when it's possible to run across a DFS referral. i.e.: when the kernel has DFS support built in and the share is "in DFS" [At the Microsoft plugfest we noted that usually the DFS links had the REPARSE attribute tag enabled - DFS junctions are reparse points after all - so I just added a check for that flag too so the performance impact should be smaller - Steve] Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Sachin Prabhu <sprabhu@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
4a72dafa19
commit
2a2c41c07c
@ -126,6 +126,22 @@ 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)
|
||||
{
|
||||
@ -135,6 +151,19 @@ 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 {
|
||||
fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode;
|
||||
fattr->cf_dtype = DT_REG;
|
||||
|
Loading…
Reference in New Issue
Block a user