Skip to content

Commit

Permalink
nfs4: remove state only after successful disposal
Browse files Browse the repository at this point in the history
Motivation:
When client disposes client state, for example open state on close, then
some child states might fail to release resources and force a client to
retry the request. However, if state is not associated with the
NFSClient, then retry will fail with BAD_STATETID.

Modification:
Remove state only after successful disposal.

Result:
Fix BAD_STATETID error on in case of nested states (delegation, lock,
layout)

Acked-by: Paul Millar
Target: master, 0.24, 0.23
  • Loading branch information
kofemann committed Mar 28, 2023
1 parent 89df15c commit e533bf8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/dcache/nfs/v4/NFS4Client.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2023 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -328,11 +328,12 @@ public NFS4State createState(StateOwner stateOwner, NFS4State openState) throws
if (openState != null) {
openState.addDisposeListener(s -> {
// remove and dispose derived states.
NFS4State nfsState = _clientStates.remove(state.stateid());
NFS4State nfsState = _clientStates.get(state.stateid());
if (nfsState != null) {
_log.debug("removing derived state {}", nfsState);
nfsState.tryDispose();
}
_clientStates.remove(state.stateid());
});
}
_clientStates.put(state.stateid(), state);
Expand Down

0 comments on commit e533bf8

Please sign in to comment.