diff options
author | Ingo Molnar <mingo@kernel.org> | 2024-09-05 12:17:43 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-09-05 12:17:43 +0300 |
commit | 95c13662b65c562d4902ad9f810378261347a749 (patch) | |
tree | 036091f8615fdf2d00021709993b00790a630250 /fs/smb/server/connection.c | |
parent | fe826cc2654e8561b64246325e6a51b62bf2488c (diff) | |
parent | 2ab9d830262c132ab5db2f571003d80850d56b2a (diff) | |
download | linux-95c13662b65c562d4902ad9f810378261347a749.tar.xz |
Merge branch 'perf/urgent' into perf/core, to pick up fixes
This also refreshes the -rc1 based branch to -rc5.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/smb/server/connection.c')
-rw-r--r-- | fs/smb/server/connection.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c index 09e1e7771592..7889df8112b4 100644 --- a/fs/smb/server/connection.c +++ b/fs/smb/server/connection.c @@ -165,11 +165,43 @@ void ksmbd_all_conn_set_status(u64 sess_id, u32 status) up_read(&conn_list_lock); } -void ksmbd_conn_wait_idle(struct ksmbd_conn *conn, u64 sess_id) +void ksmbd_conn_wait_idle(struct ksmbd_conn *conn) { wait_event(conn->req_running_q, atomic_read(&conn->req_running) < 2); } +int ksmbd_conn_wait_idle_sess_id(struct ksmbd_conn *curr_conn, u64 sess_id) +{ + struct ksmbd_conn *conn; + int rc, retry_count = 0, max_timeout = 120; + int rcount = 1; + +retry_idle: + if (retry_count >= max_timeout) + return -EIO; + + down_read(&conn_list_lock); + list_for_each_entry(conn, &conn_list, conns_list) { + if (conn->binding || xa_load(&conn->sessions, sess_id)) { + if (conn == curr_conn) + rcount = 2; + if (atomic_read(&conn->req_running) >= rcount) { + rc = wait_event_timeout(conn->req_running_q, + atomic_read(&conn->req_running) < rcount, + HZ); + if (!rc) { + up_read(&conn_list_lock); + retry_count++; + goto retry_idle; + } + } + } + } + up_read(&conn_list_lock); + + return 0; +} + int ksmbd_conn_write(struct ksmbd_work *work) { struct ksmbd_conn *conn = work->conn; |