summaryrefslogtreecommitdiffstats
path: root/sys/fs/nullfs
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2006-03-12 04:58:18 +0000
committerjeff <jeff@FreeBSD.org>2006-03-12 04:58:18 +0000
commitc98db28d0e7855b17c8ec3073f43d862b9800b07 (patch)
tree5f7244b1112e41121c9fd026953920be90cd0ae7 /sys/fs/nullfs
parentf562a56c78e5047717d9065b8e618ea21d47ad28 (diff)
downloadFreeBSD-src-c98db28d0e7855b17c8ec3073f43d862b9800b07.zip
FreeBSD-src-c98db28d0e7855b17c8ec3073f43d862b9800b07.tar.gz
- Define a null_getwritemount to get the mount-point for the lower
filesystem so that nullfs doesn't permit you to circumvent snapshots. Discussed with: tegge Sponsored by: Isilon Systems, Inc.
Diffstat (limited to 'sys/fs/nullfs')
-rw-r--r--sys/fs/nullfs/null_vnops.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 6cb2279..f2261f9 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -683,16 +683,40 @@ null_print(struct vop_print_args *ap)
return (0);
}
+/* ARGSUSED */
+static int
+null_getwritemount(struct vop_getwritemount_args *ap)
+{
+ struct null_node *xp;
+ struct vnode *lowervp;
+ struct vnode *vp;
+
+ vp = ap->a_vp;
+ VI_LOCK(vp);
+ xp = VTONULL(vp);
+ if (xp && (lowervp = xp->null_lowervp)) {
+ VI_LOCK_FLAGS(lowervp, MTX_DUPOK);
+ VI_UNLOCK(vp);
+ vholdl(lowervp);
+ VI_UNLOCK(lowervp);
+ VOP_GETWRITEMOUNT(lowervp, ap->a_mpp);
+ vdrop(lowervp);
+ } else {
+ VI_UNLOCK(vp);
+ *(ap->a_mpp) = NULL;
+ }
+ return (0);
+}
+
/*
* Global vfs data structures
*/
struct vop_vector null_vnodeops = {
.vop_bypass = null_bypass,
-
.vop_access = null_access,
.vop_bmap = VOP_EOPNOTSUPP,
.vop_getattr = null_getattr,
- .vop_getwritemount = vop_stdgetwritemount,
+ .vop_getwritemount = null_getwritemount,
.vop_inactive = null_inactive,
.vop_islocked = null_islocked,
.vop_lock = null_lock,
OpenPOWER on IntegriCloud