Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Unlock vnode for VOP_IOCTL().



details:   https://anonhg.NetBSD.org/src/rev/9fb38e5fd47f
branches:  trunk
changeset: 365239:9fb38e5fd47f
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Apr 16 07:56:45 2022 +0000

description:
Unlock vnode for VOP_IOCTL().

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c |   2 --
 sys/dev/raidframe/rf_netbsdkintf.c                     |  10 +++++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (76 lines):

diff -r 6d780bbd9212 -r 9fb38e5fd47f external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Sat Apr 16 00:15:47 2022 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c    Sat Apr 16 07:56:45 2022 +0000
@@ -132,9 +132,7 @@
        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);
 }
diff -r 6d780bbd9212 -r 9fb38e5fd47f sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sat Apr 16 00:15:47 2022 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sat Apr 16 07:56:45 2022 +0000
@@ -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 @@
 
                        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 @@
                                        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 @@
                                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 @@
 
                        /* 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);
 



Home | Main Index | Thread Index | Old Index