Deleted Added
sdiff udiff text old ( 111841 ) new ( 116469 )
full compact
1/*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * John Heidemann of the UCLA Ficus project.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 26 unchanged lines hidden (view full) ---

35 *
36 * @(#)null_vnops.c 8.6 (Berkeley) 5/27/95
37 *
38 * Ancestors:
39 * @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
40 * ...and...
41 * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
42 *
43 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 111841 2003-03-03 19:15:40Z njl $
44 */
45
46/*
47 * Null Layer
48 *
49 * (See mount_nullfs(8) for more information.)
50 *
51 * The null layer duplicates a portion of the filesystem

--- 535 unchanged lines hidden (view full) ---

587 struct thread *a_td;
588 } */ *ap;
589{
590 struct vnode *vp = ap->a_vp;
591 int flags = ap->a_flags;
592 struct thread *td = ap->a_td;
593 struct vnode *lvp;
594 int error;
595
596 if (flags & LK_THISLAYER) {
597 if (vp->v_vnlock != NULL) {
598 /* lock is shared across layers */
599 if (flags & LK_INTERLOCK)
600 mtx_unlock(&vp->v_interlock);
601 return 0;
602 }

--- 6 unchanged lines hidden (view full) ---

609 /*
610 * The lower level has exported a struct lock to us. Use
611 * it so that all vnodes in the stack lock and unlock
612 * simultaneously. Note: we don't DRAIN the lock as DRAIN
613 * decommissions the lock - just because our vnode is
614 * going away doesn't mean the struct lock below us is.
615 * LK_EXCLUSIVE is fine.
616 */
617 if ((flags & LK_TYPE_MASK) == LK_DRAIN) {
618 NULLFSDEBUG("null_lock: avoiding LK_DRAIN\n");
619 return(lockmgr(vp->v_vnlock,
620 (flags & ~LK_TYPE_MASK) | LK_EXCLUSIVE,
621 &vp->v_interlock, td));
622 }
623 return(lockmgr(vp->v_vnlock, flags, &vp->v_interlock, td));
624 } else {
625 /*
626 * To prevent race conditions involving doing a lookup
627 * on "..", we have to lock the lower node, then lock our
628 * node. Most of the time it won't matter that we lock our
629 * node (as any locking would need the lower one locked
630 * first). But we can LK_DRAIN the upper lock as a step
631 * towards decomissioning it.

--- 230 unchanged lines hidden ---