]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
CIFS: SMBD: Implement function to destroy a SMB Direct connection
authorLong Li <longli@microsoft.com>
Thu, 23 Nov 2017 00:38:37 +0000 (17:38 -0700)
committerSteve French <smfrench@gmail.com>
Thu, 25 Jan 2018 01:49:06 +0000 (19:49 -0600)
Add function to tear down a SMB Direct connection. This is used by upper layer
to free all SMB Direct connection and transport resources.

Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
fs/cifs/smbdirect.c
fs/cifs/smbdirect.h

index a96058a3ad872cccbc07c14e5bb2947bab8696f7..b462a2f3863bd174287735ff02916ca754513c41 100644 (file)
@@ -1387,6 +1387,22 @@ static void idle_connection_timer(struct work_struct *work)
                        info->keep_alive_interval*HZ);
 }
 
+/* Destroy this SMBD connection, called from upper layer */
+void smbd_destroy(struct smbd_connection *info)
+{
+       log_rdma_event(INFO, "destroying rdma session\n");
+
+       /* Kick off the disconnection process */
+       smbd_disconnect_rdma_connection(info);
+
+       log_rdma_event(INFO, "wait for transport being destroyed\n");
+       wait_event(info->wait_destroy,
+               info->transport_status == SMBD_DESTROYED);
+
+       destroy_workqueue(info->workqueue);
+       kfree(info);
+}
+
 /*
  * Reconnect this SMBD connection, called from upper layer
  * return value: 0 on success, or actual error code
index f1db2ee7c8c29c482f0bdeca02f9889e17624820..f0ce934650c19c4305550d8e6d25eb53360faf02 100644 (file)
@@ -249,6 +249,8 @@ struct smbd_connection *smbd_get_connection(
 
 /* Reconnect SMBDirect session */
 int smbd_reconnect(struct TCP_Server_Info *server);
+/* Destroy SMBDirect session */
+void smbd_destroy(struct smbd_connection *info);
 
 #else
 #define cifs_rdma_enabled(server)      0
@@ -256,6 +258,7 @@ struct smbd_connection {};
 static inline void *smbd_get_connection(
        struct TCP_Server_Info *server, struct sockaddr *dstaddr) {return NULL;}
 static inline int smbd_reconnect(struct TCP_Server_Info *server) {return -1; }
+static inline void smbd_destroy(struct smbd_connection *info) {}
 #endif
 
 #endif