VOP_WRITE & read-only file system

Jaakko Heinonen jh at saunalahti.fi
Thu May 28 17:29:48 UTC 2009


Hi,

On 2009-05-27, Kostik Belousov wrote:
> > 1) mmap(2)
> >   - mmap(2) a file
> >   - close(2) the file handle
> >   - remount file-system as read-only
> >   - modify mapped memory

> Yes, the issue is there. Real cause for the problem is that mmap() does
> not increment v_writecnt of the vnode that backs shared writable mappings.
> 
> I have a patch that fixes this, see
> http://people.freebsd.org/~kib/misc/vm_map_delete.3.patch

The patch seems to have a problem with forced remount or unmount. After
a forced remount to read-only munmap(2) crashes in _vm_map_unlock()
due to NULL vp.

#12 0xc08f0cb3 in _vn_lock (vp=0x0, flags=525312, 
    file=0xc0c55e8f "/home/jaakko/src/head/sys/vm/vm_map.c", line=494)
    at vnode_if.h:830
#13 0xc0a8cb4f in _vm_map_unlock (map=0xc634f000, process_freelist=1, 
    file=0xc0c56902 "/home/jaakko/src/head/sys/vm/vm_mmap.c", line=597)
    at /home/jaakko/src/head/sys/vm/vm_map.c:494
#14 0xc0a91d98 in munmap (td=0xc5a996c0, uap=0xf480ecf8)
    at /home/jaakko/src/head/sys/vm/vm_mmap.c:597
#15 0xc0b637b3 in syscall (frame=0xf480ed38)
    at /home/jaakko/src/head/sys/i386/i386/trap.c:1073
#16 0xc0b46a10 in Xint0x80_syscall ()
    at /home/jaakko/src/head/sys/i386/i386/exception.s:261

> During remount rw->ro or unmount, UFS filesystem is suspended, see
> r183074.

Thanks for the pointer.

-- 
Jaakko


More information about the freebsd-fs mailing list