NFSv4: Fix state reference counting in _nfs4_opendata_reclaim_to_nfs4_state
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 28 Oct 2013 18:57:12 +0000 (14:57 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 19:11:49 +0000 (11:11 -0800)
commit1311157d8407d16b8543c2286f0e95251ca04fe8
tree20e3a394619fb0f1a5fee5073dbe5b8b840a6ff3
parent231817ee68a9640d91ef34ce12c4d67b38f17ed8
NFSv4: Fix state reference counting in _nfs4_opendata_reclaim_to_nfs4_state

commit d49f042aeec99c5f87160bb52dd52088b1051311 upstream.

Currently, if the call to nfs_refresh_inode fails, then we end up leaking
a reference count, due to the call to nfs4_get_open_state.
While we're at it, replace nfs4_get_open_state with a simple call to
atomic_inc(); there is no need to do a full lookup of the struct nfs_state
since it is passed as an argument in the struct nfs4_opendata, and
is already assigned to the variable 'state'.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs4proc.c