]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Account the writeable shared mappings backed by file in the vnode
authorKonstantin Belousov <kib@FreeBSD.org>
Thu, 23 Feb 2012 21:07:16 +0000 (21:07 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Thu, 23 Feb 2012 21:07:16 +0000 (21:07 +0000)
commit84110e7e0b36f52ca11a51cf79cde0932905a9d7
tree9d31f51a13c9699dab2dae074d2eac6a044b601d
parent47190ea66488ce2ba55243387f8a36ad1ea2defe
Account the writeable shared mappings backed by file in the vnode
v_writecount.  Keep the amount of the virtual address space used by
the mappings in the new vm_object un_pager.vnp.writemappings
counter. The vnode v_writecount is incremented when writemappings gets
non-zero value, and decremented when writemappings is returned to
zero.

Writeable shared vnode-backed mappings are accounted for in vm_mmap(),
and vm_map_insert() is instructed to set MAP_ENTRY_VN_WRITECNT flag on
the created map entry.  During deferred map entry deallocation,
vm_map_process_deferred() checks for MAP_ENTRY_VN_WRITECOUNT and
decrements writemappings for the vm object.

Now, the writeable mount cannot be demoted to read-only while
writeable shared mappings of the vnodes from the mount point
exist. Also, execve(2) fails for such files with ETXTBUSY, as it
should be.

Noted by: tegge
Reviewed by: tegge (long time ago, early version), alc
Tested by: pho
MFC after: 3 weeks
sys/vm/vm_map.c
sys/vm/vm_map.h
sys/vm/vm_mmap.c
sys/vm/vm_object.h
sys/vm/vnode_pager.c
sys/vm/vnode_pager.h