Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs VOP_GETATTR() needs a shared lock at least.
details: https://anonhg.NetBSD.org/src/rev/f66eb51d3d92
branches: trunk
changeset: 770581:f66eb51d3d92
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Oct 24 11:43:30 2011 +0000
description:
VOP_GETATTR() needs a shared lock at least.
As nfs_kqpoll() ignores the return value from VOP_GETATTR() initialize
the attrributes to zero -- nfs_kqfilter() does the same.
diffstat:
sys/nfs/nfs_kq.c | 9 +++++++--
sys/nfs/nfs_vfsops.c | 6 ++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diffs (67 lines):
diff -r 11bb20c58762 -r f66eb51d3d92 sys/nfs/nfs_kq.c
--- a/sys/nfs/nfs_kq.c Mon Oct 24 07:33:26 2011 +0000
+++ b/sys/nfs/nfs_kq.c Mon Oct 24 11:43:30 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_kq.c,v 1.24 2011/06/12 03:35:59 rmind Exp $ */
+/* $NetBSD: nfs_kq.c,v 1.25 2011/10/24 11:43:30 hannken Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.24 2011/06/12 03:35:59 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.25 2011/10/24 11:43:30 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -138,7 +138,10 @@
/* save v_size, nfs_getattr() updates it */
osize = ke->vp->v_size;
+ memset(&attr, 0, sizeof(attr));
+ vn_lock(ke->vp, LK_SHARED | LK_RETRY);
(void) VOP_GETATTR(ke->vp, &attr, l->l_cred);
+ VOP_UNLOCK(ke->vp);
/* following is a bit fragile, but about best
* we can get */
@@ -318,7 +321,9 @@
* held. This is likely cheap due to attrcache, so do it now.
*/
memset(&attr, 0, sizeof(attr));
+ vn_lock(vp, LK_SHARED | LK_RETRY);
(void) VOP_GETATTR(vp, &attr, l->l_cred);
+ VOP_UNLOCK(vp);
mutex_enter(&nfskq_lock);
diff -r 11bb20c58762 -r f66eb51d3d92 sys/nfs/nfs_vfsops.c
--- a/sys/nfs/nfs_vfsops.c Mon Oct 24 07:33:26 2011 +0000
+++ b/sys/nfs/nfs_vfsops.c Mon Oct 24 11:43:30 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vfsops.c,v 1.219 2011/10/07 09:35:06 hannken Exp $ */
+/* $NetBSD: nfs_vfsops.c,v 1.220 2011/10/24 11:43:30 hannken Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.219 2011/10/07 09:35:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.220 2011/10/24 11:43:30 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@@ -387,7 +387,9 @@
vfs_unbusy(mp, false, NULL);
/* Get root attributes (for the time). */
+ vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, &attr, l->l_cred);
+ VOP_UNLOCK(vp);
if (error)
panic("nfs_mountroot: getattr for root");
n = attr.va_atime.tv_sec;
Home |
Main Index |
Thread Index |
Old Index