summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarios Makassikis <mmakassikis@freebox.fr>2024-12-14 12:16:45 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-27 14:02:03 +0100
commit7e2bb4108a05c9c249fcca9b38d3fca9d8df3812 (patch)
tree0646de6f5e9c887bb6f3c7c94e1c0ad30ed30ff4
parent280d1b743a3b827a4d8a90d93820238a5381e6b7 (diff)
downloadlinux-7e2bb4108a05c9c249fcca9b38d3fca9d8df3812.tar.gz
linux-7e2bb4108a05c9c249fcca9b38d3fca9d8df3812.tar.bz2
linux-7e2bb4108a05c9c249fcca9b38d3fca9d8df3812.zip
ksmbd: count all requests in req_running counter
[ Upstream commit 83c47d9e0ce79b5d7c0b21b9f35402dbde0fa15c ] 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 <mmakassikis@freebox.fr> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Stable-dep-of: 43fb7bce8866 ("ksmbd: fix broken transfers when exceeding max simultaneous operations") Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/smb/server/connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c
index e6a72f75ab94..3980645085ed 100644
--- a/fs/smb/server/connection.c
+++ b/fs/smb/server/connection.c
@@ -120,8 +120,8 @@ void ksmbd_conn_enqueue_request(struct ksmbd_work *work)
if (conn->ops->get_cmd_val(work) != SMB2_CANCEL_HE)
requests_queue = &conn->requests;
+ 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);
@@ -132,11 +132,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);