Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2012 21:37:27 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236976 - head/sbin/fsck_ffs
Message-ID:  <201206122137.q5CLbReK077123@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jun 12 21:37:27 2012
New Revision: 236976
URL: http://svn.freebsd.org/changeset/base/236976

Log:
  For incompleted block allocations or frees, the inode block count usage
  must be recalculated. The blk_check pass of suj checker explicitely marks
  inodes which owned such blocks as needing block count adjustment. But
  ino_adjblks() is only called by cg_trunc pass, which is performed before
  blk_check. As result, the block use count for such inodes is left wrong.
  This causes full fsck run after journaled run to still find inconsistencies
  like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1.
  
  Fix this issue by running additional adj_blk pass after blk_check, which
  updates the field.
  
  Reviewed by:	jeff, mckusick
  MFC after:	1 week

Modified:
  head/sbin/fsck_ffs/suj.c

Modified: head/sbin/fsck_ffs/suj.c
==============================================================================
--- head/sbin/fsck_ffs/suj.c	Tue Jun 12 21:03:24 2012	(r236975)
+++ head/sbin/fsck_ffs/suj.c	Tue Jun 12 21:37:27 2012	(r236976)
@@ -1789,6 +1789,20 @@ cg_trunc(struct suj_cg *sc)
 	}
 }
 
+static void
+cg_adj_blk(struct suj_cg *sc)
+{
+	struct suj_ino *sino;
+	int i;
+
+	for (i = 0; i < SUJ_HASHSIZE; i++) {
+		LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) {
+			if (sino->si_blkadj)
+				ino_adjblks(sino);
+		}
+	}
+}
+
 /*
  * Free any partially allocated blocks and then resolve inode block
  * counts.
@@ -2720,6 +2734,7 @@ suj_check(const char *filesys)
 		printf("** Processing journal entries.\n");
 		cg_apply(cg_trunc);
 		cg_apply(cg_check_blk);
+		cg_apply(cg_adj_blk);
 		cg_apply(cg_check_ino);
 	}
 	if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") == 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206122137.q5CLbReK077123>