Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2009 20:29:43 +0300
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: VOP_WRITE & read-only file system
Message-ID:  <20090528172943.GA3859@a91-153-125-115.elisa-laajakaista.fi>
In-Reply-To: <20090527153543.GK1927@deviant.kiev.zoral.com.ua>
References:  <20090527150258.GA3666@a91-153-125-115.elisa-laajakaista.fi> <20090527153543.GK1927@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090528172943.GA3859>