Skip to content

Commit 91ad32f

Browse files
committed
nfs4: remove state only after successful disposal
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 (cherry picked from commit e533bf8) Signed-off-by: Tigran Mkrtchyan <[email protected]>
1 parent 81437ec commit 91ad32f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/org/dcache/nfs/v4/NFS4Client.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
2+
* Copyright (c) 2009 - 2023 Deutsches Elektronen-Synchroton,
33
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
44
*
55
* This library is free software; you can redistribute it and/or modify
@@ -318,11 +318,12 @@ public NFS4State createState(StateOwner stateOwner, NFS4State openState) throws
318318
if (openState != null) {
319319
openState.addDisposeListener(s -> {
320320
// remove and dispose derived states.
321-
NFS4State nfsState = _clientStates.remove(state.stateid());
321+
NFS4State nfsState = _clientStates.get(state.stateid());
322322
if (nfsState != null) {
323323
_log.debug("removing derived state {}", nfsState);
324324
nfsState.tryDispose();
325325
}
326+
_clientStates.remove(state.stateid());
326327
});
327328
}
328329
_clientStates.put(state.stateid(), state);

0 commit comments

Comments
 (0)