From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, aahringo@redhat.com
Subject: [PATCHv3 v6.8-rc6 15/18] dlm: ls_recv_active semaphore to rwlock
Date: Mon, 26 Feb 2024 20:49:06 -0500 [thread overview]
Message-ID: <20240227014909.93945-16-aahringo@redhat.com> (raw)
In-Reply-To: <20240227014909.93945-1-aahringo@redhat.com>
This patch converts the ls_recv_active semaphore to a rwlock to not
sleep during dlm message processing.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/dlm_internal.h | 2 +-
fs/dlm/lock.c | 4 ++--
fs/dlm/lockspace.c | 2 +-
fs/dlm/member.c | 4 ++--
fs/dlm/recoverd.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 4cb1f38067d3..70de068bcf2b 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -623,7 +623,7 @@ struct dlm_ls {
uint64_t ls_recover_seq;
struct dlm_recover *ls_recover_args;
struct rw_semaphore ls_in_recovery; /* block local requests */
- struct rw_semaphore ls_recv_active; /* block dlm_recv */
+ rwlock_t ls_recv_active; /* block dlm_recv */
struct list_head ls_requestqueue;/* queue remote requests */
rwlock_t ls_requestqueue_lock;
struct dlm_rcom *ls_recover_buf;
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 10cebb418931..73bf81eb88d9 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -4834,7 +4834,7 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
/* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
be inactive (in this ls) before transitioning to recovery mode */
- down_read(&ls->ls_recv_active);
+ read_lock(&ls->ls_recv_active);
if (hd->h_cmd == DLM_MSG)
dlm_receive_message(ls, &p->message, nodeid);
else if (hd->h_cmd == DLM_RCOM)
@@ -4842,7 +4842,7 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
else
log_error(ls, "invalid h_cmd %d from %d lockspace %x",
hd->h_cmd, nodeid, le32_to_cpu(hd->u.h_lockspace));
- up_read(&ls->ls_recv_active);
+ read_unlock(&ls->ls_recv_active);
dlm_put_lockspace(ls);
}
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 0df0f07fa092..3384e0004700 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -552,7 +552,7 @@ static int new_lockspace(const char *name, const char *cluster,
ls->ls_recover_seq = get_random_u64();
ls->ls_recover_args = NULL;
init_rwsem(&ls->ls_in_recovery);
- init_rwsem(&ls->ls_recv_active);
+ rwlock_init(&ls->ls_recv_active);
INIT_LIST_HEAD(&ls->ls_requestqueue);
rwlock_init(&ls->ls_requestqueue_lock);
spin_lock_init(&ls->ls_clear_proc_locks);
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 707cebcdc533..ac1b555af9d6 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -630,7 +630,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
* message to the requestqueue without races.
*/
- down_write(&ls->ls_recv_active);
+ write_lock(&ls->ls_recv_active);
/*
* Abort any recovery that's in progress (see RECOVER_STOP,
@@ -654,7 +654,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
* requestqueue for later.
*/
- up_write(&ls->ls_recv_active);
+ write_unlock(&ls->ls_recv_active);
/*
* This in_recovery lock does two things:
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c
index 5388db89e22f..361327762c1b 100644
--- a/fs/dlm/recoverd.c
+++ b/fs/dlm/recoverd.c
@@ -103,7 +103,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
{
int error = -EINTR;
- down_write(&ls->ls_recv_active);
+ write_lock(&ls->ls_recv_active);
spin_lock(&ls->ls_recover_lock);
if (ls->ls_recover_seq == seq) {
@@ -115,7 +115,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
}
spin_unlock(&ls->ls_recover_lock);
- up_write(&ls->ls_recv_active);
+ write_unlock(&ls->ls_recv_active);
return error;
}
--
2.43.0
next prev parent reply other threads:[~2024-02-27 1:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 1:48 [PATCHv3 v6.8-rc6 00/18] dlm: bring message parsing to softirq context Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 01/18] fs: dlm: Simplify the allocation of slab caches in dlm_midcomms_cache_create Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 02/18] fs: dlm: Simplify the allocation of slab caches in dlm_lowcomms_msg_cache_create Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 03/18] dlm: fix off-by-one waiters refcount handling Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 04/18] dlm: put lkbs instead of force free Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 05/18] dlm: remove allocation parameter in msg allocation Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 06/18] dlm: switch to GFP_ATOMIC in dlm allocations Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 07/18] dlm: move root_list functionality to recover.c Alexander Aring
2024-02-27 1:48 ` [PATCHv3 v6.8-rc6 08/18] dlm: move master dir dump to own list Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 09/18] dlm: move root_list to ls_recover() stack Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 10/18] dlm: implement directory dump context Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 11/18] dlm: drop holding waiters mutex in waiters recovery Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 12/18] dlm: convert ls_waiters_mutex to spinlock Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 13/18] dlm: convert res_lock " Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 14/18] dlm: make requestqueue handling non sleepable Alexander Aring
2024-02-27 1:49 ` Alexander Aring [this message]
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 16/18] dlm: remove schedule in dlm receive path Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 17/18] dlm: convert message parsing locks to disable bh Alexander Aring
2024-02-27 1:49 ` [PATCHv3 v6.8-rc6 18/18] dlm: do dlm message processing in softirq context Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240227014909.93945-16-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox