Skip to content

Commit 77c2e45

Browse files
pcacjrSteve French
authored and
Steve French
committed
smb: client: don't trust DFSREF_STORAGE_SERVER bit
Some servers don't respect the DFSREF_STORAGE_SERVER bit, so unconditionally tree connect to DFS link target and then decide whether or not continue chasing DFS referrals for DFS interlinks. Otherwise the client would fail to mount such shares. Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 2014c95 commit 77c2e45

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

fs/smb/client/dfs.c

+16-14
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,27 @@ static int __dfs_referral_walk(struct dfs_ref_walk *rw)
150150
if (rc)
151151
continue;
152152

153-
if (tgt.flags & DFSREF_STORAGE_SERVER) {
154-
rc = cifs_mount_get_tcon(mnt_ctx);
155-
if (!rc)
156-
rc = cifs_is_path_remote(mnt_ctx);
153+
rc = cifs_mount_get_tcon(mnt_ctx);
154+
if (rc) {
155+
if (tgt.server_type == DFS_TYPE_LINK &&
156+
DFS_INTERLINK(tgt.flags))
157+
rc = -EREMOTE;
158+
} else {
159+
rc = cifs_is_path_remote(mnt_ctx);
157160
if (!rc) {
158161
ref_walk_set_tgt_hint(rw);
159162
break;
160163
}
161-
if (rc != -EREMOTE)
162-
continue;
163164
}
164-
165-
rc = ref_walk_advance(rw);
166-
if (!rc) {
167-
rc = setup_dfs_ref(&tgt, rw);
168-
if (rc)
169-
break;
170-
ref_walk_mark_end(rw);
171-
goto again;
165+
if (rc == -EREMOTE) {
166+
rc = ref_walk_advance(rw);
167+
if (!rc) {
168+
rc = setup_dfs_ref(&tgt, rw);
169+
if (rc)
170+
break;
171+
ref_walk_mark_end(rw);
172+
goto again;
173+
}
172174
}
173175
}
174176
} while (rc && ref_walk_descend(rw));

0 commit comments

Comments
 (0)