Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lockd: ensure we use the correct file descriptor when unlocking

Shared locks are set on O_RDONLY descriptors and exclusive locks are set
on O_WRONLY ones. nlmsvc_unlock however calls vfs_lock_file twice, once
for each descriptor, but it doesn't reset fl_file. Ensure that it does.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
69efce00 75c7940d

+6 -4
+6 -4
fs/lockd/svclock.c
··· 659 659 nlmsvc_cancel_blocked(net, file, lock); 660 660 661 661 lock->fl.fl_type = F_UNLCK; 662 - if (file->f_file[O_RDONLY]) 663 - error = vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, 662 + lock->fl.fl_file = file->f_file[O_RDONLY]; 663 + if (lock->fl.fl_file) 664 + error = vfs_lock_file(lock->fl.fl_file, F_SETLK, 664 665 &lock->fl, NULL); 665 - if (file->f_file[O_WRONLY]) 666 - error = vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, 666 + lock->fl.fl_file = file->f_file[O_WRONLY]; 667 + if (lock->fl.fl_file) 668 + error |= vfs_lock_file(lock->fl.fl_file, F_SETLK, 667 669 &lock->fl, NULL); 668 670 669 671 return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;