Commit 9f27783b authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever
Browse files

lockd: fix file selection in nlmsvc_cancel_blocked



We currently do a lock_to_openmode call based on the arguments from the
NLM_UNLOCK call, but that will always set the fl_type of the lock to
F_UNLCK, and the O_RDONLY descriptor is always chosen.

Fix it to use the file_lock from the block instead.

Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 69efce00
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -699,9 +699,10 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
	block = nlmsvc_lookup_block(file, lock);
	mutex_unlock(&file->f_mutex);
	if (block != NULL) {
		mode = lock_to_openmode(&lock->fl);
		vfs_cancel_lock(block->b_file->f_file[mode],
				&block->b_call->a_args.lock.fl);
		struct file_lock *fl = &block->b_call->a_args.lock.fl;

		mode = lock_to_openmode(fl);
		vfs_cancel_lock(block->b_file->f_file[mode], fl);
		status = nlmsvc_unlink_block(block);
		nlmsvc_release_block(block);
	}