NetBSD Problem Report #42342
From nakayosh@leto.eonet.ne.jp Wed Nov 18 14:37:52 2009
Return-Path: <nakayosh@leto.eonet.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 26A4663C489
for <gnats-bugs@gnats.NetBSD.org>; Wed, 18 Nov 2009 14:37:52 +0000 (UTC)
Message-Id: <20091118143748.71E9D1B7278@ae0000-mailauth12.eo.k-opti.ad.jp>
Date: Wed, 18 Nov 2009 23:37:48 +0900 (JST)
From: nakayosh@leto.eonet.ne.jp
Reply-To: nakayosh@leto.eonet.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Subject: LFS: b_[co]?flags and their values mismatch
X-Send-Pr-Version: 3.95
>Number: 42342
>Category: kern
>Synopsis: LFS: b_[co]?flags and their values mismatch
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: dholland
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 18 14:40:01 +0000 2009
>Closed-Date: Sat Jun 09 19:04:46 +0000 2018
>Last-Modified: Sat Jun 09 19:04:46 +0000 2018
>Originator: NAKAJIMA Yoshihiro
>Release: NetBSD-current/20091113
>Organization:
>Environment:
System: NetBSD asura 5.99.22 NetBSD 5.99.22 (ASURA) #1: Wed Nov 18 23:06:44 JST 2009 nakayosh@asura:/usr/src/sys/arch/amd64/compile/ASURA amd64
Architecture: x86_64
Machine: amd64
>Description:
After NetBSD 4.0, b_flags in struct buf was split to b_flags,
b_cflags and b_oflags. But some variables remain unchanged in LFS.
>How-To-Repeat:
>Fix:
Date: Wed Nov 18 23:12:53 JST 2009
diff -u src/sys/ufs/lfs/lfs_bio.c.ORIG src/sys/ufs/lfs/lfs_bio.c
--- src/sys/ufs/lfs/lfs_bio.c.ORIG 2008-05-07 03:43:45.000000000 +0900
+++ src/sys/ufs/lfs/lfs_bio.c 2009-11-18 22:38:40.000000000 +0900
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_bio.c,v 1.114 2008/05/06 18:43:45 ad Exp $ */
+/* $NetBSD$ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -448,8 +448,7 @@
ASSERT_MAYBE_SEGLOCK(fs);
KASSERT(bp->b_cflags & BC_BUSY);
KASSERT(flags & BW_CLEAN || !LFS_IS_MALLOC_BUF(bp));
- KASSERT(((bp->b_oflags | bp->b_flags) & (BO_DELWRI|B_LOCKED))
- != BO_DELWRI);
+ KASSERT((bp->b_flags & B_LOCKED) || !(bp->b_oflags & BO_DELWRI));
/*
* Don't write *any* blocks if we're mounted read-only, or
diff -u src/sys/ufs/lfs/lfs_segment.c.ORIG src/sys/ufs/lfs/lfs_segment.c
--- src/sys/ufs/lfs/lfs_segment.c.ORIG 2009-08-07 22:58:38.000000000 +0900
+++ src/sys/ufs/lfs/lfs_segment.c 2009-11-18 23:02:19.000000000 +0900
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_segment.c,v 1.214 2009/08/07 13:58:38 wiz Exp $ */
+/* $NetBSD$ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -1372,13 +1372,13 @@
continue;
}
#ifdef DIAGNOSTIC
-# ifdef LFS_USE_B_INVAL
- if ((bp->b_flags & BC_INVAL) != 0 && bp->b_iodone == NULL) {
+# ifdef LFS_USE_BC_INVAL
+ if ((bp->b_cflags & BC_INVAL) != 0 && bp->b_iodone == NULL) {
DLOG((DLOG_SEG, "lfs_gather: lbn %" PRId64
" is BC_INVAL\n", bp->b_lblkno));
VOP_PRINT(bp->b_vp);
}
-# endif /* LFS_USE_B_INVAL */
+# endif /* LFS_USE_BC_INVAL */
if (!(bp->b_oflags & BO_DELWRI))
panic("lfs_gather: bp not BO_DELWRI");
if (!(bp->b_flags & B_LOCKED)) {
@@ -2037,7 +2037,7 @@
LFS_WRITESEGENTRY(sup, fs, sp->seg_number, bp); /* Ifile */
/*
- * Mark blocks B_BUSY, to prevent then from being changed between
+ * Mark blocks BC_BUSY, to prevent then from being changed between
* the checksum computation and the actual write.
*
* If we are cleaning, check indirect blocks for UNWRITTEN, and if
@@ -2149,7 +2149,7 @@
/* Loop through gop_write cluster blocks */
for (byteoffset = 0; byteoffset < (*bpp)->b_bcount;
byteoffset += fs->lfs_bsize) {
-#ifdef LFS_USE_B_INVAL
+#ifdef LFS_USE_BC_INVAL
if (((*bpp)->b_cflags & BC_INVAL) != 0 &&
(*bpp)->b_iodone != NULL) {
if (copyin((void *)(*bpp)->b_saveaddr +
@@ -2160,7 +2160,7 @@
(*bpp)->b_lblkno);
}
} else
-#endif /* LFS_USE_B_INVAL */
+#endif /* LFS_USE_BC_INVAL */
{
sum = lfs_cksum_part((char *)
(*bpp)->b_data + byteoffset, el_size, sum);
@@ -2256,9 +2256,9 @@
}
#endif
-#ifdef LFS_USE_B_INVAL
+#ifdef LFS_USE_BC_INVAL
/*
- * Fake buffers from the cleaner are marked as B_INVAL.
+ * Fake buffers from the cleaner are marked as BC_INVAL.
* We need to copy the data from user space rather than
* from the buffer indicated.
* XXX == what do I do on an error?
@@ -2269,7 +2269,7 @@
panic("lfs_writeseg: "
"copyin failed [2]");
} else
-#endif /* LFS_USE_B_INVAL */
+#endif /* LFS_USE_BC_INVAL */
if (cl->flags & LFS_CL_MALLOC) {
/* copy data into our cluster. */
memcpy(p, bp->b_data, bp->b_bcount);
@@ -2520,8 +2520,7 @@
tbp->b_flags |= B_ASYNC; /* for biodone */
}
- if (((tbp->b_flags | tbp->b_oflags) &
- (B_LOCKED | BO_DELWRI)) == B_LOCKED)
+ if ((tbp->b_flags & B_LOCKED) && !(tbp->b_oflags & BO_DELWRI))
LFS_UNLOCK_BUF(tbp);
if (tbp->b_oflags & BO_DONE) {
@@ -2548,7 +2547,7 @@
tbp->b_flags |= B_ASYNC;
/* Master buffers have BC_AGE */
if (tbp->b_private == tbp)
- tbp->b_flags |= BC_AGE;
+ tbp->b_cflags |= BC_AGE;
}
mutex_exit(&bufcache_lock);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sun, 22 Nov 2009 07:10:10 +0000
Responsible-Changed-Why:
lfs
From: "Zafer Aydogan" <zafer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42342 CVS commit: src/sys/ufs/lfs
Date: Sat, 9 Jun 2018 18:48:31 +0000
Module Name: src
Committed By: zafer
Date: Sat Jun 9 18:48:31 UTC 2018
Modified Files:
src/sys/ufs/lfs: lfs_bio.c lfs_segment.c
Log Message:
Add missing b_cflags and b_oflags.
Ok dholland@
Addresses PR kern/42342 by Yoshihiro Nakajima
To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/ufs/lfs/lfs_bio.c
cvs rdiff -u -r1.276 -r1.277 src/sys/ufs/lfs/lfs_segment.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: zafer@NetBSD.org
State-Changed-When: Sat, 09 Jun 2018 19:04:46 +0000
State-Changed-Why:
Applied. Thank you Yoshihiro Nakajima.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.