diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2022-02-03 17:36:16 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2022-02-03 17:36:16 -0800 |
| commit | c59400a68c53374179cdc5f99fa77afbd092dcf8 (patch) | |
| tree | c5e17286fa5b7867a5290a975cca3bc5759d510e /fs/lockd | |
| parent | 9c30918925d7992a6d812b3aa7e026839723c78a (diff) | |
| parent | dcb85f85fa6f142aae1fe86f399d4503d49f2b60 (diff) | |
| download | linux-next-c59400a68c53374179cdc5f99fa77afbd092dcf8.tar.gz linux-next-c59400a68c53374179cdc5f99fa77afbd092dcf8.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'fs/lockd')
| -rw-r--r-- | fs/lockd/svcsubs.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index cb3a7512c33e..0a22a2faf552 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -179,19 +179,21 @@ nlm_delete_file(struct nlm_file *file) static int nlm_unlock_files(struct nlm_file *file) { struct file_lock lock; - struct file *f; + locks_init_lock(&lock); lock.fl_type = F_UNLCK; lock.fl_start = 0; lock.fl_end = OFFSET_MAX; - for (f = file->f_file[0]; f <= file->f_file[1]; f++) { - if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) { - pr_warn("lockd: unlock failure in %s:%d\n", - __FILE__, __LINE__); - return 1; - } - } + if (file->f_file[O_RDONLY] && + vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL)) + goto out_err; + if (file->f_file[O_WRONLY] && + vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL)) + goto out_err; return 0; +out_err: + pr_warn("lockd: unlock failure in %s:%d\n", __FILE__, __LINE__); + return 1; } /* |
