Skip to content

Commit dfe6f14

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: only use a single wait_queue to monitor smbdirect connection status
There's no need for separate conn_wait and disconn_wait queues. This will simplify the move to common code, the server code already a single wait_queue for this. Cc: Steve French <[email protected]> Cc: Tom Talpey <[email protected]> Cc: Long Li <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Stefan Metzmacher <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 550a194 commit dfe6f14

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ static int smbd_conn_upcall(
205205
case RDMA_CM_EVENT_ESTABLISHED:
206206
log_rdma_event(INFO, "connected event=%s\n", event_name);
207207
sc->status = SMBDIRECT_SOCKET_CONNECTED;
208-
wake_up_interruptible(&info->conn_wait);
208+
wake_up_interruptible(&info->status_wait);
209209
break;
210210

211211
case RDMA_CM_EVENT_CONNECT_ERROR:
212212
case RDMA_CM_EVENT_UNREACHABLE:
213213
case RDMA_CM_EVENT_REJECTED:
214214
log_rdma_event(ERR, "connecting failed event=%s\n", event_name);
215215
sc->status = SMBDIRECT_SOCKET_DISCONNECTED;
216-
wake_up_interruptible(&info->conn_wait);
216+
wake_up_interruptible(&info->status_wait);
217217
break;
218218

219219
case RDMA_CM_EVENT_DEVICE_REMOVAL:
@@ -222,12 +222,12 @@ static int smbd_conn_upcall(
222222
if (sc->status == SMBDIRECT_SOCKET_NEGOTIATE_FAILED) {
223223
log_rdma_event(ERR, "event=%s during negotiation\n", event_name);
224224
sc->status = SMBDIRECT_SOCKET_DISCONNECTED;
225-
wake_up(&info->conn_wait);
225+
wake_up(&info->status_wait);
226226
break;
227227
}
228228

229229
sc->status = SMBDIRECT_SOCKET_DISCONNECTED;
230-
wake_up_interruptible(&info->disconn_wait);
230+
wake_up_interruptible(&info->status_wait);
231231
wake_up_interruptible(&sc->recv_io.reassembly.wait_queue);
232232
wake_up_interruptible_all(&info->wait_send_queue);
233233
break;
@@ -1325,7 +1325,7 @@ void smbd_destroy(struct TCP_Server_Info *server)
13251325
rdma_disconnect(sc->rdma.cm_id);
13261326
log_rdma_event(INFO, "wait for transport being disconnected\n");
13271327
wait_event_interruptible(
1328-
info->disconn_wait,
1328+
info->status_wait,
13291329
sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
13301330
}
13311331

@@ -1650,8 +1650,7 @@ static struct smbd_connection *_smbd_get_connection(
16501650
log_rdma_event(INFO, "connecting to IP %pI4 port %d\n",
16511651
&addr_in->sin_addr, port);
16521652

1653-
init_waitqueue_head(&info->conn_wait);
1654-
init_waitqueue_head(&info->disconn_wait);
1653+
init_waitqueue_head(&info->status_wait);
16551654
init_waitqueue_head(&sc->recv_io.reassembly.wait_queue);
16561655
rc = rdma_connect(sc->rdma.cm_id, &conn_param);
16571656
if (rc) {
@@ -1660,7 +1659,7 @@ static struct smbd_connection *_smbd_get_connection(
16601659
}
16611660

16621661
wait_event_interruptible_timeout(
1663-
info->conn_wait,
1662+
info->status_wait,
16641663
sc->status != SMBDIRECT_SOCKET_CONNECTING,
16651664
msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT));
16661665

@@ -1717,7 +1716,7 @@ static struct smbd_connection *_smbd_get_connection(
17171716
destroy_caches_and_workqueue(info);
17181717
sc->status = SMBDIRECT_SOCKET_NEGOTIATE_FAILED;
17191718
rdma_disconnect(sc->rdma.cm_id);
1720-
wait_event(info->conn_wait,
1719+
wait_event(info->status_wait,
17211720
sc->status == SMBDIRECT_SOCKET_DISCONNECTED);
17221721

17231722
allocate_cache_failed:

fs/smb/client/smbdirect.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ struct smbd_connection {
4747

4848
int ri_rc;
4949
struct completion ri_done;
50-
wait_queue_head_t conn_wait;
51-
wait_queue_head_t disconn_wait;
50+
wait_queue_head_t status_wait;
5251

5352
struct completion negotiate_completion;
5453
bool negotiate_done;

0 commit comments

Comments
 (0)