Benjamin Coddington a54c2048cd nfsd: Fix race to FREE_STATEID and cl_revoked
commit 3b816601e279756e781e6c4d9b3f3bd21a72ac67 upstream.

We have some reports of linux NFS clients that cannot satisfy a linux knfsd
server that always sets SEQ4_STATUS_RECALLABLE_STATE_REVOKED even though
those clients repeatedly walk all their known state using TEST_STATEID and
receive NFS4_OK for all.

Its possible for revoke_delegation() to set NFS4_REVOKED_DELEG_STID, then
nfsd4_free_stateid() finds the delegation and returns NFS4_OK to
FREE_STATEID.  Afterward, revoke_delegation() moves the same delegation to
cl_revoked.  This would produce the observed client/server effect.

Fix this by ensuring that the setting of sc_type to NFS4_REVOKED_DELEG_STID
and move to cl_revoked happens within the same cl_lock.  This will allow
nfsd4_free_stateid() to properly remove the delegation from cl_revoked.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2217103
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2176575
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Cc: stable@vger.kernel.org # v4.17+
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-30 16:23:15 +02:00
..
2023-06-21 15:45:40 +02:00
2020-10-16 11:11:22 -07:00
2023-08-11 11:57:54 +02:00
2021-09-18 13:40:15 +02:00
2023-07-27 08:43:36 +02:00
2023-08-26 15:26:43 +02:00
2023-05-17 11:47:35 +02:00
2020-09-10 14:03:31 -07:00
2023-02-22 12:55:54 +01:00
2022-06-09 10:21:16 +02:00
2020-08-04 21:02:38 -04:00
2023-01-04 11:39:23 +01:00
2023-07-27 08:44:14 +02:00
2023-01-14 10:16:27 +01:00
2020-07-31 08:16:01 +02:00