On Fri, Feb 13, 2004 at 09:49:53PM -0500, Brian F. Feldman wrote: > Andrey Simonenko <[EMAIL PROTECTED]> wrote: > > > > Is it enough to get exclusive lock on vnode, before changing > > v_op pointer? Here is my code: > > > > vn_lock(cvp->vp, LK_EXCLUSIVE | LK_RETRY, p); > > > > if (flag > 0) > > cvp->vp->v_op = catch_vnode_vnodeop_p; /* My vnodeop_p. */ > > else > > cvp->vp->v_op = cvp->vnodeop_p; /* Original v_op. */ > > > > VOP_UNLOCK(cvp->vp, 0, p); > > > > I made some tests and see that most of VOP_xxx require lock (shared > > or exclusive) on vnode, as well this is documented in the manual pages. > > No, you are not allowed to change v_op, ever. Can you do what you're trying > to do in the MAC framework? It seems like that is what you want to be > doing! The other possibility is using something like umapfs/lomacfs/ > unionfs. >
First of all thanks for your answer. I need to control activities on vnode not for protecting it from processes. I try to find a way to synchronize shared access (read, write, mmap'ed file) to existent vnode (vnode which is currently is used on home host by local processes) from process on remote hosts. This situation is like NFS, but NFS (or similar systems) has own vnode operation vector for their vnodes and can synchronize access in their VOPs. Since in my situation vnodes can have different vnode operation vectors (i.e. files can belong to different VFS) I can't set v_op for vnode when vnode is created (getnewvnode()). Having read documentation and analyzed sources, I think that MAC can't help. MAC allows to synchronize access in read() and write() syscalls, but access to VOP_GETPAGES, which is called in vm_fault() for example, can't be synchronized using MAC framework. File systems umapfs, lomacfs, unionfs also don't help. May be it is possible to do something with stackable VFS, but I haven't find a solution with stackable VFS yet. What can be broken when v_op is changed during holding exclusive lock on vnode? Does a moment when v_op is changed can cause any problems? Currently I found that nullfs and uniofs will not work if v_op is changed, because they compare v_op with their vnodeop_p. Thanks for your help again. _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"