summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authorhannken <hannken@NetBSD.org>2011-10-14 09:23:28 +0000
committerhannken <hannken@NetBSD.org>2011-10-14 09:23:28 +0000
commit6e75bb0dfb296e532c3571fbc1a833003faf481a (patch)
tree51f5f0ca283056d92e4b486cdbe9478c271243b9 /sys/dev/raidframe
parentc8937d29ec57fb2b042e9dea3d3acdecfcbf991f (diff)
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it. The calls from file systems need review. No objections from tech-kern.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_copyback.c9
-rw-r--r--sys/dev/raidframe/rf_disks.c9
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c9
3 files changed, 18 insertions, 9 deletions
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c
index a3460d6e5cf..656d5fb1e78 100644
--- a/sys/dev/raidframe/rf_copyback.c
+++ b/sys/dev/raidframe/rf_copyback.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_copyback.c,v 1.48 2011/08/03 14:44:38 oster Exp $ */
+/* $NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -38,7 +38,7 @@
****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.48 2011/08/03 14:44:38 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -160,7 +160,10 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
/* Ok, so we can at least do a lookup... How about actually
* getting a vp for it? */
- if ((retcode = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0)
+ vn_lock(vp, LK_SHARED | LK_RETRY);
+ retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
+ VOP_UNLOCK(vp);
+ if (retcode != 0)
return;
retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]);
if (retcode) {
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index 2b4f5d8b456..be0757d1581 100644
--- a/sys/dev/raidframe/rf_disks.c
+++ b/sys/dev/raidframe/rf_disks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_disks.c,v 1.81 2011/08/03 14:44:38 oster Exp $ */
+/* $NetBSD: rf_disks.c,v 1.82 2011/10/14 09:23:30 hannken Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -60,7 +60,7 @@
***************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.81 2011/08/03 14:44:38 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.82 2011/10/14 09:23:30 hannken Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -630,7 +630,10 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
raidPtr->bytesPerSector = diskPtr->blockSize;
if (diskPtr->status == rf_ds_optimal) {
- if ((error = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0)
+ vn_lock(vp, LK_SHARED | LK_RETRY);
+ error = VOP_GETATTR(vp, &va, curlwp->l_cred);
+ VOP_UNLOCK(vp);
+ if (error != 0)
return (error);
raidPtr->raid_cinfo[col].ci_vp = vp;
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c
index 1504366d8d3..06943be4c67 100644
--- a/sys/dev/raidframe/rf_reconstruct.c
+++ b/sys/dev/raidframe/rf_reconstruct.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconstruct.c,v 1.116 2011/08/03 15:00:29 oster Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.116 2011/08/03 15:00:29 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $");
#include <sys/param.h>
#include <sys/time.h>
@@ -456,7 +456,10 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col)
/* Ok, so we can at least do a lookup...
How about actually getting a vp for it? */
- if ((retcode = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0) {
+ vn_lock(vp, LK_SHARED | LK_RETRY);
+ retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
+ VOP_UNLOCK(vp);
+ if (retcode != 0) {
vn_close(vp, FREAD | FWRITE, kauth_cred_get());
rf_lock_mutex2(raidPtr->mutex);
raidPtr->reconInProgress--;