summaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorhannken <hannken@NetBSD.org>2022-05-03 07:33:07 +0000
committerhannken <hannken@NetBSD.org>2022-05-03 07:33:07 +0000
commit1946d6b895f8846cf67e9dbe0bb7777115387b28 (patch)
treed6a85f93e1668b4729f9b5172abcdb864cdd5049 /sys/fs
parent77fa97431ce6e1cf197ad4a457ee1e8e68fac4e4 (diff)
Lock devvp for vinvalbuf().
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c9
-rw-r--r--sys/fs/udf/udf_vfsops.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index d8cc91a4071..2dd1d68a5b9 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -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 mount *mp, struct lwp *l,
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 --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index d165569cb25..f4116c938bd 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -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 mount *mp,
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 */