Skip to content

Commit 1cde0a7

Browse files
metze-sambasmfrench
authored andcommitted
smb: server: don't use delayed_work for post_recv_credits_work
If we are using a hardcoded delay of 0 there's no point in using delayed_work it only adds confusion. The client also uses a normal work_struct and now it is easier to move it to the common smbdirect_socket. Cc: Namjae Jeon <[email protected]> Cc: Steve French <[email protected]> Cc: Tom Talpey <[email protected]> Cc: [email protected] Cc: [email protected] Fixes: 0626e66 ("cifsd: add server handler for central processing and tranport layers") Signed-off-by: Stefan Metzmacher <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 07e27ad commit 1cde0a7

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

fs/smb/server/transport_rdma.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct smb_direct_transport {
148148
wait_queue_head_t wait_send_pending;
149149
atomic_t send_pending;
150150

151-
struct delayed_work post_recv_credits_work;
151+
struct work_struct post_recv_credits_work;
152152
struct work_struct send_immediate_work;
153153
struct work_struct disconnect_work;
154154

@@ -367,8 +367,8 @@ static struct smb_direct_transport *alloc_transport(struct rdma_cm_id *cm_id)
367367

368368
spin_lock_init(&t->lock_new_recv_credits);
369369

370-
INIT_DELAYED_WORK(&t->post_recv_credits_work,
371-
smb_direct_post_recv_credits);
370+
INIT_WORK(&t->post_recv_credits_work,
371+
smb_direct_post_recv_credits);
372372
INIT_WORK(&t->send_immediate_work, smb_direct_send_immediate_work);
373373
INIT_WORK(&t->disconnect_work, smb_direct_disconnect_rdma_work);
374374

@@ -400,7 +400,7 @@ static void free_transport(struct smb_direct_transport *t)
400400
atomic_read(&t->send_pending) == 0);
401401

402402
cancel_work_sync(&t->disconnect_work);
403-
cancel_delayed_work_sync(&t->post_recv_credits_work);
403+
cancel_work_sync(&t->post_recv_credits_work);
404404
cancel_work_sync(&t->send_immediate_work);
405405

406406
if (t->qp) {
@@ -615,8 +615,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
615615
wake_up_interruptible(&t->wait_send_credits);
616616

617617
if (is_receive_credit_post_required(receive_credits, avail_recvmsg_count))
618-
mod_delayed_work(smb_direct_wq,
619-
&t->post_recv_credits_work, 0);
618+
queue_work(smb_direct_wq, &t->post_recv_credits_work);
620619

621620
if (data_length) {
622621
enqueue_reassembly(t, recvmsg, (int)data_length);
@@ -773,8 +772,7 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
773772
st->count_avail_recvmsg += queue_removed;
774773
if (is_receive_credit_post_required(st->recv_credits, st->count_avail_recvmsg)) {
775774
spin_unlock(&st->receive_credit_lock);
776-
mod_delayed_work(smb_direct_wq,
777-
&st->post_recv_credits_work, 0);
775+
queue_work(smb_direct_wq, &st->post_recv_credits_work);
778776
} else {
779777
spin_unlock(&st->receive_credit_lock);
780778
}
@@ -801,7 +799,7 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
801799
static void smb_direct_post_recv_credits(struct work_struct *work)
802800
{
803801
struct smb_direct_transport *t = container_of(work,
804-
struct smb_direct_transport, post_recv_credits_work.work);
802+
struct smb_direct_transport, post_recv_credits_work);
805803
struct smb_direct_recvmsg *recvmsg;
806804
int receive_credits, credits = 0;
807805
int ret;
@@ -1734,7 +1732,7 @@ static int smb_direct_prepare_negotiation(struct smb_direct_transport *t)
17341732
goto out_err;
17351733
}
17361734

1737-
smb_direct_post_recv_credits(&t->post_recv_credits_work.work);
1735+
smb_direct_post_recv_credits(&t->post_recv_credits_work);
17381736
return 0;
17391737
out_err:
17401738
put_recvmsg(t, recvmsg);

0 commit comments

Comments
 (0)