summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbp <bp@FreeBSD.org>2001-05-17 04:58:25 +0000
committerbp <bp@FreeBSD.org>2001-05-17 04:58:25 +0000
commitd0e9de09009e42b055519d6f84f39664cc3ca496 (patch)
tree4f2dd19be854ea8ff48e2e7cbaf9c113e6fa047f /sys
parent61ab4d4ff9c07e0bd5afbcf54f3dadc84de11c31 (diff)
downloadFreeBSD-src-d0e9de09009e42b055519d6f84f39664cc3ca496.zip
FreeBSD-src-d0e9de09009e42b055519d6f84f39664cc3ca496.tar.gz
VOP getwritemount() can be invoked on vnodes with VFREE flag set (used in
snapshots code). At this point upper vp may not exist.
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/unionfs/union_vnops.c16
-rw-r--r--sys/miscfs/union/union_vnops.c16
2 files changed, 24 insertions, 8 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index ec72244..93922ec 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -1620,11 +1620,19 @@ union_getwritemount(ap)
struct mount **a_mpp;
} */ *ap;
{
- struct vnode *vp = UPPERVP(ap->a_vp);
+ struct vnode *vp = ap->a_vp;
+ struct vnode *uvp = UPPERVP(vp);
- if (vp == NULL)
- panic("union: missing upper layer in getwritemount");
- return(VOP_GETWRITEMOUNT(vp, ap->a_mpp));
+ if (uvp == NULL) {
+ VI_LOCK(vp);
+ if (vp->v_flag & VFREE) {
+ VI_UNLOCK(vp);
+ return (EOPNOTSUPP);
+ }
+ VI_UNLOCK(vp);
+ panic("union_getwritemount: missing upper layer");
+ }
+ return(VOP_GETWRITEMOUNT(uvp, ap->a_mpp));
}
/*
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index ec72244..93922ec 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -1620,11 +1620,19 @@ union_getwritemount(ap)
struct mount **a_mpp;
} */ *ap;
{
- struct vnode *vp = UPPERVP(ap->a_vp);
+ struct vnode *vp = ap->a_vp;
+ struct vnode *uvp = UPPERVP(vp);
- if (vp == NULL)
- panic("union: missing upper layer in getwritemount");
- return(VOP_GETWRITEMOUNT(vp, ap->a_mpp));
+ if (uvp == NULL) {
+ VI_LOCK(vp);
+ if (vp->v_flag & VFREE) {
+ VI_UNLOCK(vp);
+ return (EOPNOTSUPP);
+ }
+ VI_UNLOCK(vp);
+ panic("union_getwritemount: missing upper layer");
+ }
+ return(VOP_GETWRITEMOUNT(uvp, ap->a_mpp));
}
/*
OpenPOWER on IntegriCloud