Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs VOP_GETATTR() needs a shared lock at least.



details:   https://anonhg.NetBSD.org/src/rev/4ef0064d1061
branches:  trunk
changeset: 770424:4ef0064d1061
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Oct 16 12:26:16 2011 +0000

description:
VOP_GETATTR() needs a shared lock at least.

diffstat:

 sys/miscfs/fdesc/fdesc_vnops.c |  6 ++++--
 sys/miscfs/procfs/procfs_map.c |  6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r ce961110f47d -r 4ef0064d1061 sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Sun Oct 16 08:28:10 2011 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Sun Oct 16 12:26:16 2011 +0000
@@ -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 @@
 
        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,
diff -r ce961110f47d -r 4ef0064d1061 sys/miscfs/procfs/procfs_map.c
--- a/sys/miscfs/procfs/procfs_map.c    Sun Oct 16 08:28:10 2011 +0000
+++ b/sys/miscfs/procfs/procfs_map.c    Sun Oct 16 12:26:16 2011 +0000
@@ -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 @@
                        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;



Home | Main Index | Thread Index | Old Index