2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
3 * Copyright (c) 1992, 1993, 1994, 1995
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
34 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $
35 * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.39 2007/11/20 21:03:51 dillon Exp $
38 #include <sys/param.h>
39 #include <sys/systm.h>
41 #include <sys/fcntl.h>
43 #include <sys/kernel.h>
44 #include <sys/vnode.h>
45 #include <sys/mount.h>
46 #include <sys/namei.h>
47 #include <sys/malloc.h>
50 #include <sys/sysctl.h>
54 #include <vm/vnode_pager.h>
56 #include <vm/vm_page.h>
57 #include <vm/vm_object.h>
62 SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RW, &uniondebug, 0, "");
64 SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RD, &uniondebug, 0, "");
67 static int union_access (struct vop_access_args *ap);
68 static int union_advlock (struct vop_advlock_args *ap);
69 static int union_bmap (struct vop_bmap_args *ap);
70 static int union_close (struct vop_close_args *ap);
71 static int union_create (struct vop_old_create_args *ap);
72 static int union_fsync (struct vop_fsync_args *ap);
73 static int union_getattr (struct vop_getattr_args *ap);
74 static int union_inactive (struct vop_inactive_args *ap);
75 static int union_ioctl (struct vop_ioctl_args *ap);
76 static int union_link (struct vop_old_link_args *ap);
77 static int union_lookup (struct vop_old_lookup_args *ap);
78 static int union_lookup1 (struct vnode *udvp, struct vnode **dvp,
80 struct componentname *cnp);
81 static int union_mkdir (struct vop_old_mkdir_args *ap);
82 static int union_mknod (struct vop_old_mknod_args *ap);
83 static int union_mmap (struct vop_mmap_args *ap);
84 static int union_open (struct vop_open_args *ap);
85 static int union_pathconf (struct vop_pathconf_args *ap);
86 static int union_print (struct vop_print_args *ap);
87 static int union_read (struct vop_read_args *ap);
88 static int union_readdir (struct vop_readdir_args *ap);
89 static int union_readlink (struct vop_readlink_args *ap);
90 static int union_reclaim (struct vop_reclaim_args *ap);
91 static int union_remove (struct vop_old_remove_args *ap);
92 static int union_rename (struct vop_old_rename_args *ap);
93 static int union_rmdir (struct vop_old_rmdir_args *ap);
94 static int union_poll (struct vop_poll_args *ap);
95 static int union_setattr (struct vop_setattr_args *ap);
96 static int union_strategy (struct vop_strategy_args *ap);
97 static int union_getpages (struct vop_getpages_args *ap);
98 static int union_putpages (struct vop_putpages_args *ap);
99 static int union_symlink (struct vop_old_symlink_args *ap);
100 static int union_whiteout (struct vop_old_whiteout_args *ap);
101 static int union_write (struct vop_read_args *ap);
105 union_lock_upper(struct union_node *un, struct thread *td)
107 struct vnode *uppervp;
109 if ((uppervp = un->un_uppervp) != NULL) {
111 vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY);
113 KASSERT((uppervp == NULL || VREFCNT(uppervp) > 0),
114 ("uppervp usecount is 0"));
120 union_ref_upper(struct union_node *un)
122 struct vnode *uppervp;
124 if ((uppervp = un->un_uppervp) != NULL) {
126 if (uppervp->v_flag & VRECLAIMED) {
136 union_unlock_upper(struct vnode *uppervp, struct thread *td)
143 union_lock_other(struct union_node *un, struct thread *td)
147 if (un->un_uppervp != NULL) {
148 vp = union_lock_upper(un, td);
149 } else if ((vp = un->un_lowervp) != NULL) {
151 vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY);
158 union_unlock_other(struct vnode *vp, struct thread *td)
166 * udvp must be exclusively locked on call and will remain
167 * exclusively locked on return. This is the mount point
168 * for out filesystem.
170 * dvp Our base directory, locked and referenced.
171 * The passed dvp will be dereferenced and unlocked on return
172 * and a new dvp will be returned which is locked and
173 * referenced in the same variable.
175 * vpp is filled in with the result if no error occured,
178 * If an error is returned, *vpp is set to NULLVP. If no
179 * error occurs, *vpp is returned with a reference and an
184 union_lookup1(struct vnode *udvp, struct vnode **pdvp, struct vnode **vpp,
185 struct componentname *cnp)
188 struct thread *td = cnp->cn_td;
189 struct vnode *dvp = *pdvp;
194 * If stepping up the directory tree, check for going
195 * back across the mount point, in which case do what
196 * lookup would do by stepping back down the mount
199 if (cnp->cn_flags & CNP_ISDOTDOT) {
200 while ((dvp != udvp) && (dvp->v_flag & VROOT)) {
202 * Don't do the NOCROSSMOUNT check
203 * at this level. By definition,
204 * union fs deals with namespaces, not
208 dvp = dvp->v_mount->mnt_vnodecovered;
211 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
216 * Set return dvp to be the upperdvp 'parent directory.
221 * If the VOP_LOOKUP call generates an error, tdvp is invalid and no
222 * changes will have been made to dvp, so we are set to return.
225 error = VOP_LOOKUP(dvp, &tdvp, cnp);
227 UDEBUG(("dvp %p error %d flags %lx\n", dvp, error, cnp->cn_flags));
233 * The parent directory will have been unlocked, unless lookup
234 * found the last component or if dvp == tdvp (tdvp must be locked).
236 * We want our dvp to remain locked and ref'd. We also want tdvp
237 * to remain locked and ref'd.
239 UDEBUG(("parentdir %p result %p flag %lx\n", dvp, tdvp, cnp->cn_flags));
242 if (dvp != tdvp && (cnp->cn_flags & CNP_XXXISLASTCN) == 0)
243 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
247 * Lastly check if the current node is a mount point in
248 * which case walk up the mount hierarchy making sure not to
249 * bump into the root of the mount tree (ie. dvp != udvp).
251 * We use dvp as a temporary variable here, it is no longer related
252 * to the dvp above. However, we have to ensure that both *pdvp and
253 * tdvp are locked on return.
259 (dvp->v_type == VDIR) &&
260 (mp = dvp->v_mountedhere)
271 error = VFS_ROOT(mp, &dvp);
276 vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY);
288 * union_lookup(struct vnode *a_dvp, struct vnode **a_vpp,
289 * struct componentname *a_cnp)
292 union_lookup(struct vop_old_lookup_args *ap)
296 struct vnode *uppervp, *lowervp;
297 struct vnode *upperdvp, *lowerdvp;
298 struct vnode *dvp = ap->a_dvp; /* starting dir */
299 struct union_node *dun = VTOUNION(dvp); /* associated union node */
300 struct componentname *cnp = ap->a_cnp;
301 struct thread *td = cnp->cn_td;
302 int lockparent = cnp->cn_flags & CNP_LOCKPARENT;
303 struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount);
304 struct ucred *saved_cred = NULL;
311 * Disallow write attemps to the filesystem mounted read-only.
313 if ((dvp->v_mount->mnt_flag & MNT_RDONLY) &&
314 (cnp->cn_nameiop == NAMEI_DELETE || cnp->cn_nameiop == NAMEI_RENAME)) {
319 * For any lookup's we do, always return with the parent locked
321 cnp->cn_flags |= CNP_LOCKPARENT;
323 lowerdvp = dun->un_lowervp;
332 * Get a private lock on uppervp and a reference, effectively
333 * taking it out of the union_node's control.
335 * We must lock upperdvp while holding our lock on dvp
336 * to avoid a deadlock.
338 upperdvp = union_lock_upper(dun, td);
341 * do the lookup in the upper level.
342 * if that level comsumes additional pathnames,
343 * then assume that something special is going
344 * on and just return that vnode.
346 if (upperdvp != NULLVP) {
348 * We do not have to worry about the DOTDOT case, we've
349 * already unlocked dvp.
351 UDEBUG(("A %p\n", upperdvp));
354 * Do the lookup. We must supply a locked and referenced
355 * upperdvp to the function and will get a new locked and
356 * referenced upperdvp back with the old having been
359 * If an error is returned, uppervp will be NULLVP. If no
360 * error occurs, uppervp will be the locked and referenced
361 * return vnode or possibly NULL, depending on what is being
362 * requested. It is possible that the returned uppervp
363 * will be the same as upperdvp.
365 uerror = union_lookup1(um->um_uppervp, &upperdvp, &uppervp, cnp);
367 "uerror %d upperdvp %p %d/%d, uppervp %p ref=%d/lck=%d\n",
371 vn_islocked(upperdvp),
373 (uppervp ? VREFCNT(uppervp) : -99),
374 (uppervp ? vn_islocked(uppervp) : -99)
378 * Disallow write attemps to the filesystem mounted read-only.
380 if (uerror == EJUSTRETURN &&
381 (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
382 (cnp->cn_nameiop == NAMEI_CREATE || cnp->cn_nameiop == NAMEI_RENAME)) {
388 * Special case. If cn_consume != 0 skip out. The result
389 * of the lookup is transfered to our return variable. If
390 * an error occured we have to throw away the results.
393 if (cnp->cn_consume != 0) {
394 if ((error = uerror) == 0) {
395 *ap->a_vpp = uppervp;
402 * Calculate whiteout, fall through
405 if (uerror == ENOENT || uerror == EJUSTRETURN) {
406 if (cnp->cn_flags & CNP_ISWHITEOUT) {
408 } else if (lowerdvp != NULLVP) {
411 terror = VOP_GETATTR(upperdvp, &va);
412 if (terror == 0 && (va.va_flags & OPAQUE))
419 * in a similar way to the upper layer, do the lookup
420 * in the lower layer. this time, if there is some
421 * component magic going on, then vput whatever we got
422 * back from the upper layer and return the lower vnode
426 if (lowerdvp != NULLVP && !iswhiteout) {
429 UDEBUG(("B %p\n", lowerdvp));
432 * Force only LOOKUPs on the lower node, since
433 * we won't be making changes to it anyway.
435 nameiop = cnp->cn_nameiop;
436 cnp->cn_nameiop = NAMEI_LOOKUP;
437 if (um->um_op == UNMNT_BELOW) {
438 saved_cred = cnp->cn_cred;
439 cnp->cn_cred = um->um_cred;
443 * We shouldn't have to worry about locking interactions
444 * between the lower layer and our union layer (w.r.t.
445 * `..' processing) because we don't futz with lowervp
446 * locks in the union-node instantiation code path.
448 * union_lookup1() requires lowervp to be locked on entry,
449 * and it will be unlocked on return. The ref count will
450 * not change. On return lowervp doesn't represent anything
451 * to us so we NULL it out.
454 vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY);
455 lerror = union_lookup1(um->um_lowervp, &lowerdvp, &lowervp, cnp);
456 if (lowerdvp == lowervp)
460 lowerdvp = NULL; /* lowerdvp invalid after vput */
462 if (um->um_op == UNMNT_BELOW)
463 cnp->cn_cred = saved_cred;
464 cnp->cn_nameiop = nameiop;
466 if (cnp->cn_consume != 0 || lerror == EACCES) {
467 if ((error = lerror) == 0) {
468 *ap->a_vpp = lowervp;
474 UDEBUG(("C %p\n", lowerdvp));
475 if ((cnp->cn_flags & CNP_ISDOTDOT) && dun->un_pvp != NULLVP) {
476 if ((lowervp = LOWERVP(dun->un_pvp)) != NULL) {
478 vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY);
485 * Ok. Now we have uerror, uppervp, upperdvp, lerror, and lowervp.
487 * 1. If both layers returned an error, select the upper layer.
489 * 2. If the upper layer faile and the bottom layer succeeded,
490 * two subcases occur:
492 * a. The bottom vnode is not a directory, in which case
493 * just return a new union vnode referencing an
494 * empty top layer and the existing bottom layer.
496 * b. The button vnode is a directory, in which case
497 * create a new directory in the top layer and
498 * and fall through to case 3.
500 * 3. If the top layer succeeded then return a new union
501 * vnode referencing whatever the new top layer and
502 * whatever the bottom layer returned.
506 if ((uerror != 0) && (lerror != 0)) {
512 if (uerror != 0 /* && (lerror == 0) */ ) {
513 if (lowervp->v_type == VDIR) { /* case 2b. */
514 KASSERT(uppervp == NULL, ("uppervp unexpectedly non-NULL"));
516 * oops, uppervp has a problem, we may have to shadow.
518 uerror = union_mkshadow(um, upperdvp, cnp, &uppervp);
527 * Must call union_allocvp with both the upper and lower vnodes
528 * referenced and the upper vnode locked. ap->a_vpp is returned
529 * referenced and locked. lowervp, uppervp, and upperdvp are
530 * absorbed by union_allocvp() whether it succeeds or fails.
532 * upperdvp is the parent directory of uppervp which may be
533 * different, depending on the path, from dvp->un_uppervp. That's
534 * why it is a separate argument. Note that it must be unlocked.
536 * dvp must be locked on entry to the call and will be locked on
540 if (uppervp && uppervp != upperdvp)
547 error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp,
548 uppervp, lowervp, 1);
550 UDEBUG(("Create %p = %p %p refs=%d\n",
551 *ap->a_vpp, uppervp, lowervp,
552 (*ap->a_vpp) ? (VREFCNT(*ap->a_vpp)) : -99));
561 * - put away any extra junk laying around. Note that lowervp
562 * (if not NULL) will never be the same as *ap->a_vp and
563 * neither will uppervp, because when we set that state we
564 * NULL-out lowervp or uppervp. On the otherhand, upperdvp
565 * may match uppervp or *ap->a_vpp.
567 * - relock/unlock dvp if appropriate.
572 if (upperdvp == uppervp || upperdvp == *ap->a_vpp)
585 * Restore LOCKPARENT state
589 cnp->cn_flags &= ~CNP_LOCKPARENT;
591 UDEBUG(("Out %d vpp %p/%d lower %p upper %p\n", error, *ap->a_vpp,
592 ((*ap->a_vpp) ? (*ap->a_vpp)->v_refcnt : -99),
596 * dvp lock state, determine whether to relock dvp. dvp is expected
597 * to be locked on return if:
599 * - there was an error (except not EJUSTRETURN), or
600 * - we hit the last component and lockparent is true
602 * dvp_is_locked is the current state of the dvp lock, not counting
603 * the possibility that *ap->a_vpp == dvp (in which case it is locked
604 * anyway). Note that *ap->a_vpp == dvp only if no error occured.
607 if (*ap->a_vpp != dvp) {
608 if ((error == 0 || error == EJUSTRETURN) && !lockparent) {
618 if (cnp->cn_namelen == 1 &&
619 cnp->cn_nameptr[0] == '.' &&
621 panic("union_lookup returning . (%p) not same as startdir (%p)", ap->a_vpp, dvp);
631 * a_dvp is locked on entry and remains locked on return. a_vpp is returned
632 * locked if no error occurs, otherwise it is garbage.
634 * union_create(struct vnode *a_dvp, struct vnode **a_vpp,
635 * struct componentname *a_cnp, struct vattr *a_vap)
638 union_create(struct vop_old_create_args *ap)
640 struct union_node *dun = VTOUNION(ap->a_dvp);
641 struct componentname *cnp = ap->a_cnp;
642 struct thread *td = cnp->cn_td;
646 if ((dvp = union_lock_upper(dun, td)) != NULL) {
650 error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap);
652 mp = ap->a_dvp->v_mount;
654 UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n",
656 error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP,
658 UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n",
659 *ap->a_vpp, vp->v_refcnt));
661 union_unlock_upper(dvp, td);
667 * union_whiteout(struct vnode *a_dvp, struct componentname *a_cnp,
671 union_whiteout(struct vop_old_whiteout_args *ap)
673 struct union_node *un = VTOUNION(ap->a_dvp);
674 struct componentname *cnp = ap->a_cnp;
675 struct vnode *uppervp;
676 int error = EOPNOTSUPP;
678 if ((uppervp = union_lock_upper(un, cnp->cn_td)) != NULLVP) {
679 error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags);
680 union_unlock_upper(uppervp, cnp->cn_td);
688 * a_dvp is locked on entry and should remain locked on return.
689 * a_vpp is garbagre whether an error occurs or not.
691 * union_mknod(struct vnode *a_dvp, struct vnode **a_vpp,
692 * struct componentname *a_cnp, struct vattr *a_vap)
695 union_mknod(struct vop_old_mknod_args *ap)
697 struct union_node *dun = VTOUNION(ap->a_dvp);
698 struct componentname *cnp = ap->a_cnp;
702 if ((dvp = union_lock_upper(dun, cnp->cn_td)) != NULL) {
703 error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap);
704 union_unlock_upper(dvp, cnp->cn_td);
712 * run open VOP. When opening the underlying vnode we have to mimic
713 * vn_open. What we *really* need to do to avoid screwups if the
714 * open semantics change is to call vn_open(). For example, ufs blows
715 * up if you open a file but do not vmio it prior to writing.
717 * union_open(struct vnode *a_vp, int a_mode,
718 * struct ucred *a_cred, struct thread *a_td)
721 union_open(struct vop_open_args *ap)
723 struct union_node *un = VTOUNION(ap->a_vp);
725 int mode = ap->a_mode;
726 struct ucred *cred = ap->a_cred;
727 struct thread *td = ap->a_td;
732 * If there is an existing upper vp then simply open that.
733 * The upper vp takes precedence over the lower vp. When opening
734 * a lower vp for writing copy it to the uppervp and then open the
737 * At the end of this section tvp will be left locked.
739 if ((tvp = union_lock_upper(un, td)) == NULLVP) {
741 * If the lower vnode is being opened for writing, then
742 * copy the file contents to the upper vnode and open that,
743 * otherwise can simply open the lower vnode.
745 tvp = un->un_lowervp;
746 if ((ap->a_mode & FWRITE) && (tvp->v_type == VREG)) {
747 int docopy = !(mode & O_TRUNC);
748 error = union_copyup(un, docopy, cred, td);
749 tvp = union_lock_upper(un, td);
753 vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
759 * We are holding the correct vnode, open it. Note
760 * that in DragonFly, VOP_OPEN is responsible for associating
761 * a VM object with the vnode if the vnode is mappable or the
762 * underlying filesystem uses buffer cache calls on it.
765 error = VOP_OPEN(tvp, mode, cred, NULL);
768 * Release any locks held
772 union_unlock_upper(tvp, td);
782 * It is unclear whether a_vp is passed locked or unlocked. Whatever
783 * the case we do not change it.
785 * union_close(struct vnode *a_vp, int a_fflag, struct ucred *a_cred,
786 * struct thread *a_td)
789 union_close(struct vop_close_args *ap)
791 struct union_node *un = VTOUNION(ap->a_vp);
794 vn_lock(vp, LK_UPGRADE | LK_RETRY);
795 if ((vp = un->un_uppervp) == NULLVP) {
796 #ifdef UNION_DIAGNOSTIC
797 if (un->un_openl <= 0)
798 panic("union: un_openl cnt");
803 ap->a_head.a_ops = *vp->v_ops;
805 return(vop_close_ap(ap));
809 * Check access permission on the union vnode.
810 * The access check being enforced is to check
811 * against both the underlying vnode, and any
812 * copied vnode. This ensures that no additional
813 * file permissions are given away simply because
814 * the user caused an implicit file copy.
816 * union_access(struct vnode *a_vp, int a_mode,
817 * struct ucred *a_cred, struct thread *a_td)
820 union_access(struct vop_access_args *ap)
822 struct union_node *un = VTOUNION(ap->a_vp);
823 struct thread *td = ap->a_td;
828 * Disallow write attempts on filesystems mounted read-only.
830 if ((ap->a_mode & VWRITE) &&
831 (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)) {
832 switch (ap->a_vp->v_type) {
842 if ((vp = union_lock_upper(un, td)) != NULLVP) {
843 ap->a_head.a_ops = *vp->v_ops;
845 error = vop_access_ap(ap);
846 union_unlock_upper(vp, td);
850 if ((vp = un->un_lowervp) != NULLVP) {
851 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
852 ap->a_head.a_ops = *vp->v_ops;
856 * Remove VWRITE from a_mode if our mount point is RW, because
857 * we want to allow writes and lowervp may be read-only.
859 if ((un->un_vnode->v_mount->mnt_flag & MNT_RDONLY) == 0)
860 ap->a_mode &= ~VWRITE;
862 error = vop_access_ap(ap);
864 struct union_mount *um;
866 um = MOUNTTOUNIONMOUNT(un->un_vnode->v_mount);
868 if (um->um_op == UNMNT_BELOW) {
869 ap->a_cred = um->um_cred;
870 error = vop_access_ap(ap);
879 * We handle getattr only to change the fsid and
882 * It's not clear whether VOP_GETATTR is to be
883 * called with the vnode locked or not. stat() calls
884 * it with (vp) locked, and fstat calls it with
887 * Because of this we cannot use our normal locking functions
888 * if we do not intend to lock the main a_vp node. At the moment
889 * we are running without any specific locking at all, but beware
890 * to any programmer that care must be taken if locking is added
893 * union_getattr(struct vnode *a_vp, struct vattr *a_vap,
894 * struct ucred *a_cred, struct thread *a_td)
897 union_getattr(struct vop_getattr_args *ap)
900 struct union_node *un = VTOUNION(ap->a_vp);
906 * Some programs walk the filesystem hierarchy by counting
907 * links to directories to avoid stat'ing all the time.
908 * This means the link count on directories needs to be "correct".
909 * The only way to do that is to call getattr on both layers
910 * and fix up the link count. The link count will not necessarily
911 * be accurate but will be large enough to defeat the tree walkers.
916 if ((vp = un->un_uppervp) != NULLVP) {
917 error = VOP_GETATTR(vp, vap);
920 /* XXX isn't this dangerouso without a lock? */
921 union_newsize(ap->a_vp, vap->va_size, VNOVAL);
926 } else if (vp->v_type == VDIR && un->un_lowervp != NULLVP) {
934 error = VOP_GETATTR(vp, vap);
937 /* XXX isn't this dangerous without a lock? */
938 union_newsize(ap->a_vp, VNOVAL, vap->va_size);
941 if ((vap != ap->a_vap) && (vap->va_type == VDIR))
942 ap->a_vap->va_nlink += vap->va_nlink;
947 * union_setattr(struct vnode *a_vp, struct vattr *a_vap,
948 * struct ucred *a_cred, struct thread *a_td)
951 union_setattr(struct vop_setattr_args *ap)
953 struct union_node *un = VTOUNION(ap->a_vp);
954 struct thread *td = ap->a_td;
955 struct vattr *vap = ap->a_vap;
956 struct vnode *uppervp;
960 * Disallow write attempts on filesystems mounted read-only.
962 if ((ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) &&
963 (vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
964 vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
965 vap->va_mtime.tv_sec != VNOVAL ||
966 vap->va_mode != (mode_t)VNOVAL)) {
971 * Handle case of truncating lower object to zero size,
972 * by creating a zero length upper object. This is to
973 * handle the case of open with O_TRUNC and O_CREAT.
975 if (un->un_uppervp == NULLVP && (un->un_lowervp->v_type == VREG)) {
976 error = union_copyup(un, (ap->a_vap->va_size != 0),
977 ap->a_cred, ap->a_td);
983 * Try to set attributes in upper layer,
984 * otherwise return read-only filesystem error.
987 if ((uppervp = union_lock_upper(un, td)) != NULLVP) {
988 error = VOP_SETATTR(un->un_uppervp, ap->a_vap, ap->a_cred);
989 if ((error == 0) && (ap->a_vap->va_size != VNOVAL))
990 union_newsize(ap->a_vp, ap->a_vap->va_size, VNOVAL);
991 union_unlock_upper(uppervp, td);
1001 union_getpages(struct vop_getpages_args *ap)
1005 r = vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
1006 ap->a_count, ap->a_reqpage,
1016 union_putpages(struct vop_putpages_args *ap)
1020 r = vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
1021 ap->a_sync, ap->a_rtvals);
1026 * union_read(struct vnode *a_vp, struct uio *a_uio, int a_ioflag,
1027 * struct ucred *a_cred)
1030 union_read(struct vop_read_args *ap)
1032 struct union_node *un = VTOUNION(ap->a_vp);
1033 struct thread *td = ap->a_uio->uio_td;
1037 uvp = union_lock_other(un, td);
1038 KASSERT(uvp != NULL, ("union_read: backing vnode missing!"));
1040 if (ap->a_vp->v_flag & VOBJBUF)
1041 union_vm_coherency(ap->a_vp, ap->a_uio, 0);
1043 error = VOP_READ(uvp, ap->a_uio, ap->a_ioflag, ap->a_cred);
1044 union_unlock_other(uvp, td);
1048 * perhaps the size of the underlying object has changed under
1049 * our feet. take advantage of the offset information present
1050 * in the uio structure.
1053 struct union_node *un = VTOUNION(ap->a_vp);
1054 off_t cur = ap->a_uio->uio_offset;
1056 if (uvp == un->un_uppervp) {
1057 if (cur > un->un_uppersz)
1058 union_newsize(ap->a_vp, cur, VNOVAL);
1060 if (cur > un->un_lowersz)
1061 union_newsize(ap->a_vp, VNOVAL, cur);
1068 * union_write(struct vnode *a_vp, struct uio *a_uio, int a_ioflag,
1069 * struct ucred *a_cred)
1072 union_write(struct vop_read_args *ap)
1074 struct union_node *un = VTOUNION(ap->a_vp);
1075 struct thread *td = ap->a_uio->uio_td;
1076 struct vnode *uppervp;
1079 if ((uppervp = union_lock_upper(un, td)) == NULLVP)
1080 panic("union: missing upper layer in write");
1083 * Since our VM pages are associated with our vnode rather then
1084 * the real vnode, and since we do not run our reads and writes
1085 * through our own VM cache, we have a VM/VFS coherency problem.
1086 * We solve them by invalidating or flushing the associated VM
1087 * pages prior to allowing a normal read or write to occur.
1089 * VM-backed writes (UIO_NOCOPY) have to be converted to normal
1090 * writes because we are not cache-coherent. Normal writes need
1091 * to be made coherent with our VM-backing store, which we do by
1092 * first flushing any dirty VM pages associated with the write
1093 * range, and then destroying any clean VM pages associated with
1097 if (ap->a_uio->uio_segflg == UIO_NOCOPY) {
1098 ap->a_uio->uio_segflg = UIO_SYSSPACE;
1099 } else if (ap->a_vp->v_flag & VOBJBUF) {
1100 union_vm_coherency(ap->a_vp, ap->a_uio, 1);
1103 error = VOP_WRITE(uppervp, ap->a_uio, ap->a_ioflag, ap->a_cred);
1106 * the size of the underlying object may be changed by the
1110 off_t cur = ap->a_uio->uio_offset;
1112 if (cur > un->un_uppersz)
1113 union_newsize(ap->a_vp, cur, VNOVAL);
1115 union_unlock_upper(uppervp, td);
1120 * union_ioctl(struct vnode *a_vp, int a_command, caddr_t a_data, int a_fflag,
1121 * struct ucred *a_cred, struct thread *a_td)
1124 union_ioctl(struct vop_ioctl_args *ap)
1126 struct vnode *ovp = OTHERVP(ap->a_vp);
1128 ap->a_head.a_ops = *ovp->v_ops;
1130 return(vop_ioctl_ap(ap));
1134 * union_poll(struct vnode *a_vp, int a_events, struct ucred *a_cred,
1135 * struct thread *a_td)
1138 union_poll(struct vop_poll_args *ap)
1140 struct vnode *ovp = OTHERVP(ap->a_vp);
1142 ap->a_head.a_ops = *ovp->v_ops;
1144 return(vop_poll_ap(ap));
1148 * union_mmap(struct vnode *a_vp, int a_fflags, struct ucred *a_cred,
1149 * struct thread *a_td)
1152 union_mmap(struct vop_mmap_args *ap)
1154 struct vnode *ovp = OTHERVP(ap->a_vp);
1156 ap->a_head.a_ops = *ovp->v_ops;
1158 return (vop_mmap_ap(ap));
1162 * union_fsync(struct vnode *a_vp, struct ucred *a_cred, int a_waitfor,
1163 * struct thread *a_td)
1166 union_fsync(struct vop_fsync_args *ap)
1169 struct thread *td = ap->a_td;
1170 struct vnode *targetvp;
1171 struct union_node *un = VTOUNION(ap->a_vp);
1173 if ((targetvp = union_lock_other(un, td)) != NULLVP) {
1174 error = VOP_FSYNC(targetvp, ap->a_waitfor, 0);
1175 union_unlock_other(targetvp, td);
1184 * Remove the specified cnp. The dvp and vp are passed to us locked
1185 * and must remain locked on return.
1187 * union_remove(struct vnode *a_dvp, struct vnode *a_vp,
1188 * struct componentname *a_cnp)
1191 union_remove(struct vop_old_remove_args *ap)
1193 struct union_node *dun = VTOUNION(ap->a_dvp);
1194 struct union_node *un = VTOUNION(ap->a_vp);
1195 struct componentname *cnp = ap->a_cnp;
1196 struct thread *td = cnp->cn_td;
1197 struct vnode *uppervp;
1198 struct vnode *upperdvp;
1201 if ((upperdvp = union_lock_upper(dun, td)) == NULLVP)
1202 panic("union remove: null upper vnode");
1204 if ((uppervp = union_lock_upper(un, td)) != NULLVP) {
1205 if (union_dowhiteout(un, cnp->cn_cred, td))
1206 cnp->cn_flags |= CNP_DOWHITEOUT;
1207 error = VOP_REMOVE(upperdvp, uppervp, cnp);
1211 union_removed_upper(un);
1213 union_unlock_upper(uppervp, td);
1215 error = union_mkwhiteout(
1216 MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount),
1217 upperdvp, ap->a_cnp, un->un_path);
1219 union_unlock_upper(upperdvp, td);
1226 * tdvp will be locked on entry, vp will not be locked on entry.
1227 * tdvp should remain locked on return and vp should remain unlocked
1230 * union_link(struct vnode *a_tdvp, struct vnode *a_vp,
1231 * struct componentname *a_cnp)
1234 union_link(struct vop_old_link_args *ap)
1236 struct componentname *cnp = ap->a_cnp;
1237 struct thread *td = cnp->cn_td;
1238 struct union_node *dun = VTOUNION(ap->a_tdvp);
1243 if (ap->a_tdvp->v_ops != ap->a_vp->v_ops) {
1246 struct union_node *tun = VTOUNION(ap->a_vp);
1248 if (tun->un_uppervp == NULLVP) {
1249 vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
1251 if (dun->un_uppervp == tun->un_dirvp) {
1252 if (dun->un_flags & UN_ULOCK) {
1253 dun->un_flags &= ~UN_ULOCK;
1254 vn_unlock(dun->un_uppervp);
1258 error = union_copyup(tun, 1, cnp->cn_cred, td);
1260 if (dun->un_uppervp == tun->un_dirvp) {
1261 vn_lock(dun->un_uppervp,
1262 LK_EXCLUSIVE | LK_RETRY);
1263 dun->un_flags |= UN_ULOCK;
1266 vn_unlock(ap->a_vp);
1268 vp = tun->un_uppervp;
1275 * Make sure upper is locked, then unlock the union directory we were
1276 * called with to avoid a deadlock while we are calling VOP_LINK on
1277 * the upper (with tdvp locked and vp not locked). Our ap->a_tdvp
1278 * is expected to be locked on return.
1281 if ((tdvp = union_lock_upper(dun, td)) == NULLVP)
1284 vn_unlock(ap->a_tdvp); /* unlock calling node */
1285 error = VOP_LINK(tdvp, vp, cnp); /* call link on upper */
1288 * We have to unlock tdvp prior to relocking our calling node in
1289 * order to avoid a deadlock.
1291 union_unlock_upper(tdvp, td);
1292 vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY);
1297 * union_rename(struct vnode *a_fdvp, struct vnode *a_fvp,
1298 * struct componentname *a_fcnp, struct vnode *a_tdvp,
1299 * struct vnode *a_tvp, struct componentname *a_tcnp)
1302 union_rename(struct vop_old_rename_args *ap)
1305 struct vnode *fdvp = ap->a_fdvp;
1306 struct vnode *fvp = ap->a_fvp;
1307 struct vnode *tdvp = ap->a_tdvp;
1308 struct vnode *tvp = ap->a_tvp;
1311 * Figure out what fdvp to pass to our upper or lower vnode. If we
1312 * replace the fdvp, release the original one and ref the new one.
1315 if (fdvp->v_tag == VT_UNION) { /* always true */
1316 struct union_node *un = VTOUNION(fdvp);
1317 if (un->un_uppervp == NULLVP) {
1319 * this should never happen in normal
1320 * operation but might if there was
1321 * a problem creating the top-level shadow
1327 fdvp = un->un_uppervp;
1333 * Figure out what fvp to pass to our upper or lower vnode. If we
1334 * replace the fvp, release the original one and ref the new one.
1337 if (fvp->v_tag == VT_UNION) { /* always true */
1338 struct union_node *un = VTOUNION(fvp);
1340 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount);
1343 if (un->un_uppervp == NULLVP) {
1344 switch(fvp->v_type) {
1346 vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY);
1347 error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_td);
1348 vn_unlock(un->un_vnode);
1356 * There is only one way to rename a directory
1357 * based in the lowervp, and that is to copy
1358 * the entire directory hierarchy. Otherwise
1359 * it would not last across a reboot.
1364 vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY);
1365 error = union_mkshadow(um, fdvp,
1366 ap->a_fcnp, &un->un_uppervp);
1369 vn_unlock(un->un_uppervp);
1380 if (un->un_lowervp != NULLVP)
1381 ap->a_fcnp->cn_flags |= CNP_DOWHITEOUT;
1382 fvp = un->un_uppervp;
1388 * Figure out what tdvp (destination directory) to pass to the
1389 * lower level. If we replace it with uppervp, we need to vput the
1390 * old one. The exclusive lock is transfered to what we will pass
1391 * down in the VOP_RENAME and we replace uppervp with a simple
1395 if (tdvp->v_tag == VT_UNION) {
1396 struct union_node *un = VTOUNION(tdvp);
1398 if (un->un_uppervp == NULLVP) {
1400 * this should never happen in normal
1401 * operation but might if there was
1402 * a problem creating the top-level shadow
1410 * new tdvp is a lock and reference on uppervp, put away
1413 tdvp = union_lock_upper(un, ap->a_tcnp->cn_td);
1418 * Figure out what tvp (destination file) to pass to the
1421 * If the uppervp file does not exist put away the (wrong)
1422 * file and change tvp to NULL.
1425 if (tvp != NULLVP && tvp->v_tag == VT_UNION) {
1426 struct union_node *un = VTOUNION(tvp);
1428 tvp = union_lock_upper(un, ap->a_tcnp->cn_td);
1430 /* note: tvp may be NULL */
1434 * VOP_RENAME releases/vputs prior to returning, so we have no
1438 return (VOP_RENAME(fdvp, fvp, ap->a_fcnp, tdvp, tvp, ap->a_tcnp));
1441 * Error. We still have to release / vput the various elements.
1449 if (tvp != NULLVP) {
1459 * union_mkdir(struct vnode *a_dvp, struct vnode **a_vpp,
1460 * struct componentname *a_cnp, struct vattr *a_vap)
1463 union_mkdir(struct vop_old_mkdir_args *ap)
1465 struct union_node *dun = VTOUNION(ap->a_dvp);
1466 struct componentname *cnp = ap->a_cnp;
1467 struct thread *td = cnp->cn_td;
1468 struct vnode *upperdvp;
1471 if ((upperdvp = union_lock_upper(dun, td)) != NULLVP) {
1474 error = VOP_MKDIR(upperdvp, &vp, cnp, ap->a_vap);
1475 union_unlock_upper(upperdvp, td);
1479 UDEBUG(("ALLOCVP-2 FROM %p REFS %d\n",
1481 error = union_allocvp(ap->a_vpp, ap->a_dvp->v_mount,
1482 ap->a_dvp, NULLVP, cnp, vp, NULLVP, 1);
1483 UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n",
1484 *ap->a_vpp, vp->v_refcnt));
1491 * union_rmdir(struct vnode *a_dvp, struct vnode *a_vp,
1492 * struct componentname *a_cnp)
1495 union_rmdir(struct vop_old_rmdir_args *ap)
1497 struct union_node *dun = VTOUNION(ap->a_dvp);
1498 struct union_node *un = VTOUNION(ap->a_vp);
1499 struct componentname *cnp = ap->a_cnp;
1500 struct thread *td = cnp->cn_td;
1501 struct vnode *upperdvp;
1502 struct vnode *uppervp;
1505 if ((upperdvp = union_lock_upper(dun, td)) == NULLVP)
1506 panic("union rmdir: null upper vnode");
1508 if ((uppervp = union_lock_upper(un, td)) != NULLVP) {
1509 if (union_dowhiteout(un, cnp->cn_cred, td))
1510 cnp->cn_flags |= CNP_DOWHITEOUT;
1511 error = VOP_RMDIR(upperdvp, uppervp, ap->a_cnp);
1512 union_unlock_upper(uppervp, td);
1514 error = union_mkwhiteout(
1515 MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount),
1516 dun->un_uppervp, ap->a_cnp, un->un_path);
1518 union_unlock_upper(upperdvp, td);
1525 * dvp is locked on entry and remains locked on return. a_vpp is garbage
1528 * union_symlink(struct vnode *a_dvp, struct vnode **a_vpp,
1529 * struct componentname *a_cnp, struct vattr *a_vap,
1533 union_symlink(struct vop_old_symlink_args *ap)
1535 struct union_node *dun = VTOUNION(ap->a_dvp);
1536 struct componentname *cnp = ap->a_cnp;
1537 struct thread *td = cnp->cn_td;
1541 if ((dvp = union_lock_upper(dun, td)) != NULLVP) {
1542 error = VOP_SYMLINK(dvp, ap->a_vpp, cnp, ap->a_vap,
1544 union_unlock_upper(dvp, td);
1550 * union_readdir works in concert with getdirentries and
1551 * readdir(3) to provide a list of entries in the unioned
1552 * directories. getdirentries is responsible for walking
1553 * down the union stack. readdir(3) is responsible for
1554 * eliminating duplicate names from the returned data stream.
1556 * union_readdir(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred,
1557 * int *a_eofflag, off_t *a_cookies, int a_ncookies)
1560 union_readdir(struct vop_readdir_args *ap)
1562 struct union_node *un = VTOUNION(ap->a_vp);
1563 struct thread *td = ap->a_uio->uio_td;
1567 if ((uvp = union_ref_upper(un)) != NULLVP) {
1568 ap->a_head.a_ops = *uvp->v_ops;
1570 error = vop_readdir_ap(ap);
1577 * union_readlink(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred)
1580 union_readlink(struct vop_readlink_args *ap)
1583 struct union_node *un = VTOUNION(ap->a_vp);
1584 struct uio *uio = ap->a_uio;
1585 struct thread *td = uio->uio_td;
1588 vp = union_lock_other(un, td);
1589 KASSERT(vp != NULL, ("union_readlink: backing vnode missing!"));
1591 ap->a_head.a_ops = *vp->v_ops;
1593 error = vop_readlink_ap(ap);
1594 union_unlock_other(vp, td);
1602 * Called with the vnode locked. We are expected to unlock the vnode.
1604 * union_inactive(struct vnode *a_vp, struct thread *a_td)
1607 union_inactive(struct vop_inactive_args *ap)
1609 struct vnode *vp = ap->a_vp;
1610 /*struct thread *td = ap->a_td;*/
1611 struct union_node *un = VTOUNION(vp);
1615 * Do nothing (and _don't_ bypass).
1616 * Wait to vrele lowervp until reclaim,
1617 * so that until then our union_node is in the
1618 * cache and reusable.
1620 * NEEDSWORK: Someday, consider inactive'ing
1621 * the lowervp and then trying to reactivate it
1622 * with capabilities (v_id)
1623 * like they do in the name lookup cache code.
1624 * That's too much work for now.
1627 if (un->un_dircache != 0) {
1628 for (vpp = un->un_dircache; *vpp != NULLVP; vpp++)
1630 kfree (un->un_dircache, M_TEMP);
1631 un->un_dircache = 0;
1635 if ((un->un_flags & UN_ULOCK) && un->un_uppervp) {
1636 un->un_flags &= ~UN_ULOCK;
1637 vn_unlock(un->un_uppervp);
1641 if ((un->un_flags & UN_CACHED) == 0)
1648 * union_reclaim(struct vnode *a_vp)
1651 union_reclaim(struct vop_reclaim_args *ap)
1653 union_freevp(ap->a_vp);
1661 * There isn't much we can do. We cannot push through to the real vnode
1662 * to get to the underlying device because this will bypass data
1663 * cached by the real vnode.
1665 * For some reason we cannot return the 'real' vnode either, it seems
1666 * to blow up memory maps.
1668 * union_bmap(struct vnode *a_vp, off_t a_loffset,
1669 * off_t *a_doffsetp, int *a_runp, int *a_runb)
1672 union_bmap(struct vop_bmap_args *ap)
1678 * union_print(struct vnode *a_vp)
1681 union_print(struct vop_print_args *ap)
1683 struct vnode *vp = ap->a_vp;
1685 kprintf("\ttag VT_UNION, vp=%p, uppervp=%p, lowervp=%p\n",
1686 vp, UPPERVP(vp), LOWERVP(vp));
1687 if (UPPERVP(vp) != NULLVP)
1688 vprint("union: upper", UPPERVP(vp));
1689 if (LOWERVP(vp) != NULLVP)
1690 vprint("union: lower", LOWERVP(vp));
1696 * union_pathconf(struct vnode *a_vp, int a_name, int *a_retval)
1699 union_pathconf(struct vop_pathconf_args *ap)
1702 struct thread *td = curthread; /* XXX */
1703 struct union_node *un = VTOUNION(ap->a_vp);
1706 vp = union_lock_other(un, td);
1707 KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!"));
1709 ap->a_head.a_ops = *vp->v_ops;
1711 error = vop_pathconf_ap(ap);
1712 union_unlock_other(vp, td);
1718 * union_advlock(struct vnode *a_vp, caddr_t a_id, int a_op,
1719 * struct flock *a_fl, int a_flags)
1722 union_advlock(struct vop_advlock_args *ap)
1724 struct vnode *ovp = OTHERVP(ap->a_vp);
1726 ap->a_head.a_ops = *ovp->v_ops;
1728 return (vop_advlock_ap(ap));
1733 * XXX - vop_strategy must be hand coded because it has no
1734 * YYY - and it is not coherent with anything
1736 * vnode in its arguments.
1737 * This goes away with a merged VM/buffer cache.
1739 * union_strategy(struct vnode *a_vp, struct bio *a_bio)
1742 union_strategy(struct vop_strategy_args *ap)
1744 struct bio *bio = ap->a_bio;
1745 struct buf *bp = bio->bio_buf;
1746 struct vnode *othervp = OTHERVP(ap->a_vp);
1749 if (othervp == NULLVP)
1750 panic("union_strategy: nil vp");
1751 if (bp->b_cmd != BUF_CMD_READ && (othervp == LOWERVP(ap->a_vp)))
1752 panic("union_strategy: writing to lowervp");
1754 return (vn_strategy(othervp, bio));
1758 * Global vfs data structures
1760 struct vop_ops union_vnode_vops = {
1761 .vop_default = vop_defaultop,
1762 .vop_access = union_access,
1763 .vop_advlock = union_advlock,
1764 .vop_bmap = union_bmap,
1765 .vop_close = union_close,
1766 .vop_old_create = union_create,
1767 .vop_fsync = union_fsync,
1768 .vop_getpages = union_getpages,
1769 .vop_putpages = union_putpages,
1770 .vop_getattr = union_getattr,
1771 .vop_inactive = union_inactive,
1772 .vop_ioctl = union_ioctl,
1773 .vop_old_link = union_link,
1774 .vop_old_lookup = union_lookup,
1775 .vop_old_mkdir = union_mkdir,
1776 .vop_old_mknod = union_mknod,
1777 .vop_mmap = union_mmap,
1778 .vop_open = union_open,
1779 .vop_pathconf = union_pathconf,
1780 .vop_poll = union_poll,
1781 .vop_print = union_print,
1782 .vop_read = union_read,
1783 .vop_readdir = union_readdir,
1784 .vop_readlink = union_readlink,
1785 .vop_reclaim = union_reclaim,
1786 .vop_old_remove = union_remove,
1787 .vop_old_rename = union_rename,
1788 .vop_old_rmdir = union_rmdir,
1789 .vop_setattr = union_setattr,
1790 .vop_strategy = union_strategy,
1791 .vop_old_symlink = union_symlink,
1792 .vop_old_whiteout = union_whiteout,
1793 .vop_write = union_write