Skip to content

Commit 8ef130f

Browse files
longlimsftsmfrench
authored andcommitted
CIFS: SMBD: Implement function to destroy a SMB Direct connection
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 <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]>
1 parent 781a805 commit 8ef130f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

fs/cifs/smbdirect.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,22 @@ static void idle_connection_timer(struct work_struct *work)
13871387
info->keep_alive_interval*HZ);
13881388
}
13891389

1390+
/* Destroy this SMBD connection, called from upper layer */
1391+
void smbd_destroy(struct smbd_connection *info)
1392+
{
1393+
log_rdma_event(INFO, "destroying rdma session\n");
1394+
1395+
/* Kick off the disconnection process */
1396+
smbd_disconnect_rdma_connection(info);
1397+
1398+
log_rdma_event(INFO, "wait for transport being destroyed\n");
1399+
wait_event(info->wait_destroy,
1400+
info->transport_status == SMBD_DESTROYED);
1401+
1402+
destroy_workqueue(info->workqueue);
1403+
kfree(info);
1404+
}
1405+
13901406
/*
13911407
* Reconnect this SMBD connection, called from upper layer
13921408
* return value: 0 on success, or actual error code

fs/cifs/smbdirect.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,16 @@ struct smbd_connection *smbd_get_connection(
249249

250250
/* Reconnect SMBDirect session */
251251
int smbd_reconnect(struct TCP_Server_Info *server);
252+
/* Destroy SMBDirect session */
253+
void smbd_destroy(struct smbd_connection *info);
252254

253255
#else
254256
#define cifs_rdma_enabled(server) 0
255257
struct smbd_connection {};
256258
static inline void *smbd_get_connection(
257259
struct TCP_Server_Info *server, struct sockaddr *dstaddr) {return NULL;}
258260
static inline int smbd_reconnect(struct TCP_Server_Info *server) {return -1; }
261+
static inline void smbd_destroy(struct smbd_connection *info) {}
259262
#endif
260263

261264
#endif

0 commit comments

Comments
 (0)