]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dlm: convert ls_recv_active from rw_semaphore to rwlock
authorAlexander Aring <aahringo@redhat.com>
Tue, 2 Apr 2024 19:18:07 +0000 (15:18 -0400)
committerDavid Teigland <teigland@redhat.com>
Tue, 9 Apr 2024 16:44:49 +0000 (11:44 -0500)
Convert ls_recv_active rw_semaphore to an rwlock to avoid
sleeping, in preparation for softirq message processing.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/dlm_internal.h
fs/dlm/lock.c
fs/dlm/lockspace.c
fs/dlm/member.c
fs/dlm/recoverd.c

index 61820b8c47a79e4b7636afef3533305cb69f9243..269c12e0824f415a5bd31a46ba1c87ac91349495 100644 (file)
@@ -653,7 +653,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;
index 98d9c5a4be00a8133beaa46de2071f2e46c1b13f..2f53fdfe262a820a0d56fc540306f54f3fed3973 100644 (file)
@@ -4837,7 +4837,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)
@@ -4845,7 +4845,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);
 }
index 757e473bc619cb36545903c9ea0c00b67eadf8cd..c021bf684fbc840da343d0f0c039ae6e194ee300 100644 (file)
@@ -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);
index 707cebcdc5334e314c03c151433ed0d77848196e..ac1b555af9d6fc7c78aa759f8b698fb4fdd686b1 100644 (file)
@@ -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:
index 0b1a62167798cbc21ac0219f82ab9bf251c93a03..a11ae1da2f60c92ae285b2fe73aab5863f2451d7 100644 (file)
@@ -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;
 }