diff --git a/core/src/main/java/org/dcache/nfs/v4/NFS4Client.java b/core/src/main/java/org/dcache/nfs/v4/NFS4Client.java index eb741913..58680d6e 100644 --- a/core/src/main/java/org/dcache/nfs/v4/NFS4Client.java +++ b/core/src/main/java/org/dcache/nfs/v4/NFS4Client.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2020 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 @@ -318,11 +318,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);