NetBSD Problem Report #51422
From jose@pc2.bigmail.com Thu Aug 18 02:31:32 2016
Return-Path: <jose@pc2.bigmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 7E7D57A2A8
for <gnats-bugs@gnats.NetBSD.org>; Thu, 18 Aug 2016 02:31:32 +0000 (UTC)
Message-Id: <20160818023117.BC68023EBDF5@pc2.bigmail.com>
Date: Thu, 18 Aug 2016 04:31:17 +0200 (CEST)
From: joseyluis@gmail.com
Reply-To: joseyluis@gmail.com
To: gnats-bugs@NetBSD.org
Subject: unnecesary assignation in buf_destroy sbin/fsck_lfs/bufcache.c
X-Send-Pr-Version: 3.95
>Number: 51422
>Category: bin
>Synopsis: unnecesary assignation in buf_destroy sbin/fsck_lfs/bufcache.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 18 02:35:00 +0000 2016
>Closed-Date: Sun Nov 13 23:26:13 +0000 2016
>Last-Modified: Sun Nov 13 23:26:13 +0000 2016
>Originator: Jose Luis Rodriguez Garcia
>Release: current
>Organization:
>Environment:
>Description:
In bufcache.c the assignation bp->b_flags |= B_NEEDCOMMIT; is
unncesary because in the same function bp is freed with: free(bp);is
>How-To-Repeat:
code review
>Fix:
Index: bufcache.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/bufcache.c,v
retrieving revision 1.16
diff -u -r1.16 bufcache.c
--- bufcache.c 31 Jul 2016 18:27:26 -0000 1.16
+++ bufcache.c 18 Aug 2016 02:17:21 -0000
@@ -155,7 +155,6 @@
void
buf_destroy(struct ubuf * bp)
{
- bp->b_flags |= B_NEEDCOMMIT;
LIST_REMOVE(bp, b_vnbufs);
LIST_REMOVE(bp, b_hash);
if (!(bp->b_flags & B_DONTFREE))
>Release-Note:
>Audit-Trail:
From: Jose Luis Rodriguez Garcia <joseyluis@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/51422: unnecesary assignation in buf_destroy sbin/fsck_lfs/bufcache.c
Date: Thu, 18 Aug 2016 05:20:58 +0200
Lookin further, it seems that B_NEEDCOMMIT is only used in
sys/fs/nfs/client and sys/fs/smbfs.
What was the purpose of the author of the code using B_NEEDCOMMIT?
I send a new patch removing B_NEEDCOMMIT from the user bufer cache of lfs:
Index: bufcache.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/bufcache.c,v
retrieving revision 1.16
diff -u -r1.16 bufcache.c
--- bufcache.c 31 Jul 2016 18:27:26 -0000 1.16
+++ bufcache.c 18 Aug 2016 03:18:03 -0000
@@ -155,7 +155,6 @@
void
buf_destroy(struct ubuf * bp)
{
- bp->b_flags |= B_NEEDCOMMIT;
LIST_REMOVE(bp, b_vnbufs);
LIST_REMOVE(bp, b_hash);
if (!(bp->b_flags & B_DONTFREE))
@@ -231,7 +230,6 @@
* the buffer, its contents are invalid; but shrinking is okay.
*/
if ((bp = incore(vp, lbn)) != NULL) {
- assert(!(bp->b_flags & B_NEEDCOMMIT));
assert(!(bp->b_flags & B_BUSY));
bp->b_flags |= B_BUSY;
bremfree(bp);
@@ -309,7 +307,6 @@
{
int age;
- assert(!(bp->b_flags & B_NEEDCOMMIT));
assert(bp->b_flags & B_BUSY);
bp->b_flags |= set;
Index: bufcache.h
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/bufcache.h,v
retrieving revision 1.12
diff -u -r1.12 bufcache.h
--- bufcache.h 29 Mar 2015 19:35:58 -0000 1.12
+++ bufcache.h 18 Aug 2016 03:18:03 -0000
@@ -92,7 +92,6 @@
* These flags are kept in b_flags.
*/
#define B_AGE 0x00000001 /* Move to age queue
when I/O done. */
-#define B_NEEDCOMMIT 0x00000002 /* Needs committing to
stable storage */
#define B_BUSY 0x00000010 /* I/O in progress. */
#define B_DELWRI 0x00000080 /* Delay I/O until
buffer reused. */
#define B_DONE 0x00000200 /* I/O completed. */
On Thu, Aug 18, 2016 at 4:35 AM, <gnats-admin@netbsd.org> wrote:
> Thank you very much for your problem report.
> It has the internal identification `bin/51422'.
> The individual assigned to look at your
> report is: bin-bug-people.
>
>>Category: bin
>>Responsible: bin-bug-people
>>Synopsis: unnecesary assignation in buf_destroy sbin/fsck_lfs/bufcache.c
>>Arrival-Date: Thu Aug 18 02:35:00 +0000 2016
>
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51422 CVS commit: src/sbin/fsck_lfs
Date: Thu, 18 Aug 2016 04:04:28 -0400
Module Name: src
Committed By: christos
Date: Thu Aug 18 08:04:28 UTC 2016
Modified Files:
src/sbin/fsck_lfs: bufcache.c
Log Message:
PR/51422: Jose Luis Rodriguez Garcia: Remove unnecessary assignment.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck_lfs/bufcache.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51422 CVS commit: src/sbin/fsck_lfs
Date: Thu, 18 Aug 2016 04:08:02 -0400
Module Name: src
Committed By: christos
Date: Thu Aug 18 08:08:02 UTC 2016
Modified Files:
src/sbin/fsck_lfs: bufcache.c bufcache.h
Log Message:
PR/51422: Jose Luis Rodriguez Garcia: completely remove B_NEEDCOMMIT
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/fsck_lfs/bufcache.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_lfs/bufcache.h
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: dholland@NetBSD.org
State-Changed-When: Sun, 13 Nov 2016 23:26:13 +0000
State-Changed-Why:
christos committed it in august
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.