Module Name:    src
Committed By:   hannken
Date:           Tue May  3 07:33:07 UTC 2022

Modified Files:
        src/sys/fs/cd9660: cd9660_vfsops.c
        src/sys/fs/udf: udf_vfsops.c

Log Message:
Lock devvp for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/udf/udf_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/cd9660/cd9660_vfsops.c
diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.96 src/sys/fs/cd9660/cd9660_vfsops.c:1.97
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.96	Sat Apr  4 20:49:30 2020
+++ src/sys/fs/cd9660/cd9660_vfsops.c	Tue May  3 07:33:07 2022
@@ -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 @@ iso_mountfs(struct vnode *devvp, struct 
 		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

Index: src/sys/fs/udf/udf_vfsops.c
diff -u src/sys/fs/udf/udf_vfsops.c:1.84 src/sys/fs/udf/udf_vfsops.c:1.85
--- src/sys/fs/udf/udf_vfsops.c:1.84	Wed Mar 23 13:06:06 2022
+++ src/sys/fs/udf/udf_vfsops.c	Tue May  3 07:33:07 2022
@@ -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 @@ udf_mountfs(struct vnode *devvp, struct 
 	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 */

Reply via email to