Skip to content

Commit e148107

Browse files
Paulo Alcantarasmfrench
authored andcommitted
smb: client: allow reconnect when sending ioctl
cifs_tree_connect() no longer uses ioctl, so allow sessions to be reconnected when sending ioctls. Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b2fe4a8 commit e148107

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

fs/smb/client/cifssmb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,8 +4317,8 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
43174317
* CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus
43184318
* causing an infinite recursion.
43194319
*/
4320-
rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
4321-
(void **)&pSMB, (void **)&pSMBr);
4320+
rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
4321+
(void **)&pSMB, (void **)&pSMBr);
43224322
if (rc)
43234323
return rc;
43244324

fs/smb/client/smb2ops.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,7 +2932,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
29322932
struct fsctl_get_dfs_referral_req *dfs_req = NULL;
29332933
struct get_dfs_referral_rsp *dfs_rsp = NULL;
29342934
u32 dfs_req_size = 0, dfs_rsp_size = 0;
2935-
int retry_count = 0;
2935+
int retry_once = 0;
29362936

29372937
cifs_dbg(FYI, "%s: path: %s\n", __func__, search_name);
29382938

@@ -2981,15 +2981,19 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
29812981
/* Path to resolve in an UTF-16 null-terminated string */
29822982
memcpy(dfs_req->RequestFileName, utf16_path, utf16_path_len);
29832983

2984-
do {
2984+
for (;;) {
29852985
rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
29862986
FSCTL_DFS_GET_REFERRALS,
29872987
(char *)dfs_req, dfs_req_size, CIFSMaxBufSize,
29882988
(char **)&dfs_rsp, &dfs_rsp_size);
2989-
if (!is_retryable_error(rc))
2989+
if (fatal_signal_pending(current)) {
2990+
rc = -EINTR;
2991+
break;
2992+
}
2993+
if (!is_retryable_error(rc) || retry_once++)
29902994
break;
29912995
usleep_range(512, 2048);
2992-
} while (++retry_count < 5);
2996+
}
29932997

29942998
if (!rc && !dfs_rsp)
29952999
rc = -EIO;

fs/smb/client/smb2pdu.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
228228
if (tcon == NULL)
229229
return 0;
230230

231-
/*
232-
* Need to also skip SMB2_IOCTL because it is used for checking nested dfs links in
233-
* cifs_tree_connect().
234-
*/
235-
if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL)
231+
if (smb2_command == SMB2_TREE_CONNECT)
236232
return 0;
237233

238234
spin_lock(&tcon->tc_lock);
@@ -491,6 +487,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
491487
case SMB2_CHANGE_NOTIFY:
492488
case SMB2_QUERY_INFO:
493489
case SMB2_SET_INFO:
490+
case SMB2_IOCTL:
494491
rc = -EAGAIN;
495492
}
496493
failed:

0 commit comments

Comments
 (0)