Skip to content

Commit

Permalink
lockd: fix file selection in nlmsvc_cancel_blocked
Browse files Browse the repository at this point in the history
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: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
jtlayton authored and Chuck Lever committed Dec 10, 2022
1 parent 69efce0 commit 9f27783
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9f27783

Please sign in to comment.