Module Name: src
Committed By: hannken
Date: Wed Mar 1 10:46:05 UTC 2017
Modified Files:
src/sys/miscfs/specfs: spec_vnops.c
Log Message:
Add a diagnostic test for buffers written to a block device holding
a read-only mounted file system.
This will become a KASSERT in the near future.
To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/miscfs/specfs/spec_vnops.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/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.168 src/sys/miscfs/specfs/spec_vnops.c:1.169
--- src/sys/miscfs/specfs/spec_vnops.c:1.168 Mon Jan 2 10:33:28 2017
+++ src/sys/miscfs/specfs/spec_vnops.c Wed Mar 1 10:46:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.168 2017/01/02 10:33:28 hannken Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.169 2017/03/01 10:46:05 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.168 2017/01/02 10:33:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.169 2017/03/01 10:46:05 hannken Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -1053,6 +1053,16 @@ spec_strategy(void *v)
bp->b_dev = dev;
if (!(bp->b_flags & B_READ)) {
+#ifdef DIAGNOSTIC
+ if (bp->b_vp && bp->b_vp->v_type == VBLK) {
+ struct mount *mp = spec_node_getmountedfs(bp->b_vp);
+
+ if (mp && (mp->mnt_flag & MNT_RDONLY)) {
+ printf("%s blk %"PRId64" written while ro!\n",
+ mp->mnt_stat.f_mntonname, bp->b_blkno);
+ }
+ }
+#endif /* DIAGNOSTIC */
error = fscow_run(bp, false);
if (error)
goto out;