]> git.ipfire.org Git - thirdparty/kernel/stable.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:33:28 +0000 (19:33 +0200)
commit1e837cb760e8c0749055d459fbd1471a8e19a83e
treeceb97d7c6a476cfeea2ce20f615be8d7933a1e7b
parent50374a01a462f0f2ef4974f6e3a45eaed6f7297d
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