After perusing the sources of Apple's SMB and NFS clients' implementation of VNOP_MONITOR
, my understanding of how VNOP_MONITOR+vnode_notify()
operate is as follows:
- A user-space process advertises an interest in monitoring a file or directory via
kqueue(2)/kevent(2)
. VFS
calls the filesystem's implementation ofVNOP_MONITOR
.VNOP_MONITOR
forwards the commencing or terminating of monitoring events request to the filesystem server.- Network filesystem client nodes call
vnode_notify()
to notify the underlyingVFS
of a filesystem event, e.g. file/directory creation/removal, etc.
What I'm still vague about is how does the server communicate back to client nodes that an event of interest has occurred?
I'd appreciate being enlightened on the operation of `VNOP_MONITOR+vnode_notify()' in a network filesystem setting.
I'd appreciate being enlightened on the operation of `VNOP_MONITOR+vnode_notify()' in a network filesystem setting.
So, the first thing to note here is that VNOP_MONITOR/vnode_notify are ONLY relevant to network file systems. The point of these APIs is to (try) and inform the local client of changes that happend "outside" of the VFS systems "view" but that simply does not happen in a standard, local file systems. In a local file system, all I/O goes through the VFS system, so the VFS system already "knows" everything that's happening.
What I'm still vague about is how does the server communicate back to client nodes that an event of interest has occurred?
That's entirely up to the protocol between the server and client. Often, the answer is that it doesn't, which is why I said "try" above.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware