Request to Manage Open Files
Problem: currently OFS is not Posix compliant in that if a file is unlinked while open by another process, the process with the file open sees the file "disappear." According to Posix the file should remain, from the perspective of the process that has it open, until closed, at which point it is removed. OFS can't do this primarily because there are no open or closed requests at the server.
A solution is to provide a "cooperative" mechanism - one that requires the client to follow a protocol. In this case we can use two attributes, one to keep a count of the number of processes that have a file open, and one to indicate that a process has requested the file be deleted. Each process upon looking up a file would first check to see if the file is marked deleted, and if so treat it as "not found." Otherwise it would increment the count. On close the count would be decremented, and if decremented to zero, the client would check oif the file is marked for deletion, and if so, unlink it.
The problem with this solution is that these protocols are not atomic. Thus, the project is to create a server request that takes a handle, appropriate capabilities, and an op one of open, close, unlink. The server would ensure that one on of these requests is performed on a given metadata object, thus ensuring atomicity. The server would perform the attribute lookup, modification, and storage as per the protocol and return a code indicating the status to the caller. The caller would be responsible for abiding by the return code (the cooperative part).
Where appropriate (in the user direct interface, for example) flags to open can be used to bypass this mechanism. This mechanism involves creating shared state that can easily by left inconsistent - if a client opens a file and they dies without closing. Mechanisms to mitigate need research, but could include timeouts, manual resetting of state, etc. The mechanism could be designed to operate within a context - IOW, only processes using the same context id would be blocked.