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

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: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 42252d0d
...@@ -157,13 +157,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -157,13 +157,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
goto out; goto out;
} }
spin_lock(&ops_lock); WARN_ON(!list_empty(&op->list));
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);
rv = op->info.rv; rv = op->info.rv;
...@@ -190,13 +184,7 @@ static int dlm_plock_callback(struct plock_op *op) ...@@ -190,13 +184,7 @@ static int dlm_plock_callback(struct plock_op *op)
struct plock_xop *xop = (struct plock_xop *)op; struct plock_xop *xop = (struct plock_xop *)op;
int rv = 0; int rv = 0;
spin_lock(&ops_lock); WARN_ON(!list_empty(&op->list));
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);
/* check if the following 2 are still valid or make a copy */ /* check if the following 2 are still valid or make a copy */
file = xop->file; file = xop->file;
...@@ -289,13 +277,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -289,13 +277,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
send_op(op); send_op(op);
wait_event(recv_wq, (op->done != 0)); wait_event(recv_wq, (op->done != 0));
spin_lock(&ops_lock); WARN_ON(!list_empty(&op->list));
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);
rv = op->info.rv; rv = op->info.rv;
...@@ -343,13 +325,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, ...@@ -343,13 +325,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
send_op(op); send_op(op);
wait_event(recv_wq, (op->done != 0)); wait_event(recv_wq, (op->done != 0));
spin_lock(&ops_lock); WARN_ON(!list_empty(&op->list));
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);
/* info.rv from userspace is 1 for conflict, 0 for no-conflict, /* info.rv from userspace is 1 for conflict, 0 for no-conflict,
-ENOENT if there are no locks on the file */ -ENOENT if there are no locks on the file */
......
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