Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2011 12:04:41 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Rick Macklem <rmacklem@uoguelph.ca>
Cc:        FreeBSD FS <freebsd-fs@freebsd.org>
Subject:   Re: Does msodsfs_readdir() require a exclusively locked vnode
Message-ID:  <20110726090441.GD17489@deviant.kiev.zoral.com.ua>
In-Reply-To: <2086374310.991475.1311636160720.JavaMail.root@erie.cs.uoguelph.ca>
References:  <2086374310.991475.1311636160720.JavaMail.root@erie.cs.uoguelph.ca>

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

--6iAIcqJi9p/aaN8Y
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 25, 2011 at 07:22:40PM -0400, Rick Macklem wrote:
> Hi,
>=20
> Currently both NFS servers set the vnode lock LK_SHARED
> and so do the local syscalls (at least that's how it looks
> by inspection?).
>=20
> Peter Holm just posted me this panic, where a test for an
> exclusive vnode lock fails in msdosfs_readdir().
> KDB: stack backtrace:
> db_trace_self_wrapper(c0efa6f6,c71627f8,c79230b0,c0f2ef29,f19154b8,...) a=
t db_trace_self_wrapper+0x26
> kdb_backtrace(c7f20b38,f19154fc,c0d586d5,f191550c,c7f20ae0,...) at kdb_ba=
cktrace+0x2a
> vfs_badlock(c101b180,f191550c,c1055580,c7f20ae0) at vfs_badlock+0x23
> assert_vop_elocked(c7f20ae0,c0ee5f4f,c09f3213,8,0,...) at assert_vop_eloc=
ked+0x55
> pcbmap(c7966e00,0,f191560c,f1915618,f191561c,...) at pcbmap+0x45
> msdosfs_readdir(f1915960,c0f4b343,c7f20ae0,f1915940,0,...) at msdosfs_rea=
ddir+0x528
> VOP_READDIR_APV(c101b180,f1915960,2,f1915a68,c7923000,...) at VOP_READDIR=
_APV+0xc5
> nfsrvd_readdir(f1915b64,0,c7f20ae0,c7923000,f1915a68,...) at nfsrvd_readd=
ir+0x38e
> nfsrvd_dorpc(f1915b64,0,c7923000,c842a200,4,...) at nfsrvd_dorpc+0x1f79
> nfssvc_program(c7793800,c842a200,c0f24d67,492,0,...) at nfssvc_program+0x=
40f
> svc_run_internal(f1915d14,c09d9a98,c73dfa80,f1915d28,c0ef1130,...) at svc=
_run_internal+0x952
> svc_thread_start(c73dfa80,f1915d28,c0ef1130,3a5,c7e4b2c0,...) at svc_thre=
ad_start+0x10
> fork_exit(c0bed7d0,c73dfa80,f1915d28) at fork_exit+0xb8
> fork_trampoline() at fork_trampoline+0x8
> --- trap 0x804c12e, eip =3D 0xc, esp =3D 0x33, ebp =3D 0x1 ---
> pcbmap: 0xc7f20ae0 is not exclusive locked but should be
> KDB: enter: lock violation
>=20
> So, does anyone know if the msdosfs_readdir() really requires a LK_EXCLUS=
IVE
> locked vnode or is the ASSERT_VOP_ELOCKED() too strong in pcbmap()?

Yes, msdosfs currently requires all vnode locks to be exclusive. One of
the reasons is that each denode (the msdosfs-private vnode data) carries
the fat entries cache, and this cache is updated even by the operations
that do not modify vnode from the VFS POV.

The locking regime is enforced by the getnewvnode() initializing the vnode
lock with LK_NOSHARE flag, and msdosfs code not calling VN_LOCK_ASHARE()
on the newly instantiated vnode.

My question is, was the vnode in question locked at all ?

--6iAIcqJi9p/aaN8Y
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk4ugykACgkQC3+MBN1Mb4hh2ACfS72MfHc6jb7XUh7FsaqkV8py
0lsAn1QwwRgW1mdqjxD5ACBsWz35fci2
=/7qP
-----END PGP SIGNATURE-----

--6iAIcqJi9p/aaN8Y--



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