Date: Mon, 23 Feb 2004 11:59:17 +0200 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: "Brian F. Feldman" <green@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Changing v_op for vnode on the fly Message-ID: <20040223095917.GA5461@pm514-9.comsys.ntu-kpi.kiev.ua> In-Reply-To: <200402161848.i1GImJIg075442@green.homeunix.org> References: <20040216130958.GC304@pm514-9.comsys.ntu-kpi.kiev.ua> <200402161848.i1GImJIg075442@green.homeunix.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 16, 2004 at 01:48:19PM -0500, Brian F. Feldman wrote: > > 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. > > Well, there is the ability to prevent the mmap(2) in the first place using > mac_check_vnode_mmap(). Is that close to sufficient for those purposes? This is not enough, because I need to synchronize access in VOP_GETPAGES on remote system to vnode (content of a file) on its home system. > > > 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. > > Try to look closer at them; I think it's possible to do a lot of what you > want because the initial LOMAC implementation for FreeBSD, before the MAC > framework existed, did just such a thing. I looked at sources of lomacfs (initial implementation), nullfs and unionfs in 4.x and 5.x, I have to say that not everything clear for me, especially locking and unlocking in top layer and lower layer. Now I understand that changing v_op is not a right way to do what I want. It seems that stackable VFS is what is needed for my purpose. I created stackable VFS and put it on top of the directory, in which files are expected to be shared via network, if some process opens and then modifies files in this directory, then each VOP_* will be caught by my top VFS layer. I didn't check, but it also seems that mmap'ed files also will work, because of VOP_{CREATE|GET|DESTROY}VOBJECT calls usage. I only loose synchronization if some process opened files before top VFS layer is installed and this process will use original vnode (which is lower vnode for top VFS layer). Since top VFS layer completely hides lower layer (there is no separate mount point), then any process always will call VOP_* for top VFS layer, as I understand lomacfs works in this way. Thanks for your help again.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040223095917.GA5461>