diff options
author | kib <kib@FreeBSD.org> | 2012-02-23 21:07:16 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-02-23 21:07:16 +0000 |
commit | f315a59476bc5812458ae81c8b4eb4c37f8a3aea (patch) | |
tree | 9d31f51a13c9699dab2dae074d2eac6a044b601d /sys/vm/vm_map.h | |
parent | dc536a5db9b7b0b09ddaf1d12a42331848272300 (diff) | |
download | FreeBSD-src-f315a59476bc5812458ae81c8b4eb4c37f8a3aea.zip FreeBSD-src-f315a59476bc5812458ae81c8b4eb4c37f8a3aea.tar.gz |
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
Diffstat (limited to 'sys/vm/vm_map.h')
-rw-r--r-- | sys/vm/vm_map.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 11ff632..0b7fdf9 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -139,6 +139,7 @@ struct vm_map_entry { #define MAP_ENTRY_GROWS_UP 0x2000 /* Bottom-up stacks */ #define MAP_ENTRY_WIRE_SKIPPED 0x4000 +#define MAP_ENTRY_VN_WRITECNT 0x8000 /* writeable vnode mapping */ #ifdef _KERNEL static __inline u_char @@ -315,6 +316,7 @@ long vmspace_wired_count(struct vmspace *vmspace); #define MAP_DISABLE_SYNCER 0x0020 #define MAP_DISABLE_COREDUMP 0x0100 #define MAP_PREFAULT_MADVISE 0x0200 /* from (user) madvise request */ +#define MAP_VN_WRITECOUNT 0x0400 #define MAP_STACK_GROWS_DOWN 0x1000 #define MAP_STACK_GROWS_UP 0x2000 #define MAP_ACC_CHARGED 0x4000 |