Skip to content

Commit 98033b3

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 483494e commit 98033b3

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 - 2022 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
@@ -328,11 +328,12 @@ public NFS4State createState(StateOwner stateOwner, NFS4State openState) throws
328328
if (openState != null) {
329329
openState.addDisposeListener(s -> {
330330
// remove and dispose derived states.
331-
NFS4State nfsState = _clientStates.remove(state.stateid());
331+
NFS4State nfsState = _clientStates.get(state.stateid());
332332
if (nfsState != null) {
333333
_log.debug("removing derived state {}", nfsState);
334334
nfsState.tryDispose();
335335
}
336+
_clientStates.remove(state.stateid());
336337
});
337338
}
338339
_clientStates.put(state.stateid(), state);

0 commit comments

Comments
 (0)