Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Mar 2006 15:45:43 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   vn_lock(9)' LK_UPGRADE|LK_RETRY safety
Message-ID:  <20060302134543.GA37572@deviant.kiev.zoral.com.ua>

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

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

Assume that thread owns LK_SHARED lock on vnode vp, and the call
vn_lock(vp, LK_UPGRADE|LK_RETRY, curthread) is made. Is this upgrade
safe from dropping shared lock during the retries made in vn_lock ?

Man page for lockmgr says that failed LK_UPGRADE request
returns with shared lock dropped. But, from the review
of the code for lockmgr() and esp. acquire(), it seems
that it is impossible to get error (due to absence of LK_NOWAIT
and empty flags & zero timeout for msleep). Consequently,
it seems that shared lock will not be dropped. Is this true ?

Anyway, for instance, lookup(9) (sys/kern/vfs_lookup.c, line 552,
rev. 1.88) uses such call and does not check for errors.=20

Best regards,
Kostik Belousov

--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFEBvcGC3+MBN1Mb4gRAm7GAJ4taL/MejA2sfrng78wYl7tdbA2ZgCfSiDU
HDfIKVAQVC1qDzEXQnRg/v8=
=Wr8J
-----END PGP SIGNATURE-----

--6TrnltStXW4iwmi0--



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