summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-11-14 08:23:13 +0000
committerdas <das@FreeBSD.org>2003-11-14 08:23:13 +0000
commit6a3319096af331c50107548786698c5b28f370d6 (patch)
treecbcf80f7de8165e70e8591510ede377c9831f909 /sys/fs/unionfs
parent9b4ee6c4ddb9593d2d3354ef03e068820d52cc5f (diff)
downloadFreeBSD-src-6a3319096af331c50107548786698c5b28f370d6.zip
FreeBSD-src-6a3319096af331c50107548786698c5b28f370d6.tar.gz
- A sanity check in unionfs verifies that lookups of '.' return the
vnode of the parent. However, this check should not be performed if the lookup failed. This change should fix "union_lookup returning . not same as startdir" panics people were seeing. The bug was introduced by an incomplete import of a NetBSD delta in rev 1.38. - Move the aforementioned check out from DIAGNOSTIC. Performance is the least of our unionfs worries. - Minor reorganization. PR: 53004 MFC after: 1 week
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r--sys/fs/unionfs/union_vnops.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 356b861..e9449ad 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -583,36 +583,30 @@ out:
((*ap->a_vpp) ? vrefcnt(*ap->a_vpp) : -99),
lowervp, uppervp));
- /*
- * dvp lock state, determine whether to relock dvp. dvp is expected
- * to be locked on return if:
- *
- * - there was an error (except not EJUSTRETURN), or
- * - we hit the last component and lockparent is true
- *
- * dvp_is_locked is the current state of the dvp lock, not counting
- * the possibility that *ap->a_vpp == dvp (in which case it is locked
- * anyway). Note that *ap->a_vpp == dvp only if no error occured.
- */
-
- if (*ap->a_vpp != dvp) {
- if ((error == 0 || error == EJUSTRETURN) &&
- (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)) {
- VOP_UNLOCK(dvp, 0, td);
+ if (error == 0 || error == EJUSTRETURN) {
+ /*
+ * dvp lock state, determine whether to relock dvp.
+ * We are expected to unlock dvp unless:
+ *
+ * - there was an error (other than EJUSTRETURN), or
+ * - we hit the last component and lockparent is true
+ */
+ if (*ap->a_vpp != dvp) {
+ if (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)
+ VOP_UNLOCK(dvp, 0, td);
}
- }
-
- /*
- * Diagnostics
- */
-#ifdef DIAGNOSTIC
- if (cnp->cn_namelen == 1 &&
- cnp->cn_nameptr[0] == '.' &&
- *ap->a_vpp != dvp) {
- panic("union_lookup returning . (%p) not same as startdir (%p)", ap->a_vpp, dvp);
- }
+ if (cnp->cn_namelen == 1 &&
+ cnp->cn_nameptr[0] == '.' &&
+ *ap->a_vpp != dvp) {
+#ifdef DIAGNOSTIC
+ vprint("union_lookup: vp", *ap->a_vpp);
+ vprint("union_lookup: dvp", dvp);
#endif
+ panic("union_lookup returning . (%p) != startdir (%p)",
+ *ap->a_vpp, dvp);
+ }
+ }
return (error);
}
OpenPOWER on IntegriCloud