Module Name: src Committed By: hannken Date: Sun Oct 16 12:26:16 UTC 2011
Modified Files: src/sys/miscfs/fdesc: fdesc_vnops.c src/sys/miscfs/procfs: procfs_map.c Log Message: VOP_GETATTR() needs a shared lock at least. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/miscfs/fdesc/fdesc_vnops.c cvs rdiff -u -r1.40 -r1.41 src/sys/miscfs/procfs/procfs_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/miscfs/fdesc/fdesc_vnops.c diff -u src/sys/miscfs/fdesc/fdesc_vnops.c:1.113 src/sys/miscfs/fdesc/fdesc_vnops.c:1.114 --- src/sys/miscfs/fdesc/fdesc_vnops.c:1.113 Sun Jun 12 03:35:58 2011 +++ src/sys/miscfs/fdesc/fdesc_vnops.c Sun Oct 16 12:26:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fdesc_vnops.c,v 1.113 2011/06/12 03:35:58 rmind Exp $ */ +/* $NetBSD: fdesc_vnops.c,v 1.114 2011/10/16 12:26:16 hannken Exp $ */ /* * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.113 2011/06/12 03:35:58 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.114 2011/10/16 12:26:16 hannken Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -446,7 +446,9 @@ fdesc_attr(int fd, struct vattr *vap, ka switch (fp->f_type) { case DTYPE_VNODE: + vn_lock((struct vnode *) fp->f_data, LK_SHARED | LK_RETRY); error = VOP_GETATTR((struct vnode *) fp->f_data, vap, cred); + VOP_UNLOCK((struct vnode *) fp->f_data); if (error == 0 && vap->va_type == VDIR) { /* * directories can cause loops in the namespace, Index: src/sys/miscfs/procfs/procfs_map.c diff -u src/sys/miscfs/procfs/procfs_map.c:1.40 src/sys/miscfs/procfs/procfs_map.c:1.41 --- src/sys/miscfs/procfs/procfs_map.c:1.40 Tue Jul 26 13:18:55 2011 +++ src/sys/miscfs/procfs/procfs_map.c Sun Oct 16 12:26:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_map.c,v 1.40 2011/07/26 13:18:55 yamt Exp $ */ +/* $NetBSD: procfs_map.c,v 1.41 2011/10/16 12:26:16 hannken Exp $ */ /* * Copyright (c) 1993 @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.40 2011/07/26 13:18:55 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.41 2011/10/16 12:26:16 hannken Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -162,7 +162,9 @@ again: if (UVM_ET_ISOBJ(entry) && UVM_OBJ_IS_VNODE(entry->object.uvm_obj)) { vp = (struct vnode *)entry->object.uvm_obj; + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &va, curl->l_cred); + VOP_UNLOCK(vp); if (error == 0 && vp != pfs->pfs_vnode) { fileid = va.va_fileid; dev = va.va_fsid;