1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00

Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain

NULL, but also can point to dead vnode, take that into account.

PR:		kern/132068
Reported by:	Edward Fisk" <7ogcg7g02@sneakemail.com>, kris
Fix based on patch from:	Jaakko Heinonen <jh@saunalahti.fi>
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2009-09-12 19:27:54 +00:00
parent cc5776b24d
commit 2a8e7dad33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=197131

View File

@ -890,8 +890,16 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
if (zp->z_unlinked) {
err = ENOENT;
} else {
if (ZTOV(zp) != NULL)
VN_HOLD(ZTOV(zp));
if ((vp = ZTOV(zp)) != NULL) {
VI_LOCK(vp);
if ((vp->v_iflag & VI_DOOMED) != 0) {
VI_UNLOCK(vp);
vp = NULL;
} else
VI_UNLOCK(vp);
}
if (vp != NULL)
VN_HOLD(vp);
else {
if (first) {
ZFS_LOG(1, "dying znode detected (zp=%p)", zp);