mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
smb: client: use status_wait and SMBDIRECT_SOCKET_NEGOTIATE_RUNNING for completion
We can use the state change from SMBDIRECT_SOCKET_NEGOTIATE_RUNNING to SMBDIRECT_SOCKET_CONNECTED or SMBDIRECT_SOCKET_NEGOTIATE_FAILED in order to notify the caller if the negotiation is over. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
afff34dc02
commit
00e4c7a87d
|
|
@ -582,6 +582,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
u32 data_offset = 0;
|
||||
u32 data_length = 0;
|
||||
u32 remaining_data_length = 0;
|
||||
bool negotiate_done = false;
|
||||
|
||||
log_rdma_recv(INFO, "response=0x%p type=%d wc status=%d wc opcode %d byte_len=%d pkey_index=%u\n",
|
||||
response, sc->recv_io.expected, wc->status, wc->opcode,
|
||||
|
|
@ -604,16 +605,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
case SMBDIRECT_EXPECT_NEGOTIATE_REP:
|
||||
dump_smbdirect_negotiate_resp(smbdirect_recv_io_payload(response));
|
||||
sc->recv_io.reassembly.full_packet_received = true;
|
||||
info->negotiate_done =
|
||||
negotiate_done =
|
||||
process_negotiation_response(response, wc->byte_len);
|
||||
put_receive_buffer(info, response);
|
||||
WARN_ON_ONCE(sc->status != SMBDIRECT_SOCKET_NEGOTIATE_RUNNING);
|
||||
if (!info->negotiate_done)
|
||||
if (!negotiate_done)
|
||||
sc->status = SMBDIRECT_SOCKET_NEGOTIATE_FAILED;
|
||||
else
|
||||
sc->status = SMBDIRECT_SOCKET_CONNECTED;
|
||||
|
||||
complete(&info->negotiate_completion);
|
||||
wake_up_interruptible(&info->status_wait);
|
||||
return;
|
||||
|
||||
/* SMBD data transfer packet */
|
||||
|
|
@ -1253,17 +1254,17 @@ static int smbd_negotiate(struct smbd_connection *info)
|
|||
return rc;
|
||||
}
|
||||
|
||||
init_completion(&info->negotiate_completion);
|
||||
info->negotiate_done = false;
|
||||
rc = smbd_post_send_negotiate_req(info);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = wait_for_completion_interruptible_timeout(
|
||||
&info->negotiate_completion, SMBD_NEGOTIATE_TIMEOUT * HZ);
|
||||
log_rdma_event(INFO, "wait_for_completion_timeout rc=%d\n", rc);
|
||||
rc = wait_event_interruptible_timeout(
|
||||
info->status_wait,
|
||||
sc->status != SMBDIRECT_SOCKET_NEGOTIATE_RUNNING,
|
||||
secs_to_jiffies(SMBD_NEGOTIATE_TIMEOUT));
|
||||
log_rdma_event(INFO, "wait_event_interruptible_timeout rc=%d\n", rc);
|
||||
|
||||
if (info->negotiate_done)
|
||||
if (sc->status == SMBDIRECT_SOCKET_CONNECTED)
|
||||
return 0;
|
||||
|
||||
if (rc == 0)
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ struct smbd_connection {
|
|||
struct completion ri_done;
|
||||
wait_queue_head_t status_wait;
|
||||
|
||||
struct completion negotiate_completion;
|
||||
bool negotiate_done;
|
||||
|
||||
struct work_struct disconnect_work;
|
||||
struct work_struct post_send_credits_work;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user