Unlock vnode for VOP_IOCTL().

This commit is contained in:
hannken 2022-04-16 07:56:45 +00:00
parent 72c7fc3f3c
commit 89ddb8af18
2 changed files with 7 additions and 5 deletions

View File

@ -132,9 +132,7 @@ vdev_disk_flush(struct work *work, void *cookie)
KASSERT(vp == dvd->vd_vp);
cmd = 1;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_IOCTL(vp, DIOCCACHESYNC, &cmd, FREAD|FWRITE, kcred);
VOP_UNLOCK(vp, 0);
bp->b_error = error;
vdev_disk_io_intr(bp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_autoconfig.h"
@ -2951,6 +2951,7 @@ rf_find_raid_components(void)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
VOP_UNLOCK(vp);
if (error) {
/* "Who cares." Continue looking
@ -2970,6 +2971,7 @@ rf_find_raid_components(void)
printf("RAIDframe: can't get disk size"
" for dev %s (%d)\n",
device_xname(dv), error);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
vput(vp);
continue;
@ -2981,18 +2983,19 @@ rf_find_raid_components(void)
if (error) {
printf("RAIDframe: can't get wedge info for "
"dev %s (%d)\n", device_xname(dv), error);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
vput(vp);
continue;
}
if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
vput(vp);
continue;
}
VOP_UNLOCK(vp);
ac_list = rf_get_component(ac_list, dev, vp,
device_xname(dv), dkw.dkw_size, numsecs, secsize);
rf_part_found = 1; /*There is a raid component on this disk*/
@ -3013,6 +3016,7 @@ rf_find_raid_components(void)
/* don't need this any more. We'll allocate it again
a little later if we really do... */
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
vput(vp);