nfs4j icon indicating copy to clipboard operation
nfs4j copied to clipboard

Missing callback for OP_CLOSE in VirtualFileSystem

Open dkocher opened this issue 9 years ago • 2 comments

I am missing a notification in the virtual filesystem for CLOSE operations. Would be nice if the VirtualFileSystem can be extended with a close operation that is called from org.dcache.nfs.v4.OperationCLOSE.

dkocher avatar Jul 18 '16 13:07 dkocher

As client can merge multiple opens into a single one you must bind your close action to open-state-id, which on dispose will call-back your onClose action.. By saying that I am pretty sure nfs4j does not provides a way to create such a binding. One possibility will be to extend CLOSE and OPEN operations and add required functionality. For example:

https://github.com/dCache/dcache/blob/master/modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door/proxy/ProxyIoClose.java

https://github.com/dCache/dcache/blob/master/modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door/proxy/ProxyIoMdsOpFactory.java

As you have a valid use-case, I am fine to add a functionality which will make tracking of open+close operation simple. Can you provide a little bit more context?

kofemann avatar Jul 18 '16 21:07 kofemann

The context is as follows (sorry for asking for a solution instead of describing the problem): The implementation of the virtual filesystem handles a persistent connection for open files with java.io.* with an open output or input stream while a write or read operation is in progress. Therefore it is crucial to close the underlying stream once a CLOSE operation is received to flush the changes. We are looking to replace our current NFSv3 implementation in Mountain Duck with nfs4j.

dkocher avatar Jul 19 '16 12:07 dkocher