mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
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 <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
c288745f1d
commit
d52c9b8fef
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user