Source-Changes-HG archive

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

[src/trunk]: src/sys/fs Lock devvp for vinvalbuf().



details:   https://anonhg.NetBSD.org/src/rev/9db9c37377af
branches:  trunk
changeset: 365911:9db9c37377af
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue May 03 07:33:07 2022 +0000

description:
Lock devvp for vinvalbuf().

diffstat:

 sys/fs/cd9660/cd9660_vfsops.c |  9 ++++++---
 sys/fs/udf/udf_vfsops.c       |  9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 9307e09a9ea2 -r 9db9c37377af sys/fs/cd9660/cd9660_vfsops.c
--- a/sys/fs/cd9660/cd9660_vfsops.c     Tue May 03 07:26:19 2022 +0000
+++ b/sys/fs/cd9660/cd9660_vfsops.c     Tue May 03 07:33:07 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $    */
+/*     $NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $       */
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -358,7 +358,10 @@
                return EROFS;
 
        /* Flush out any old buffers remaining from a previous use. */
-       if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+       vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+       error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+       VOP_UNLOCK(devvp);
+       if (error != 0)
                return (error);
 
        /* This is the "logical sector size".  The standard says this
diff -r 9307e09a9ea2 -r 9db9c37377af sys/fs/udf/udf_vfsops.c
--- a/sys/fs/udf/udf_vfsops.c   Tue May 03 07:26:19 2022 +0000
+++ b/sys/fs/udf/udf_vfsops.c   Tue May 03 07:33:07 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $");
 #endif /* not lint */
 
 
@@ -574,7 +574,10 @@
        int    num_anchors, error;
 
        /* flush out any old buffers remaining from a previous use. */
-       if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)))
+       vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+       error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+       VOP_UNLOCK(devvp);
+       if (error)
                return error;
 
        /* setup basic mount information */



Home | Main Index | Thread Index | Old Index