diff --git a/connection.c b/connection.c index 7913f7e0..6d156965 100644 --- a/connection.c +++ b/connection.c @@ -137,6 +137,7 @@ void ksmbd_conn_enqueue_request(struct ksmbd_work *work) requests_queue = &conn->requests; #endif + atomic_inc(&conn->req_running); if (requests_queue) { spin_lock(&conn->request_lock); list_add_tail(&work->request_entry, requests_queue); @@ -380,8 +381,7 @@ int ksmbd_conn_handler_loop(void *p) conn->request_buf = NULL; recheck: - if (atomic_inc_return(&conn->req_running) > max_req) { - atomic_dec(&conn->req_running); + if (atomic_read(&conn->req_running) + 1 > max_req) { wait_event_interruptible(conn->req_running_q, atomic_read(&conn->req_running) < max_req); goto recheck;