kern/132068: [zfs] page fault when using ZFS over NFS on
7.1-RELEASE/amd64
Jaakko Heinonen
jh at saunalahti.fi
Fri Apr 10 04:50:05 PDT 2009
The following reply was made to PR kern/132068; it has been noted by GNATS.
From: Jaakko Heinonen <jh at saunalahti.fi>
To: Edward Fisk <7ogcg7g02 at sneakemail.com>
Cc: bug-followup at FreeBSD.org, Weldon Godfrey <wgodfrey at ena.com>
Subject: Re: kern/132068: [zfs] page fault when using ZFS over NFS on
7.1-RELEASE/amd64
Date: Fri, 10 Apr 2009 14:46:02 +0300
On 2009-03-26, Jaakko Heinonen wrote:
> I now know what is going on. The vnode may be reclaimed during
> zfs_zget() because it doesn't hold the vnode lock (except when a new
> znode is created).
OK, I have now put together a patch which should avoid the original
panic you reported. The same panic was also reported by Weldon Godfrey
(Cc'd) on -fs:
http://lists.freebsd.org/pipermail/freebsd-fs/2008-August/004998.html
--- patch begins here ---
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (revision 190593)
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (working copy)
@@ -890,8 +890,9 @@ again:
if (zp->z_unlinked) {
err = ENOENT;
} else {
- if (ZTOV(zp) != NULL)
- VN_HOLD(ZTOV(zp));
+ vp = ZTOV(zp);
+ if (vp != NULL)
+ VN_HOLD(vp);
else {
if (first) {
ZFS_LOG(1, "dying znode detected (zp=%p)", zp);
@@ -907,12 +908,25 @@ again:
tsleep(zp, 0, "zcollide", 1);
goto again;
}
- *zpp = zp;
err = 0;
}
dmu_buf_rele(db, NULL);
mutex_exit(&zp->z_lock);
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
+ if (err == 0) {
+ /*
+ * Check if we lost lost race against reclaim.
+ */
+ VI_LOCK(vp);
+ if (vp->v_iflag & VI_DOOMED) {
+ VI_UNLOCK(vp);
+ VN_RELE(vp);
+ ZFS_LOG(1, "doomed vnode detected (zp=%p)", zp);
+ goto again;
+ }
+ VI_UNLOCK(vp);
+ *zpp = zp;
+ }
return (err);
}
--- patch ends here ---
The fix isn't perfect. Vnodes may be still reclaimed during zfs_zget()
in forced unmount case. However zfs doesn't support forced unmounts at
all right now. The patch is againt 8.0-CURRENT.
--
Jaakko
More information about the freebsd-fs
mailing list