Commit 5d7e2825 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

cifs: do not skip link targets when an I/O fails

When I/O fails in one of the currently connected DFS targets, retry it
from other targets as specified in MS-DFSC "3.1.5.2 I/O Operation to
+Target Fails with an Error Other Than STATUS_PATH_NOT_COVERED."
Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent dca65818
...@@ -3513,6 +3513,9 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path, ...@@ -3513,6 +3513,9 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path,
struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb; struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
char *oldmnt = cifs_sb->ctx->mount_options; char *oldmnt = cifs_sb->ctx->mount_options;
cifs_dbg(FYI, "%s: full_path=%s ref_path=%s target=%s\n", __func__, full_path, ref_path,
dfs_cache_get_tgt_name(tit));
rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref); rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref);
if (rc) if (rc)
goto out; goto out;
...@@ -3611,13 +3614,18 @@ static int __follow_dfs_link(struct mount_ctx *mnt_ctx) ...@@ -3611,13 +3614,18 @@ static int __follow_dfs_link(struct mount_ctx *mnt_ctx)
if (rc) if (rc)
goto out; goto out;
/* Try all dfs link targets */ /* Try all dfs link targets. If an I/O fails from currently connected DFS target with an
* error other than STATUS_PATH_NOT_COVERED (-EREMOTE), then retry it from other targets as
* specified in MS-DFSC "3.1.5.2 I/O Operation to Target Fails with an Error Other Than
* STATUS_PATH_NOT_COVERED."
*/
for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl); for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl);
tit; tit = dfs_cache_get_next_tgt(&tl, tit)) { tit; tit = dfs_cache_get_next_tgt(&tl, tit)) {
rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit); rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit);
if (!rc) { if (!rc) {
rc = is_path_remote(mnt_ctx); rc = is_path_remote(mnt_ctx);
break; if (!rc || rc == -EREMOTE)
break;
} }
} }
...@@ -3691,7 +3699,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) ...@@ -3691,7 +3699,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
goto error; goto error;
rc = is_path_remote(&mnt_ctx); rc = is_path_remote(&mnt_ctx);
if (rc == -EREMOTE) if (rc)
rc = follow_dfs_link(&mnt_ctx); rc = follow_dfs_link(&mnt_ctx);
if (rc) if (rc)
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment