summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2020-06-19 19:29:39 +0000
committerjdolecek <jdolecek@NetBSD.org>2020-06-19 19:29:39 +0000
commita17d07ef62d88312cc47a8c8a4377005e8d2de4c (patch)
tree1e2df8e1b20f9ac94b11a646ce050fcffe0c409d /sys/dev
parent9b92f961e9b186a31c7262a51e9dd1fd1e283039 (diff)
pass down b_flags B_PHYS|B_RAW|B_MEDIA_FLAGS from bio subsystem
to component I/O fixes the xbd(4) KASSERT() triggered by raidframe, noted in PR kern/55397 by Frank Kardel
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/raidframe/rf_dag.h4
-rw-r--r--sys/dev/raidframe/rf_dagfuncs.c16
-rw-r--r--sys/dev/raidframe/rf_diskqueue.c11
-rw-r--r--sys/dev/raidframe/rf_diskqueue.h6
-rw-r--r--sys/dev/raidframe/rf_netbsd.h4
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c17
6 files changed, 26 insertions, 32 deletions
diff --git a/sys/dev/raidframe/rf_dag.h b/sys/dev/raidframe/rf_dag.h
index 88da5126fc4..3f0effe73c9 100644
--- a/sys/dev/raidframe/rf_dag.h
+++ b/sys/dev/raidframe/rf_dag.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dag.h,v 1.20 2019/10/10 03:43:59 christos Exp $ */
+/* $NetBSD: rf_dag.h,v 1.21 2020/06/19 19:29:39 jdolecek Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -178,7 +178,7 @@ struct RF_DagHeader_s {
RF_Raid_t *raidPtr; /* the descriptor for the RAID device this DAG
* is for */
RF_RaidAccessDesc_t *desc; /* ptr to descriptor for this access */
- void *bp; /* the bp for this I/O passed down from the
+ const struct buf *bp; /* the bp for this I/O passed down from the
* file system. ignored outside kernel */
};
diff --git a/sys/dev/raidframe/rf_dagfuncs.c b/sys/dev/raidframe/rf_dagfuncs.c
index 43e74f6103f..d09fdc1bcb8 100644
--- a/sys/dev/raidframe/rf_dagfuncs.c
+++ b/sys/dev/raidframe/rf_dagfuncs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $ */
+/* $NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -272,10 +272,6 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node)
unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_READ : RF_IO_TYPE_NOP;
RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues;
- void *b_proc = NULL;
-
- if (node->dagHdr->bp)
- b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc;
req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
bf, parityStripeID, which_ru, node->wakeFunc, node,
@@ -284,7 +280,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node)
#else
NULL,
#endif
- (void *) (node->dagHdr->raidPtr), 0, b_proc, PR_NOWAIT);
+ (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp, PR_NOWAIT);
if (!req) {
(node->wakeFunc) (node, ENOMEM);
} else {
@@ -308,10 +304,6 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node)
unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_WRITE : RF_IO_TYPE_NOP;
RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues;
- void *b_proc = NULL;
-
- if (node->dagHdr->bp)
- b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc;
/* normal processing (rollaway or forward recovery) begins here */
req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
@@ -322,7 +314,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node)
NULL,
#endif
(void *) (node->dagHdr->raidPtr),
- 0, b_proc, PR_NOWAIT);
+ 0, node->dagHdr->bp, PR_NOWAIT);
if (!req) {
(node->wakeFunc) (node, ENOMEM);
diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c
index 356bda0da59..6312168d3ad 100644
--- a/sys/dev/raidframe/rf_diskqueue.c
+++ b/sys/dev/raidframe/rf_diskqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $ */
+/* $NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -66,7 +66,7 @@
****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -362,7 +362,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
RF_ReconUnitNum_t which_ru,
void (*wakeF) (void *, int), void *arg,
RF_AccTraceEntry_t *tracerec, RF_Raid_t *raidPtr,
- RF_DiskQueueDataFlags_t flags, void *kb_proc,
+ RF_DiskQueueDataFlags_t flags, const struct buf *mbp,
int waitflag)
{
RF_DiskQueueData_t *p;
@@ -381,6 +381,10 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
return (NULL);
}
SET(p->bp->b_cflags, BC_BUSY); /* mark buffer busy */
+ if (mbp) {
+ SET(p->bp->b_flags, mbp->b_flags & rf_b_pass);
+ p->bp->b_proc = mbp->b_proc;
+ }
p->sectorOffset = ssect + rf_protectedSectors;
p->numSector = nsect;
@@ -395,7 +399,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
p->priority = RF_IO_NORMAL_PRIORITY;
p->raidPtr = raidPtr;
p->flags = flags;
- p->b_proc = kb_proc;
return (p);
}
diff --git a/sys/dev/raidframe/rf_diskqueue.h b/sys/dev/raidframe/rf_diskqueue.h
index 6b0728bdb7c..11ae4ddec55 100644
--- a/sys/dev/raidframe/rf_diskqueue.h
+++ b/sys/dev/raidframe/rf_diskqueue.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.h,v 1.25 2019/10/10 03:43:59 christos Exp $ */
+/* $NetBSD: rf_diskqueue.h,v 1.26 2020/06/19 19:29:39 jdolecek Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -74,8 +74,6 @@ struct RF_DiskQueueData_s {
* targeted */
RF_DiskQueueDataFlags_t flags; /* flags controlling operation */
- struct proc *b_proc; /* the b_proc from the original bp passed into
- * the driver for this I/O */
struct buf *bp; /* a bp to use to get this I/O done */
/* TAILQ bits for a queue for completed I/O requests */
TAILQ_ENTRY(RF_DiskQueueData_s) iodone_entries;
@@ -145,7 +143,7 @@ RF_DiskQueueData_t *rf_CreateDiskQueueData(RF_IoType_t, RF_SectorNum_t,
void *,
RF_AccTraceEntry_t *, RF_Raid_t *,
RF_DiskQueueDataFlags_t,
- void *, int);
+ const struct buf *, int);
void rf_FreeDiskQueueData(RF_DiskQueueData_t *);
int rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *,
RF_RowCol_t, const RF_DiskQueueSW_t *,
diff --git a/sys/dev/raidframe/rf_netbsd.h b/sys/dev/raidframe/rf_netbsd.h
index 1d9fe59c119..baa4f6c815d 100644
--- a/sys/dev/raidframe/rf_netbsd.h
+++ b/sys/dev/raidframe/rf_netbsd.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsd.h,v 1.34 2019/10/10 03:43:59 christos Exp $ */
+/* $NetBSD: rf_netbsd.h,v 1.35 2020/06/19 19:29:39 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -104,4 +104,6 @@ typedef struct RF_ConfigSet_s {
struct RF_ConfigSet_s *next;
} RF_ConfigSet_t;
+extern const int rf_b_pass;
+
#endif /* _RF__RF_NETBSDSTUFF_H_ */
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 876155dc12a..54fec7836ae 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.383 2020/06/16 14:45:08 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.384 2020/06/19 19:29:39 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.383 2020/06/16 14:45:08 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.384 2020/06/19 19:29:39 jdolecek Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_autoconfig.h"
@@ -175,13 +175,15 @@ static RF_SparetWait_t *rf_sparet_resp_queue; /* responses from
* installation process */
#endif
+const int rf_b_pass = (B_PHYS|B_RAW|B_MEDIA_FLAGS);
+
MALLOC_DEFINE(M_RAIDFRAME, "RAIDframe", "RAIDframe structures");
/* prototypes */
static void KernelWakeupFunc(struct buf *);
static void InitBP(struct buf *, struct vnode *, unsigned,
dev_t, RF_SectorNum_t, RF_SectorCount_t, void *, void (*) (struct buf *),
- void *, int, struct proc *);
+ void *, int);
static void raidinit(struct raid_softc *);
static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp);
static int rf_get_component_caches(RF_Raid_t *raidPtr, int *);
@@ -2004,7 +2006,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queue, RF_DiskQueueData_t *req)
op, queue->rf_cinfo->ci_dev,
req->sectorOffset, req->numSector,
req->buf, KernelWakeupFunc, (void *) req,
- queue->raidPtr->logBytesPerSector, req->b_proc);
+ queue->raidPtr->logBytesPerSector);
if (rf_debugKernelAccess) {
db1_printf(("dispatch: bp->b_blkno = %ld\n",
@@ -2120,11 +2122,9 @@ KernelWakeupFunc(struct buf *bp)
static void
InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev,
RF_SectorNum_t startSect, RF_SectorCount_t numSect, void *bf,
- void (*cbFunc) (struct buf *), void *cbArg, int logBytesPerSector,
- struct proc *b_proc)
+ void (*cbFunc) (struct buf *), void *cbArg, int logBytesPerSector)
{
- /* bp->b_flags = B_PHYS | rw_flag; */
- bp->b_flags = rw_flag; /* XXX need B_PHYS here too??? */
+ bp->b_flags = rw_flag | (bp->b_flags & rf_b_pass);
bp->b_oflags = 0;
bp->b_cflags = 0;
bp->b_bcount = numSect << logBytesPerSector;
@@ -2137,7 +2137,6 @@ InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev,
if (bp->b_bcount == 0) {
panic("bp->b_bcount is zero in InitBP!!");
}
- bp->b_proc = b_proc;
bp->b_iodone = cbFunc;
bp->b_private = cbArg;
}