lockd: set fl_owner when unlocking files
[ Upstream commit aec158242b87a43d83322e99bc71ab4428e5ab79 ] Unlocking a POSIX lock on an inode with vfs_lock_file only works if the owner matches. Ensure we set it in the request. Cc: J. Bruce Fields <bfields@fieldses.org> Fixes: 7f024fcd5c97 ("Keep read and write fds with each nlm_file") Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
845b309cf5
commit
486c1acf14
@@ -176,7 +176,7 @@ nlm_delete_file(struct nlm_file *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nlm_unlock_files(struct nlm_file *file)
|
static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner)
|
||||||
{
|
{
|
||||||
struct file_lock lock;
|
struct file_lock lock;
|
||||||
|
|
||||||
@@ -184,6 +184,7 @@ static int nlm_unlock_files(struct nlm_file *file)
|
|||||||
lock.fl_type = F_UNLCK;
|
lock.fl_type = F_UNLCK;
|
||||||
lock.fl_start = 0;
|
lock.fl_start = 0;
|
||||||
lock.fl_end = OFFSET_MAX;
|
lock.fl_end = OFFSET_MAX;
|
||||||
|
lock.fl_owner = owner;
|
||||||
if (file->f_file[O_RDONLY] &&
|
if (file->f_file[O_RDONLY] &&
|
||||||
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
|
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
|
||||||
goto out_err;
|
goto out_err;
|
||||||
@@ -225,7 +226,7 @@ again:
|
|||||||
if (match(lockhost, host)) {
|
if (match(lockhost, host)) {
|
||||||
|
|
||||||
spin_unlock(&flctx->flc_lock);
|
spin_unlock(&flctx->flc_lock);
|
||||||
if (nlm_unlock_files(file))
|
if (nlm_unlock_files(file, fl->fl_owner))
|
||||||
return 1;
|
return 1;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user