From f6c0d50212b0f73e4c59feabaf2e16949e33da94 Mon Sep 17 00:00:00 2001 From: Marios Makassikis Date: Fri, 6 Dec 2024 12:20:33 +0100 Subject: [PATCH] ksmbd: count all requests in req_running counter This changes the semantics of req_running to count all in-flight requests on a given connection, rather than the number of elements in the conn->request list. The latter is used only in smb2_cancel, and the counter is not used Signed-off-by: Marios Makassikis Signed-off-by: Namjae Jeon --- connection.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connection.c b/connection.c index 7a1e97713..88b6a085c 100644 --- a/connection.c +++ b/connection.c @@ -138,8 +138,8 @@ void ksmbd_conn_enqueue_request(struct ksmbd_work *work) requests_queue = &conn->requests; #endif + atomic_inc(&conn->req_running); if (requests_queue) { - atomic_inc(&conn->req_running); spin_lock(&conn->request_lock); list_add_tail(&work->request_entry, requests_queue); spin_unlock(&conn->request_lock); @@ -150,11 +150,12 @@ void ksmbd_conn_try_dequeue_request(struct ksmbd_work *work) { struct ksmbd_conn *conn = work->conn; + atomic_dec(&conn->req_running); + if (list_empty(&work->request_entry) && list_empty(&work->async_request_entry)) return; - atomic_dec(&conn->req_running); spin_lock(&conn->request_lock); list_del_init(&work->request_entry); spin_unlock(&conn->request_lock);