dlm: convert ls_waiters_mutex to spinlock
Convert the waiters mutex to a spinlock in prepration for processing messages in softirq context. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
6b52ea7916
commit
097691dbad
@ -743,7 +743,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf,
|
||||
goto out;
|
||||
}
|
||||
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
memset(debug_buf, 0, sizeof(debug_buf));
|
||||
|
||||
list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) {
|
||||
@ -754,7 +754,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf,
|
||||
break;
|
||||
pos += ret;
|
||||
}
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
dlm_unlock_recovery(ls);
|
||||
|
||||
rv = simple_read_from_buffer(userbuf, count, ppos, debug_buf, pos);
|
||||
|
@ -595,7 +595,7 @@ struct dlm_ls {
|
||||
struct dlm_rsbtable *ls_rsbtbl;
|
||||
uint32_t ls_rsbtbl_size;
|
||||
|
||||
struct mutex ls_waiters_mutex;
|
||||
spinlock_t ls_waiters_lock;
|
||||
struct list_head ls_waiters; /* lkbs needing a reply */
|
||||
|
||||
struct mutex ls_orphans_mutex;
|
||||
|
@ -1406,7 +1406,7 @@ static int add_to_waiters(struct dlm_lkb *lkb, int mstype, int to_nodeid)
|
||||
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
||||
int error = 0;
|
||||
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
|
||||
if (is_overlap_unlock(lkb) ||
|
||||
(is_overlap_cancel(lkb) && (mstype == DLM_MSG_CANCEL))) {
|
||||
@ -1449,7 +1449,7 @@ static int add_to_waiters(struct dlm_lkb *lkb, int mstype, int to_nodeid)
|
||||
log_error(ls, "addwait error %x %d flags %x %d %d %s",
|
||||
lkb->lkb_id, error, dlm_iflags_val(lkb), mstype,
|
||||
lkb->lkb_wait_type, lkb->lkb_resource->res_name);
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -1549,9 +1549,9 @@ static int remove_from_waiters(struct dlm_lkb *lkb, int mstype)
|
||||
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
|
||||
int error;
|
||||
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
error = _remove_from_waiters(lkb, mstype, NULL);
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -1569,13 +1569,13 @@ static int remove_from_waiters_ms(struct dlm_lkb *lkb,
|
||||
int error;
|
||||
|
||||
if (!local)
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
else
|
||||
WARN_ON_ONCE(!rwsem_is_locked(&ls->ls_in_recovery) ||
|
||||
!dlm_locking_stopped(ls));
|
||||
error = _remove_from_waiters(lkb, le32_to_cpu(ms->m_type), ms);
|
||||
if (!local)
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -4993,7 +4993,7 @@ static struct dlm_lkb *find_resend_waiter(struct dlm_ls *ls)
|
||||
{
|
||||
struct dlm_lkb *lkb = NULL, *iter;
|
||||
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
list_for_each_entry(iter, &ls->ls_waiters, lkb_wait_reply) {
|
||||
if (test_bit(DLM_IFL_RESEND_BIT, &iter->lkb_iflags)) {
|
||||
hold_lkb(iter);
|
||||
@ -5001,7 +5001,7 @@ static struct dlm_lkb *find_resend_waiter(struct dlm_ls *ls)
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
|
||||
return lkb;
|
||||
}
|
||||
@ -5101,9 +5101,9 @@ int dlm_recover_waiters_post(struct dlm_ls *ls)
|
||||
}
|
||||
|
||||
/* Forcibly remove from waiters list */
|
||||
mutex_lock(&ls->ls_waiters_mutex);
|
||||
spin_lock(&ls->ls_waiters_lock);
|
||||
list_del_init(&lkb->lkb_wait_reply);
|
||||
mutex_unlock(&ls->ls_waiters_mutex);
|
||||
spin_unlock(&ls->ls_waiters_lock);
|
||||
|
||||
/*
|
||||
* The lkb is now clear of all prior waiters state and can be
|
||||
|
@ -515,7 +515,7 @@ static int new_lockspace(const char *name, const char *cluster,
|
||||
spin_lock_init(&ls->ls_lkbidr_spin);
|
||||
|
||||
INIT_LIST_HEAD(&ls->ls_waiters);
|
||||
mutex_init(&ls->ls_waiters_mutex);
|
||||
spin_lock_init(&ls->ls_waiters_lock);
|
||||
INIT_LIST_HEAD(&ls->ls_orphans);
|
||||
mutex_init(&ls->ls_orphans_mutex);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user