Re: [PATCH 01/19] nfs/localio: fix nfsd_file ref leak on nfs_local_doio() init failure
From: Chuck Lever
Date: Wed Jun 10 2026 - 10:10:27 EST
On Tue, Jun 9, 2026, at 1:47 PM, Jeff Layton wrote:
> Two early return paths in nfs_local_doio() fail to release the localio
> (nfsd_file) reference passed in by the caller:
>
> - When hdr->args.count is zero, the function returns 0 without calling
> nfs_local_file_put().
>
> - When nfs_local_iocb_init() fails (e.g. -ENOMEM from allocation or
> -EOPNOTSUPP if the file lacks read_iter/write_iter), the function
> returns the error without releasing localio or completing the hdr
> lifecycle.
>
> A leaked nfsd_file pins the associated net namespace reference,
> blocking network namespace teardown, and holds a reference on the
> exported filesystem, preventing unmount.
>
> Fix the zero-count path by adding the missing nfs_local_file_put()
> call. Fix the iocb init failure path by jumping to a new cleanup label
> that releases localio, sets hdr->task.tk_status, and calls
> nfs_local_hdr_release() -- matching the existing error handling pattern
> for the post-iocb error path.
>
> Fixes: e77c464c31b3 ("nfs/nfsd: add "local io" support")
I don't seem to have commit e77c464c31b3 in my tree. Should this be
Fixes: 70ba381e1a43 ("nfs: add LOCALIO support")
?
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> fs/nfs/localio.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
This updates only a client-side source file. Should it go through
Anna/Trond's trees? Or were you thinking that, since the leak
impacts only NFS server behavior, I should take it?
--
Chuck Lever