On 23 Apr 2025, at 16:37, Jeff Layton wrote: > On Wed, 2025-04-23 at 15:59 -0400, Benjamin Coddington wrote: >> On 23 Apr 2025, at 15:41, Jeff Layton wrote: >> >>> On Wed, 2025-04-23 at 13:59 -0400, Benjamin Coddington wrote: >>>> @@ -10612,6 +10610,7 @@ static int nfs41_free_stateid(struct nfs_server *server, >>>> if (IS_ERR(task)) >>>> return PTR_ERR(task); >>>> rpc_put_task(task); >>>> + stateid->type = NFS4_FREED_STATEID_TYPE; >>> >>> Would it be possible to call nfs_delegation_mark_returned() at this >>> point, and skip all of the type changing? >> >> It won't because we can be here with a lock stateid or open >> stateid. >> > > Ok, I can see why you decided to do it this way, and since we already > have a REVOKED and INVALID types, adding FREED doesn't seem that bad. > > If you do go this route, then I think you also need to add the FREED > case to the switch in nfs41_test_and_free_expired_stateid(). It's a good idea, it can't hurt, but I think its not possible to end up with a delegation (or other type) that has a stateid with that type. We're just setting that type on the stack copy that we use for the test_stateid/free_stateid operation, and then its discarded. Ben