Commit d52c9b8f authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

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: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent c288745f
...@@ -653,7 +653,7 @@ struct dlm_ls { ...@@ -653,7 +653,7 @@ struct dlm_ls {
uint64_t ls_recover_seq; uint64_t ls_recover_seq;
struct dlm_recover *ls_recover_args; struct dlm_recover *ls_recover_args;
struct rw_semaphore ls_in_recovery; /* block local requests */ 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 */ struct list_head ls_requestqueue;/* queue remote requests */
rwlock_t ls_requestqueue_lock; rwlock_t ls_requestqueue_lock;
struct dlm_rcom *ls_recover_buf; struct dlm_rcom *ls_recover_buf;
......
...@@ -4837,7 +4837,7 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid) ...@@ -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 /* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
be inactive (in this ls) before transitioning to recovery mode */ 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) if (hd->h_cmd == DLM_MSG)
dlm_receive_message(ls, &p->message, nodeid); dlm_receive_message(ls, &p->message, nodeid);
else if (hd->h_cmd == DLM_RCOM) else if (hd->h_cmd == DLM_RCOM)
...@@ -4845,7 +4845,7 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid) ...@@ -4845,7 +4845,7 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
else else
log_error(ls, "invalid h_cmd %d from %d lockspace %x", log_error(ls, "invalid h_cmd %d from %d lockspace %x",
hd->h_cmd, nodeid, le32_to_cpu(hd->u.h_lockspace)); 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); dlm_put_lockspace(ls);
} }
......
...@@ -552,7 +552,7 @@ static int new_lockspace(const char *name, const char *cluster, ...@@ -552,7 +552,7 @@ static int new_lockspace(const char *name, const char *cluster,
ls->ls_recover_seq = get_random_u64(); ls->ls_recover_seq = get_random_u64();
ls->ls_recover_args = NULL; ls->ls_recover_args = NULL;
init_rwsem(&ls->ls_in_recovery); init_rwsem(&ls->ls_in_recovery);
init_rwsem(&ls->ls_recv_active); rwlock_init(&ls->ls_recv_active);
INIT_LIST_HEAD(&ls->ls_requestqueue); INIT_LIST_HEAD(&ls->ls_requestqueue);
rwlock_init(&ls->ls_requestqueue_lock); rwlock_init(&ls->ls_requestqueue_lock);
spin_lock_init(&ls->ls_clear_proc_locks); spin_lock_init(&ls->ls_clear_proc_locks);
......
...@@ -630,7 +630,7 @@ int dlm_ls_stop(struct dlm_ls *ls) ...@@ -630,7 +630,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
* message to the requestqueue without races. * 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, * Abort any recovery that's in progress (see RECOVER_STOP,
...@@ -654,7 +654,7 @@ int dlm_ls_stop(struct dlm_ls *ls) ...@@ -654,7 +654,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
* requestqueue for later. * requestqueue for later.
*/ */
up_write(&ls->ls_recv_active); write_unlock(&ls->ls_recv_active);
/* /*
* This in_recovery lock does two things: * This in_recovery lock does two things:
......
...@@ -103,7 +103,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq) ...@@ -103,7 +103,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
{ {
int error = -EINTR; int error = -EINTR;
down_write(&ls->ls_recv_active); write_lock(&ls->ls_recv_active);
spin_lock(&ls->ls_recover_lock); spin_lock(&ls->ls_recover_lock);
if (ls->ls_recover_seq == seq) { if (ls->ls_recover_seq == seq) {
...@@ -115,7 +115,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq) ...@@ -115,7 +115,7 @@ static int enable_locking(struct dlm_ls *ls, uint64_t seq)
} }
spin_unlock(&ls->ls_recover_lock); spin_unlock(&ls->ls_recover_lock);
up_write(&ls->ls_recv_active); write_unlock(&ls->ls_recv_active);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment