Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2009 12:43:16 +0300
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        freebsd-fs@FreeBSD.org
Subject:   Re: VOP_WRITE & read-only file system
Message-ID:  <20090619094316.GA805@a91-153-125-115.elisa-laajakaista.fi>
In-Reply-To: <20090527150258.GA3666@a91-153-125-115.elisa-laajakaista.fi>
References:  <20090527150258.GA3666@a91-153-125-115.elisa-laajakaista.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2009-05-27, Jaakko Heinonen wrote:
> I found a few ways to get VOP_WRITE called for a read-only system.
> 
> Ways I found:
> 
> 1) mmap(2)
> 
> 2) ktrace(2)
>   - start ktracing a process
>   - remount file-system as read-only

While kib@ has a patch for mmap(2) I took a look at ktrace(2). ktrace
too has a problem with writecount. ktrace uses vn_open() to open the
trace file but immediately after that it calls vn_close() which
decreases the writecount. As far as I can tell it does this because the
same vnode may be associated with several processes and there is no easy
and efficient way to know when it is disassociated from last process.

Ideas how to fix it? Some thoughts:

- Fiddle with writecount. IMHO it wouldn't fix the real bug (write
  after vn_close()).
- Walk through all processes when disconnecting a vnode from process to
  find out if it was the last process using the vnode. Inefficient.
- Keep track of vnodes which are used for tracing and have reference
  count for them.

-- 
Jaakko



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