diff options
author | Alexander Aring <aahringo@redhat.com> | 2022-11-17 17:11:51 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2022-11-21 09:45:49 -0600 |
commit | c3d88dfd15835f42c79467eee2c40db3095e5271 (patch) | |
tree | c2aaeee130462cdd91bf7148fabd41091ae9a416 /fs/dlm | |
parent | 4f567acb0b8622fe265aac4b0037a03ef544ba24 (diff) | |
download | linux-rpi-c3d88dfd15835f42c79467eee2c40db3095e5271.tar.gz linux-rpi-c3d88dfd15835f42c79467eee2c40db3095e5271.tar.bz2 linux-rpi-c3d88dfd15835f42c79467eee2c40db3095e5271.zip |
fs: dlm: cleanup listen sock handling
This patch removes save_listen_callbacks() and add_listen_sock() as they
are only used once in lowcomms functionality. For shutdown lowcomms it's
not necessary to whole flush the workqueues to synchronize with
restoring the old sk_data_ready() callback. Only the listen con receive
work need to be cancelled. For each individual node shutdown we should be
sure that last ack was been transmitted which is done by flushing per
connection swork worker.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/lowcomms.c | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index e33bee1beba2..8bf09c3a0946 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -647,17 +647,6 @@ out: orig_report(sk); } -/* Note: sk_callback_lock must be locked before calling this function. */ -static void save_listen_callbacks(struct socket *sock) -{ - struct sock *sk = sock->sk; - - listen_sock.sk_data_ready = sk->sk_data_ready; - listen_sock.sk_state_change = sk->sk_state_change; - listen_sock.sk_write_space = sk->sk_write_space; - listen_sock.sk_error_report = sk->sk_error_report; -} - static void restore_callbacks(struct socket *sock) { struct sock *sk = sock->sk; @@ -671,21 +660,6 @@ static void restore_callbacks(struct socket *sock) release_sock(sk); } -static void add_listen_sock(struct socket *sock, struct listen_connection *con) -{ - struct sock *sk = sock->sk; - - lock_sock(sk); - save_listen_callbacks(sock); - con->sock = sock; - - sk->sk_user_data = con; - sk->sk_allocation = GFP_NOFS; - /* Install a data_ready callback */ - sk->sk_data_ready = lowcomms_listen_data_ready; - release_sock(sk); -} - /* Make a socket active */ static void add_sock(struct socket *sock, struct connection *con) { @@ -1593,13 +1567,12 @@ static int work_start(void) void dlm_lowcomms_shutdown(void) { - restore_callbacks(listen_con.sock); - - if (recv_workqueue) - flush_workqueue(recv_workqueue); - if (send_workqueue) - flush_workqueue(send_workqueue); + /* stop lowcomms_listen_data_ready calls */ + lock_sock(listen_con.sock->sk); + listen_con.sock->sk->sk_data_ready = listen_sock.sk_data_ready; + release_sock(listen_con.sock->sk); + cancel_work_sync(&listen_con.rwork); dlm_close_sock(&listen_con.sock); } @@ -1615,6 +1588,7 @@ void dlm_lowcomms_shutdown_node(int nodeid, bool force) return; } + flush_work(&con->swork); WARN_ON_ONCE(!force && !list_empty(&con->writequeue)); clean_one_writequeue(con); if (con->othercon) @@ -1736,8 +1710,17 @@ static int dlm_listen_for_all(void) if (result < 0) goto out; - save_listen_callbacks(sock); - add_listen_sock(sock, &listen_con); + lock_sock(sock->sk); + listen_sock.sk_data_ready = sock->sk->sk_data_ready; + listen_sock.sk_write_space = sock->sk->sk_write_space; + listen_sock.sk_error_report = sock->sk->sk_error_report; + listen_sock.sk_state_change = sock->sk->sk_state_change; + + listen_con.sock = sock; + + sock->sk->sk_allocation = GFP_NOFS; + sock->sk->sk_data_ready = lowcomms_listen_data_ready; + release_sock(sock->sk); result = sock->ops->listen(sock, 5); if (result < 0) { |