Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Dec 2004 17:04:38 +0100
From:      =?ISO-8859-1?Q?Jean-S=E9bastien_P=E9dron?= <jspedron@club-internet.fr>
To:        Doug Barton <DougB@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: panic: Inconsistent vnode bufstrategy
Message-ID:  <41B48316.90004@club-internet.fr>
In-Reply-To: <20041204163103.M787@cp254-91.vpnaapncrgbja.pb.mn>
References:  <20041204163103.M787@cp254-91.vpnaapncrgbja.pb.mn>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig3A01D74E1A78B7D4415D521F
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Doug Barton wrote:
> I'm using mount_ntfs to read data off my winxp partition on a dual boot 
> system. For a week or so I've been getting a panic, which I've finally 
> been able to get a dump for:
> 
> [stack trace]

I get exactly the same panic() with NTFS and ReiserFS.

I think it's related with phk's commit about:
"Make VOP_BMAP return a struct bufobj for the underlying storage device
instead of a vnode for it." (dated Mon Nov 15 09:18:26 2004 UTC)

The panic() occurs with mmap(2), for example while cp(1)'ing files 
smaller than 8 MB.

In file systems like ufs, msdosfs or ext2fs, VOP_BMAP will do:
	*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj;
So the vm will call the device bo_strategy callback, and everything works.

In NTFS, VOP_BMAP is different:
	*ap->a_bop = &ap->a_vp->v_bufobj;
The goal is that the vm should call the file system's VOP_STRATEGY, not 
the device directly (that's what I guess, I'm not familiar with this fs :-).

Here is what I understand in the code, when the vm read a page:
1) vnode_pager_generic_getpages prepare a new struct buf *bp 
(sys/vm/vnode_pager.c:817) and, twice, will KASSERT() that bp->b_vp is 
NULL (in initpbuf, called by getpbuf, and in pbgetbo).
2) in pbgetbo, bp->b_bufobj = bo (bo is "returned" by file system's 
VOP_BMAP; see the "*ap->a_bop = ..." lines above)
2) vnode_pager_generic_getpages call bstrategy, which in turn call 
bp->b_bufobj->bo_ops->bop_strategy(). For NTFS, the callback is 
bufstrategy (sys/kern/vfs_bio.c:3826)
3) in bufstrategy, KASSERT(bp->b_vp == bo->bo_private, ("Inconsistent 
vnode bufstrategy")); but bp->b_vp is NULL.

In ReiserFS, because small files are not 512b-aligned on the device and 
the vm must call the fs' VOP_STRATEGY, I did the same thing in VOP_BMAP, 
which triggered this panic().

Cc'd to phk, he surely know the internals better than me :-)

Jean-Seb

--------------enig3A01D74E1A78B7D4415D521F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBtIMea+xGJsFYOlMRAmPkAJ9pTEslqM83G0D/W0avM8OzfKlAawCfelA2
jHLFfpaiW5h2CfadoYhuG1g=
=h6t5
-----END PGP SIGNATURE-----

--------------enig3A01D74E1A78B7D4415D521F--



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