forked from Minki/linux
dlm: replace sanity checks with WARN_ON
There are several sanity checks and recover handling if they occur in the dlm plock handling. From my understanding those operation can't run in parallel with any list manipulation which involved setting the list holder of plock_op, if so we have a bug which this sanity check will warn about. Previously if such sanity check occurred the dlm plock handling was trying to recover from it by deleting the plock_op from a list which the holder was set to. However there is a bug in the dlm plock handling if this case ever happens. To make such bugs are more visible for further investigations we add a WARN_ON() on those sanity checks and remove the recovering handling because other possible side effects. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
42252d0d2a
commit
a559790caa
@ -157,13 +157,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
|
||||
goto out;
|
||||
}
|
||||
|
||||
spin_lock(&ops_lock);
|
||||
if (!list_empty(&op->list)) {
|
||||
log_error(ls, "dlm_posix_lock: op on list %llx",
|
||||
(unsigned long long)number);
|
||||
list_del(&op->list);
|
||||
}
|
||||
spin_unlock(&ops_lock);
|
||||
WARN_ON(!list_empty(&op->list));
|
||||
|
||||
rv = op->info.rv;
|
||||
|
||||
@ -190,13 +184,7 @@ static int dlm_plock_callback(struct plock_op *op)
|
||||
struct plock_xop *xop = (struct plock_xop *)op;
|
||||
int rv = 0;
|
||||
|
||||
spin_lock(&ops_lock);
|
||||
if (!list_empty(&op->list)) {
|
||||
log_print("dlm_plock_callback: op on list %llx",
|
||||
(unsigned long long)op->info.number);
|
||||
list_del(&op->list);
|
||||
}
|
||||
spin_unlock(&ops_lock);
|
||||
WARN_ON(!list_empty(&op->list));
|
||||
|
||||
/* check if the following 2 are still valid or make a copy */
|
||||
file = xop->file;
|
||||
@ -289,13 +277,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
|
||||
send_op(op);
|
||||
wait_event(recv_wq, (op->done != 0));
|
||||
|
||||
spin_lock(&ops_lock);
|
||||
if (!list_empty(&op->list)) {
|
||||
log_error(ls, "dlm_posix_unlock: op on list %llx",
|
||||
(unsigned long long)number);
|
||||
list_del(&op->list);
|
||||
}
|
||||
spin_unlock(&ops_lock);
|
||||
WARN_ON(!list_empty(&op->list));
|
||||
|
||||
rv = op->info.rv;
|
||||
|
||||
@ -343,13 +325,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
|
||||
send_op(op);
|
||||
wait_event(recv_wq, (op->done != 0));
|
||||
|
||||
spin_lock(&ops_lock);
|
||||
if (!list_empty(&op->list)) {
|
||||
log_error(ls, "dlm_posix_get: op on list %llx",
|
||||
(unsigned long long)number);
|
||||
list_del(&op->list);
|
||||
}
|
||||
spin_unlock(&ops_lock);
|
||||
WARN_ON(!list_empty(&op->list));
|
||||
|
||||
/* info.rv from userspace is 1 for conflict, 0 for no-conflict,
|
||||
-ENOENT if there are no locks on the file */
|
||||
|
Loading…
Reference in New Issue
Block a user