Skip to content

Commit 5d7e282

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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: Paulo Alcantara (SUSE) <[email protected]> Cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent dca6581 commit 5d7e282

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

fs/cifs/connect.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,6 +3513,9 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path,
35133513
struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
35143514
char *oldmnt = cifs_sb->ctx->mount_options;
35153515

3516+
cifs_dbg(FYI, "%s: full_path=%s ref_path=%s target=%s\n", __func__, full_path, ref_path,
3517+
dfs_cache_get_tgt_name(tit));
3518+
35163519
rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref);
35173520
if (rc)
35183521
goto out;
@@ -3611,13 +3614,18 @@ static int __follow_dfs_link(struct mount_ctx *mnt_ctx)
36113614
if (rc)
36123615
goto out;
36133616

3614-
/* Try all dfs link targets */
3617+
/* Try all dfs link targets. If an I/O fails from currently connected DFS target with an
3618+
* error other than STATUS_PATH_NOT_COVERED (-EREMOTE), then retry it from other targets as
3619+
* specified in MS-DFSC "3.1.5.2 I/O Operation to Target Fails with an Error Other Than
3620+
* STATUS_PATH_NOT_COVERED."
3621+
*/
36153622
for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl);
36163623
tit; tit = dfs_cache_get_next_tgt(&tl, tit)) {
36173624
rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit);
36183625
if (!rc) {
36193626
rc = is_path_remote(mnt_ctx);
3620-
break;
3627+
if (!rc || rc == -EREMOTE)
3628+
break;
36213629
}
36223630
}
36233631

@@ -3691,7 +3699,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
36913699
goto error;
36923700

36933701
rc = is_path_remote(&mnt_ctx);
3694-
if (rc == -EREMOTE)
3702+
if (rc)
36953703
rc = follow_dfs_link(&mnt_ctx);
36963704
if (rc)
36973705
goto error;

0 commit comments

Comments
 (0)