From d86da41736242a86686220896da14758aa3aa3c4 Mon Sep 17 00:00:00 2001 From: riastradh Date: Sat, 15 Oct 2022 15:20:46 +0000 Subject: [PATCH] specfs(9): Attribute blame by stack trace for write to r/o medium. --- sys/miscfs/specfs/spec_vnops.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index cbce90624e8a..906f56b3cde0 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.215 2022/09/21 10:59:10 riastradh Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.216 2022/10/15 15:20:46 riastradh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,7 +58,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.215 2022/09/21 10:59:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.216 2022/10/15 15:20:46 riastradh Exp $"); + +#ifdef _KERNEL_OPT +#include "opt_ddb.h" +#endif #include #include @@ -86,6 +90,10 @@ __KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.215 2022/09/21 10:59:10 riastradh E #include #include +#ifdef DDB +#include +#endif + /* * Lock order: * @@ -1485,6 +1493,9 @@ spec_strategy(void *v) if (mp && (mp->mnt_flag & MNT_RDONLY)) { printf("%s blk %"PRId64" written while ro!\n", mp->mnt_stat.f_mntonname, bp->b_blkno); +#ifdef DDB + db_stacktrace(); +#endif } } #endif /* DIAGNOSTIC */