summaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2022-07-11 14:30:14 -0400
committerChuck Lever <chuck.lever@oracle.com>2022-07-11 15:49:56 -0400
commit1197eb5906a5464dbaea24cac296dfc38499cc00 (patch)
tree8c1da320d652e26007e944e2dac97ebe9b951a9a /fs/lockd
parentaec158242b87a43d83322e99bc71ab4428e5ab79 (diff)
downloadlinux-1197eb5906a5464dbaea24cac296dfc38499cc00.tar.bz2
lockd: fix nlm_close_files
This loop condition tries a bit too hard to be clever. Just test for the two indices we care about explicitly. 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>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/svcsubs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index b2f277727469..e1c4617de771 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -283,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file)
static void nlm_close_files(struct nlm_file *file)
{
- struct file *f;
-
- for (f = file->f_file[0]; f <= file->f_file[1]; f++)
- if (f)
- nlmsvc_ops->fclose(f);
+ if (file->f_file[O_RDONLY])
+ nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
+ if (file->f_file[O_WRONLY])
+ nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
}
/*