Skip to content

Commit

Permalink
lockd: fix failure to cleanup client locks
Browse files Browse the repository at this point in the history
commit d19a7af upstream.

In my testing, we're sometimes hitting the request->fl_flags & FL_EXISTS
case in posix_lock_inode, presumably just by random luck since we're not
actually initializing fl_flags here.

This probably didn't matter before commit 7f024fc ("Keep read and
write fds with each nlm_file") since we wouldn't previously unlock
unless we knew there were locks.

But now it causes lockd to give up on removing more locks.

We could just initialize fl_flags, but really it seems dubious to be
calling vfs_lock_file with random values in some of the fields.

Fixes: 7f024fc ("Keep read and write fds with each nlm_file")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[ cel: fixed checkpatch.pl nit ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
J. Bruce Fields authored and gregkh committed Feb 5, 2022
1 parent cb5864b commit 6dfc954
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/lockd/svcsubs.c
Expand Up @@ -180,6 +180,7 @@ static int nlm_unlock_files(struct nlm_file *file)
{
struct file_lock lock;

locks_init_lock(&lock);
lock.fl_type = F_UNLCK;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
Expand Down

0 comments on commit 6dfc954

Please sign in to comment.