]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds
authorScott Mayhew <smayhew@redhat.com>
Fri, 15 Dec 2017 21:12:32 +0000 (16:12 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 22 Feb 2018 14:15:51 +0000 (08:15 -0600)
commitc289da5c2daacc4117749b17b55cd2a1bfff1fe5
tree95d7f6b12ca73dfb615d1c4cf9258fba6754a339
parent4b9848a0ffdaa4ee68f1d47f90fe5e71a5098443
nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds

BugLink: http://bugs.launchpad.net/bugs/1751064
commit ba4a76f703ab7eb72941fdaac848502073d6e9ee upstream.

Currently when falling back to doing I/O through the MDS (via
pnfs_{read|write}_through_mds), the client frees the nfs_pgio_header
without releasing the reference taken on the dreq
via pnfs_generic_pg_{read|write}pages -> nfs_pgheader_init ->
nfs_direct_pgio_init.  It then takes another reference on the dreq via
nfs_generic_pg_pgios -> nfs_pgheader_init -> nfs_direct_pgio_init and
as a result the requester will become stuck in inode_dio_wait.  Once
that happens, other processes accessing the inode will become stuck as
well.

Ensure that pnfs_read_through_mds() and pnfs_write_through_mds() clean
up correctly by calling hdr->completion_ops->completion() instead of
calling hdr->release() directly.

This can be reproduced (sometimes) by performing "storage failover
takeover" commands on NetApp filer while doing direct I/O from a client.

This can also be reproduced using SystemTap to simulate a failure while
doing direct I/O from a client (from Dave Wysochanski
<dwysocha@redhat.com>):

stap -v -g -e 'probe module("nfs_layout_nfsv41_files").function("nfs4_fl_prepare_ds").return { $return=NULL; exit(); }'

Suggested-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Fixes: 1ca018d28d ("pNFS: Fix a memory leak when attempted pnfs fails")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/nfs/pnfs.c