diff mbox series

[v1,09/13] cifs: turn smb2_reconnect_server() into a generic cifs_reconnect_server()

Message ID 20200224131510.20608-10-metze@samba.org (mailing list archive)
State New, archived
Headers show
Series Avoid reconnects of failed session setups on soft mounts | expand

Commit Message

Stefan Metzmacher Feb. 24, 2020, 1:15 p.m. UTC
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 fs/cifs/connect.c   |  2 +-
 fs/cifs/smb2pdu.c   | 12 ++++++------
 fs/cifs/smb2pdu.h   |  2 --
 fs/cifs/smb2proto.h |  2 +-
 4 files changed, 8 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index fc430ba99571..6eca37924d9e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2823,7 +2823,7 @@  cifs_get_tcp_session(struct smb_vol *volume_info)
 	INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
 	INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
 	INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
-	INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server);
+	INIT_DELAYED_WORK(&tcp_ses->reconnect, cifs_reconnect_tcons);
 	mutex_init(&tcp_ses->reconnect_mutex);
 	memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
 	       sizeof(tcp_ses->srcaddr));
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 162fe3381f4c..6f3c5eb62d51 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -159,7 +159,7 @@  static int
 smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
 {
 	struct cifs_tcon_reconnect_params params = {
-		.skip_reconnect = false,
+		.start_timer = true,
 	};
 
 	switch (smb2_command) {
@@ -197,9 +197,6 @@  smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
 		break;
 	}
 
-	if (smb2_command != SMB2_INTERNAL_CMD)
-		params.start_timer = true;
-
 	/*
 	 * Check if handle based operation so we know whether we can continue
 	 * or not without returning to caller to reset file handle.
@@ -3293,7 +3290,7 @@  smb2_echo_callback(struct mid_q_entry *mid)
 	add_credits(server, &credits, CIFS_ECHO_OP);
 }
 
-void smb2_reconnect_server(struct work_struct *work)
+void cifs_reconnect_tcons(struct work_struct *work)
 {
 	struct TCP_Server_Info *server = container_of(work,
 					struct TCP_Server_Info, reconnect.work);
@@ -3340,7 +3337,10 @@  void smb2_reconnect_server(struct work_struct *work)
 	spin_unlock(&cifs_tcp_ses_lock);
 
 	list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
-		rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon);
+		struct cifs_tcon_reconnect_params params = {
+			.start_timer = false,
+		};
+		rc = cifs_tcon_reconnect(tcon, &params);
 		if (!rc)
 			cifs_reopen_persistent_handles(tcon);
 		else
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index fa03df130f1a..330748bd3736 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -81,8 +81,6 @@ 
 #define SMB2_SET_INFO		cpu_to_le16(SMB2_SET_INFO_HE)
 #define SMB2_OPLOCK_BREAK	cpu_to_le16(SMB2_OPLOCK_BREAK_HE)
 
-#define SMB2_INTERNAL_CMD	cpu_to_le16(0xFFFF)
-
 #define NUMBER_OF_SMB2_COMMANDS	0x0013
 
 /* 52 transform hdr + 64 hdr + 88 create rsp */
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index de6388ef344f..c52be13a374a 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -116,7 +116,7 @@  extern int smb2_open_file(const unsigned int xid,
 extern int smb2_unlock_range(struct cifsFileInfo *cfile,
 			     struct file_lock *flock, const unsigned int xid);
 extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile);
-extern void smb2_reconnect_server(struct work_struct *work);
+extern void cifs_reconnect_tcons(struct work_struct *work);
 extern int smb3_crypto_aead_allocate(struct TCP_Server_Info *server);
 extern unsigned long smb_rqst_len(struct TCP_Server_Info *server,
 				  struct smb_rqst *rqst);