dlm: rearrange async condition return

This patch moves the return of FILE_LOCK_DEFERRED a little bit earlier
than checking afterwards again if the request was an asynchronous request.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Alexander Aring 2022-04-04 16:06:33 -04:00 committed by David Teigland
parent bcbb4ba6c9
commit a800ba77fd

View File

@ -149,16 +149,19 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
op_data->file = file; op_data->file = file;
op->data = op_data; op->data = op_data;
send_op(op);
rv = FILE_LOCK_DEFERRED;
goto out;
} else { } else {
op->info.owner = (__u64)(long) fl->fl_owner; op->info.owner = (__u64)(long) fl->fl_owner;
} }
send_op(op); send_op(op);
if (!op->data) {
rv = wait_event_interruptible(recv_wq, (op->done != 0)); rv = wait_event_interruptible(recv_wq, (op->done != 0));
if (rv == -ERESTARTSYS) { if (rv == -ERESTARTSYS) {
log_debug(ls, "dlm_posix_lock: wait killed %llx", log_debug(ls, "%s: wait killed %llx", __func__,
(unsigned long long)number); (unsigned long long)number);
spin_lock(&ops_lock); spin_lock(&ops_lock);
list_del(&op->list); list_del(&op->list);
@ -167,10 +170,6 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
do_unlock_close(ls, number, file, fl); do_unlock_close(ls, number, file, fl);
goto out; goto out;
} }
} else {
rv = FILE_LOCK_DEFERRED;
goto out;
}
WARN_ON(!list_empty(&op->list)); WARN_ON(!list_empty(&op->list));