Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2009 21:25:22 +0300
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        freebsd-fs@FreeBSD.org
Subject:   Re: VOP_WRITE & read-only file system
Message-ID:  <20090714182522.GA40040@a91-153-125-115.elisa-laajakaista.fi>
In-Reply-To: <20090619094316.GA805@a91-153-125-115.elisa-laajakaista.fi>
References:  <20090527150258.GA3666@a91-153-125-115.elisa-laajakaista.fi> <20090619094316.GA805@a91-153-125-115.elisa-laajakaista.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2009-06-19, Jaakko Heinonen wrote:
> > I found a few ways to get VOP_WRITE called for a read-only system.
> > 
> > 2) ktrace(2) - start ktracing a process - remount file-system as
> > read-only
> 
> 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.

I wrote a couple of patches for ktrace(2).

> - Fiddle with writecount. IMHO it wouldn't fix the real bug (write
> after vn_close()).

http://www.saunalahti.fi/~jh3/patches/ktrace-writecount.diff

The patch just increases v_writecount for trace file vnodes. It's quite
straightforward and fixes the problem at hand but writes will still
happen after vn_close()/VOP_CLOSE().

> - Keep track of vnodes which are used for tracing and have reference
> count for them.

http://www.saunalahti.fi/~jh3/patches/ktrace-vn_close.diff

The patch uses a list to keep track of trace files. A file is closed
when reference count hits zero. I am slightly concerned about
scalability of the list approach but otherwise this should be more
complete fix.

-- 
Jaakko



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