]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd: ensure that delegation stateid hash references are only put once
authorJeff Layton <jlayton@poochiereds.net>
Mon, 24 Aug 2015 16:41:48 +0000 (12:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 17:26:08 +0000 (19:26 +0200)
commitea056d3d54709b92498af8f8b7175ca2e9e02980
treee1f1c4958565591349cd712afcd8df118770bb20
parent0940ed480a9e75bddcfa7c2d7e42411b08514534
nfsd: ensure that delegation stateid hash references are only put once

commit 3fcbbd244ed1d20dc0eb7d48d729503992fa9b7d upstream.

It's possible that a DELEGRETURN could race with (e.g.) client expiry,
in which case we could end up putting the delegation hash reference more
than once.

Have unhash_delegation_locked return a bool that indicates whether it
was already unhashed. In the case of destroy_delegation we only
conditionally put the hash reference if that returns true.

The other callers of unhash_delegation_locked call it while walking
list_heads that shouldn't yet be detached. If we find that it doesn't
return true in those cases, then throw a WARN_ON as that indicates that
we have a partially hashed delegation, and that something is likely very
wrong.

Tested-by: Andrew W Elble <aweits@rit.edu>
Tested-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4state.c