Commit e1481075 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French
Browse files

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: default avatarPaulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent b2fe4a8f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4317,7 +4317,7 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
	 * CIFSGetDFSRefer() may be called from cifs_reconnect_tcon() and thus
	 * causing an infinite recursion.
	 */
	rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
	rc = smb_init(SMB_COM_TRANSACTION2, 15, ses->tcon_ipc,
		      (void **)&pSMB, (void **)&pSMBr);
	if (rc)
		return rc;
+8 −4
Original line number Diff line number Diff line
@@ -2932,7 +2932,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
	struct fsctl_get_dfs_referral_req *dfs_req = NULL;
	struct get_dfs_referral_rsp *dfs_rsp = NULL;
	u32 dfs_req_size = 0, dfs_rsp_size = 0;
	int retry_count = 0;
	int retry_once = 0;

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

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

	do {
	for (;;) {
		rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
				FSCTL_DFS_GET_REFERRALS,
				(char *)dfs_req, dfs_req_size, CIFSMaxBufSize,
				(char **)&dfs_rsp, &dfs_rsp_size);
		if (!is_retryable_error(rc))
		if (fatal_signal_pending(current)) {
			rc = -EINTR;
			break;
		}
		if (!is_retryable_error(rc) || retry_once++)
			break;
		usleep_range(512, 2048);
	} while (++retry_count < 5);
	}

	if (!rc && !dfs_rsp)
		rc = -EIO;
+2 −5
Original line number Diff line number Diff line
@@ -228,11 +228,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
	if (tcon == NULL)
		return 0;

	/*
	 * Need to also skip SMB2_IOCTL because it is used for checking nested dfs links in
	 * cifs_tree_connect().
	 */
	if (smb2_command == SMB2_TREE_CONNECT || smb2_command == SMB2_IOCTL)
	if (smb2_command == SMB2_TREE_CONNECT)
		return 0;

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