Skip to content

Commit 1197eb5

Browse files
jtlaytonchucklever
authored andcommitted
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: 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 aec1582 commit 1197eb5

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

fs/lockd/svcsubs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,10 @@ nlm_file_inuse(struct nlm_file *file)
283283

284284
static void nlm_close_files(struct nlm_file *file)
285285
{
286-
struct file *f;
287-
288-
for (f = file->f_file[0]; f <= file->f_file[1]; f++)
289-
if (f)
290-
nlmsvc_ops->fclose(f);
286+
if (file->f_file[O_RDONLY])
287+
nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
288+
if (file->f_file[O_WRONLY])
289+
nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
291290
}
292291

293292
/*

0 commit comments

Comments
 (0)