From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 19 10:04:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E59C106566B; Tue, 19 Jun 2012 10:04:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289478FC14; Tue, 19 Jun 2012 10:04:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JA4a3E035040; Tue, 19 Jun 2012 10:04:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JA4auO035038; Tue, 19 Jun 2012 10:04:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206191004.q5JA4auO035038@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Jun 2012 10:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237265 - stable/9/sbin/fsck_ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 10:04:37 -0000 Author: kib Date: Tue Jun 19 10:04:36 2012 New Revision: 237265 URL: http://svn.freebsd.org/changeset/base/237265 Log: MFC r236976: 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. Modified: stable/9/sbin/fsck_ffs/suj.c Directory Properties: stable/9/sbin/fsck_ffs/ (props changed) Modified: stable/9/sbin/fsck_ffs/suj.c ============================================================================== --- stable/9/sbin/fsck_ffs/suj.c Tue Jun 19 08:12:44 2012 (r237264) +++ stable/9/sbin/fsck_ffs/suj.c Tue Jun 19 10:04:36 2012 (r237265) @@ -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)