Skip to content

Commit aec1582

Browse files
jtlaytonchucklever
authored andcommitted
lockd: set fl_owner when unlocking files
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: 7f024fc ("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>
1 parent 5b2f3e0 commit aec1582

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/lockd/svcsubs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,15 @@ nlm_delete_file(struct nlm_file *file)
176176
}
177177
}
178178

179-
static int nlm_unlock_files(struct nlm_file *file)
179+
static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner)
180180
{
181181
struct file_lock lock;
182182

183183
locks_init_lock(&lock);
184184
lock.fl_type = F_UNLCK;
185185
lock.fl_start = 0;
186186
lock.fl_end = OFFSET_MAX;
187+
lock.fl_owner = owner;
187188
if (file->f_file[O_RDONLY] &&
188189
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
189190
goto out_err;
@@ -225,7 +226,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
225226
if (match(lockhost, host)) {
226227

227228
spin_unlock(&flctx->flc_lock);
228-
if (nlm_unlock_files(file))
229+
if (nlm_unlock_files(file, fl->fl_owner))
229230
return 1;
230231
goto again;
231232
}

0 commit comments

Comments
 (0)