Source-Changes-HG archive

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

[src/netbsd-10]: src/sys Pull up following revision(s) (requested by hannken ...



details:   https://anonhg.NetBSD.org/src/rev/4ee537b22baa
branches:  netbsd-10
changeset: 376511:4ee537b22baa
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 21 16:55:01 2023 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #197):

        sys/ufs/ffs/ffs_vfsops.c: revision 1.381
        sys/dev/raidframe/rf_netbsdkintf.c: revision 1.412

Undo unlock/relock for VOP_IOCTL().
PR kern/57450 (unplugging hung USB disk triggers panic via _vstate_assert)

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  10 +++-------
 sys/ufs/ffs/ffs_vfsops.c           |   8 ++------
 2 files changed, 5 insertions(+), 13 deletions(-)

diffs (102 lines):

diff -r edf2a33f444c -r 4ee537b22baa sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Wed Jun 21 16:52:28 2023 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Wed Jun 21 16:55:01 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.410 2022/08/28 00:37:41 oster Exp $       */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.410.4.1 2023/06/21 16:55:01 martin 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.410 2022/08/28 00:37:41 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.410.4.1 2023/06/21 16:55:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2958,7 +2958,6 @@ rf_find_raid_components(void)
                                continue;
                        }
 
-                       VOP_UNLOCK(vp);
                        error = getdisksize(vp, &numsecs, &secsize);
                        if (error) {
                                /*
@@ -2970,7 +2969,6 @@ 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;
@@ -2982,19 +2980,18 @@ 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*/
@@ -3015,7 +3012,6 @@ 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);
 
diff -r edf2a33f444c -r 4ee537b22baa sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Wed Jun 21 16:52:28 2023 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Wed Jun 21 16:55:01 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.378.2.1 2022/12/21 19:54:13 martin Exp $      */
+/*     $NetBSD: ffs_vfsops.c,v 1.378.2.2 2023/06/21 16:55:02 martin Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.378.2.1 2022/12/21 19:54:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.378.2.2 2023/06/21 16:55:02 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2521,9 +2521,7 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
                 * contains no dirty buffers that could be in the log.
                 */
                if (!LIST_EMPTY(&vp->v_dirtyblkhd)) {
-                       VOP_UNLOCK(vp);
                        error = wapbl_flush(mp->mnt_wapbl, 0);
-                       vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                        if (error)
                                return error;
                }
@@ -2542,10 +2540,8 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
        error = vflushbuf(vp, flags);
        if (error == 0 && (flags & FSYNC_CACHE) != 0) {
                i = 1;
-               VOP_UNLOCK(vp);
                (void)VOP_IOCTL(vp, DIOCCACHESYNC, &i, FWRITE,
                    kauth_cred_get());
-               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        }
 
        return error;



Home | Main Index | Thread Index | Old Index