vfs_export.c (24487) | vfs_export.c (24624) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 |
39 * $Id: vfs_subr.c,v 1.80 1997/03/05 04:54:54 davidg Exp $ | 39 * $Id: vfs_subr.c,v 1.81 1997/04/01 13:05:34 bde Exp $ |
40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46#include "opt_devfs.h" 47 --- 818 unchanged lines hidden (view full) --- 866 867/* 868 * Stubs to use when there is no locking to be done on the underlying object. 869 * A minimal shared lock is necessary to ensure that the underlying object 870 * is not revoked while an operation is in progress. So, an active shared 871 * count is maintained in an auxillary vnode lock structure. 872 */ 873int | 40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46#include "opt_devfs.h" 47 --- 818 unchanged lines hidden (view full) --- 866 867/* 868 * Stubs to use when there is no locking to be done on the underlying object. 869 * A minimal shared lock is necessary to ensure that the underlying object 870 * is not revoked while an operation is in progress. So, an active shared 871 * count is maintained in an auxillary vnode lock structure. 872 */ 873int |
874vop_sharedlock(ap) 875 struct vop_lock_args /* { 876 struct vnode *a_vp; 877 int a_flags; 878 struct proc *a_p; 879 } */ *ap; 880{ 881 /* 882 * This code cannot be used until all the non-locking filesystems 883 * (notably NFS) are converted to properly lock and release nodes. 884 * Also, certain vnode operations change the locking state within 885 * the operation (create, mknod, remove, link, rename, mkdir, rmdir, 886 * and symlink). Ideally these operations should not change the 887 * lock state, but should be changed to let the caller of the 888 * function unlock them. Otherwise all intermediate vnode layers 889 * (such as union, umapfs, etc) must catch these functions to do 890 * the necessary locking at their layer. Note that the inactive 891 * and lookup operations also change their lock state, but this 892 * cannot be avoided, so these two operations will always need 893 * to be handled in intermediate layers. 894 */ 895 struct vnode *vp = ap->a_vp; 896 int vnflags, flags = ap->a_flags; 897 898 if (vp->v_vnlock == NULL) { 899 if ((flags & LK_TYPE_MASK) == LK_DRAIN) 900 return (0); 901 MALLOC(vp->v_vnlock, struct lock *, sizeof(struct lock), 902 M_VNODE, M_WAITOK); 903 lockinit(vp->v_vnlock, PVFS, "vnlock", 0, 0); 904 } 905 switch (flags & LK_TYPE_MASK) { 906 case LK_DRAIN: 907 vnflags = LK_DRAIN; 908 break; 909 case LK_EXCLUSIVE: 910#ifdef DEBUG_VFS_LOCKS 911 /* 912 * Normally, we use shared locks here, but that confuses 913 * the locking assertions. 914 */ 915 vnflags = LK_EXCLUSIVE; 916 break; 917#endif 918 case LK_SHARED: 919 vnflags = LK_SHARED; 920 break; 921 case LK_UPGRADE: 922 case LK_EXCLUPGRADE: 923 case LK_DOWNGRADE: 924 return (0); 925 case LK_RELEASE: 926 default: 927 panic("vop_nolock: bad operation %d", flags & LK_TYPE_MASK); 928 } 929 if (flags & LK_INTERLOCK) 930 vnflags |= LK_INTERLOCK; 931 return(lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p)); 932} 933 934/* 935 * Stubs to use when there is no locking to be done on the underlying object. 936 * A minimal shared lock is necessary to ensure that the underlying object 937 * is not revoked while an operation is in progress. So, an active shared 938 * count is maintained in an auxillary vnode lock structure. 939 */ 940int |
|
874vop_nolock(ap) 875 struct vop_lock_args /* { 876 struct vnode *a_vp; 877 int a_flags; 878 struct proc *a_p; 879 } */ *ap; 880{ 881#ifdef notyet --- 404 unchanged lines hidden (view full) --- 1286 * Reclaim the vnode. 1287 */ 1288 if (VOP_RECLAIM(vp, p)) 1289 panic("vclean: cannot reclaim"); 1290 if (active) 1291 vrele(vp); 1292 cache_purge(vp); 1293 if (vp->v_vnlock) { | 941vop_nolock(ap) 942 struct vop_lock_args /* { 943 struct vnode *a_vp; 944 int a_flags; 945 struct proc *a_p; 946 } */ *ap; 947{ 948#ifdef notyet --- 404 unchanged lines hidden (view full) --- 1353 * Reclaim the vnode. 1354 */ 1355 if (VOP_RECLAIM(vp, p)) 1356 panic("vclean: cannot reclaim"); 1357 if (active) 1358 vrele(vp); 1359 cache_purge(vp); 1360 if (vp->v_vnlock) { |
1361#ifdef DIAGNOSTIC |
|
1294 if ((vp->v_vnlock->lk_flags & LK_DRAINED) == 0) 1295 vprint("vclean: lock not drained", vp); | 1362 if ((vp->v_vnlock->lk_flags & LK_DRAINED) == 0) 1363 vprint("vclean: lock not drained", vp); |
1364#endif |
|
1296 FREE(vp->v_vnlock, M_VNODE); 1297 vp->v_vnlock = NULL; 1298 } 1299 1300 /* 1301 * Done with purge, notify sleepers of the grim news. 1302 */ 1303 vp->v_op = dead_vnodeop_p; --- 272 unchanged lines hidden (view full) --- 1576void 1577vprint(label, vp) 1578 char *label; 1579 register struct vnode *vp; 1580{ 1581 char buf[64]; 1582 1583 if (label != NULL) | 1365 FREE(vp->v_vnlock, M_VNODE); 1366 vp->v_vnlock = NULL; 1367 } 1368 1369 /* 1370 * Done with purge, notify sleepers of the grim news. 1371 */ 1372 vp->v_op = dead_vnodeop_p; --- 272 unchanged lines hidden (view full) --- 1645void 1646vprint(label, vp) 1647 char *label; 1648 register struct vnode *vp; 1649{ 1650 char buf[64]; 1651 1652 if (label != NULL) |
1584 printf("%s: ", label); | 1653 printf("%s: %x: ", label, vp); 1654 else 1655 printf("%x: ", vp); |
1585 printf("type %s, usecount %d, writecount %d, refcount %ld,", 1586 typename[vp->v_type], vp->v_usecount, vp->v_writecount, 1587 vp->v_holdcnt); 1588 buf[0] = '\0'; 1589 if (vp->v_flag & VROOT) 1590 strcat(buf, "|VROOT"); 1591 if (vp->v_flag & VTEXT) 1592 strcat(buf, "|VTEXT"); --- 486 unchanged lines hidden --- | 1656 printf("type %s, usecount %d, writecount %d, refcount %ld,", 1657 typename[vp->v_type], vp->v_usecount, vp->v_writecount, 1658 vp->v_holdcnt); 1659 buf[0] = '\0'; 1660 if (vp->v_flag & VROOT) 1661 strcat(buf, "|VROOT"); 1662 if (vp->v_flag & VTEXT) 1663 strcat(buf, "|VTEXT"); --- 486 unchanged lines hidden --- |