Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f61d5752 authored by Alexander Aring's avatar Alexander Aring Committed by Greg Kroah-Hartman
Browse files

dlm: rearrange async condition return



[ Upstream commit a800ba77fd285c6391a82819867ac64e9ab3af46 ]

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: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
Stable-dep-of: 59e45c758ca1 ("fs: dlm: interrupt posix locks only when process is killed")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ed092c49
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -149,16 +149,19 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
		op_data->file	= file;

		op->data = op_data;

		send_op(op);
		rv = FILE_LOCK_DEFERRED;
		goto out;
	} else {
		op->info.owner	= (__u64)(long) fl->fl_owner;
	}

	send_op(op);

	if (!op->data) {
	rv = wait_event_interruptible(recv_wq, (op->done != 0));
	if (rv == -ERESTARTSYS) {
			log_debug(ls, "dlm_posix_lock: wait killed %llx",
		log_debug(ls, "%s: wait killed %llx", __func__,
			  (unsigned long long)number);
		spin_lock(&ops_lock);
		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);
		goto out;
	}
	} else {
		rv = FILE_LOCK_DEFERRED;
		goto out;
	}

	spin_lock(&ops_lock);
	if (!list_empty(&op->list)) {