Skip to content

Commit d52c9b8

Browse files
Alexander Aringteigland
authored andcommitted
dlm: convert ls_recv_active from rw_semaphore to rwlock
Convert ls_recv_active rw_semaphore to an rwlock to avoid sleeping, in preparation for softirq message processing. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent c288745 commit d52c9b8

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

fs/dlm/dlm_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ struct dlm_ls {
653653
uint64_t ls_recover_seq;
654654
struct dlm_recover *ls_recover_args;
655655
struct rw_semaphore ls_in_recovery; /* block local requests */
656-
struct rw_semaphore ls_recv_active; /* block dlm_recv */
656+
rwlock_t ls_recv_active; /* block dlm_recv */
657657
struct list_head ls_requestqueue;/* queue remote requests */
658658
rwlock_t ls_requestqueue_lock;
659659
struct dlm_rcom *ls_recover_buf;

fs/dlm/lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4837,15 +4837,15 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
48374837
/* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
48384838
be inactive (in this ls) before transitioning to recovery mode */
48394839

4840-
down_read(&ls->ls_recv_active);
4840+
read_lock(&ls->ls_recv_active);
48414841
if (hd->h_cmd == DLM_MSG)
48424842
dlm_receive_message(ls, &p->message, nodeid);
48434843
else if (hd->h_cmd == DLM_RCOM)
48444844
dlm_receive_rcom(ls, &p->rcom, nodeid);
48454845
else
48464846
log_error(ls, "invalid h_cmd %d from %d lockspace %x",
48474847
hd->h_cmd, nodeid, le32_to_cpu(hd->u.h_lockspace));
4848-
up_read(&ls->ls_recv_active);
4848+
read_unlock(&ls->ls_recv_active);
48494849

48504850
dlm_put_lockspace(ls);
48514851
}

fs/dlm/lockspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ static int new_lockspace(const char *name, const char *cluster,
552552
ls->ls_recover_seq = get_random_u64();
553553
ls->ls_recover_args = NULL;
554554
init_rwsem(&ls->ls_in_recovery);
555-
init_rwsem(&ls->ls_recv_active);
555+
rwlock_init(&ls->ls_recv_active);
556556
INIT_LIST_HEAD(&ls->ls_requestqueue);
557557
rwlock_init(&ls->ls_requestqueue_lock);
558558
spin_lock_init(&ls->ls_clear_proc_locks);

fs/dlm/member.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
630630
* message to the requestqueue without races.
631631
*/
632632

633-
down_write(&ls->ls_recv_active);
633+
write_lock(&ls->ls_recv_active);
634634

635635
/*
636636
* Abort any recovery that's in progress (see RECOVER_STOP,
@@ -654,7 +654,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
654654
* requestqueue for later.
655655
*/
656656

657-
up_write(&ls->ls_recv_active);
657+
write_unlock(&ls->ls_recv_active);
658658

659659
/*
660660
* This in_recovery lock does two things:

fs/dlm/recoverd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
103103
{
104104
int error = -EINTR;
105105

106-
down_write(&ls->ls_recv_active);
106+
write_lock(&ls->ls_recv_active);
107107

108108
spin_lock(&ls->ls_recover_lock);
109109
if (ls->ls_recover_seq == seq) {
@@ -115,7 +115,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
115115
}
116116
spin_unlock(&ls->ls_recover_lock);
117117

118-
up_write(&ls->ls_recv_active);
118+
write_unlock(&ls->ls_recv_active);
119119
return error;
120120
}
121121

0 commit comments

Comments
 (0)