From owner-freebsd-fs@FreeBSD.ORG Tue Dec 4 17:23:29 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7189416A47B for ; Tue, 4 Dec 2007 17:23:29 +0000 (UTC) (envelope-from julien.bellang@free.fr) Received: from smtp8-g19.free.fr (smtp8-g19.free.fr [212.27.42.65]) by mx1.freebsd.org (Postfix) with ESMTP id 2F29513C4EB for ; Tue, 4 Dec 2007 17:23:29 +0000 (UTC) (envelope-from julien.bellang@free.fr) Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id 3FFC617F521 for ; Tue, 4 Dec 2007 18:23:28 +0100 (CET) Received: from imp7-g19.free.fr (imp7-g19.free.fr [212.27.42.38]) by smtp8-g19.free.fr (Postfix) with ESMTP id 9465C17F59C for ; Tue, 4 Dec 2007 18:23:27 +0100 (CET) Received: by imp7-g19.free.fr (Postfix, from userid 33) id 07CA03F2E; Tue, 4 Dec 2007 18:15:55 +0100 (CET) Received: from 194.3.231.254 ([194.3.231.254]) by imp.free.fr (IMP) with HTTP for ; Tue, 04 Dec 2007 18:15:55 +0100 Message-ID: <1196788555.47558b4bab0ab@imp.free.fr> Date: Tue, 04 Dec 2007 18:15:55 +0100 From: julien.bellang@free.fr To: freebsd-fs@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.5 X-Originating-IP: 194.3.231.254 Subject: FSCK failed does'nt corrected file size when INCORRECT BLOCK COUNT is found X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2007 17:23:29 -0000 Hi, I'm working on a system installed in an environnement where power is cut off many time a week. This system is based on i386 FreeBSD 6.2 OS. I'm using FS UFS2 with SoftUpdate Activated. After such power shutdown, when I restart I've got some corrupted files that FSCK_UFS doesn't entirely resolve. For these files FSCK resolves the following error : /dev/ad0s1f: INCORRECT BLOCK COUNT I=3132417 (512992 should be 459392) (CORRECTED) But actually these file still inconsistency in my point of view as the file size field doesn't reflect the number of block reference in its inode. Regards to fsck_ffs sources, It seems that FSCK checks the validity of block pointer (!= 0) in the inode block list only for directory inode but not for regular file. In my case, as the number of block adress to check in the inode is deduced from the file size, and the file size is greater than the number of really allocated blocks I obtain many NULL block pointer. Does anyone have an idea why the NULL pointer are accepted by FSCK for regular file and it doesn't try to adjust the file size ? file fsck_ffs/inode.c, iblocks(), line 208 line 153: static int 154: iblock(struct inodesc *idesc, long ilevel, off_t isize) { . . . 197: if (IBLK(bp, i)) { idesc->id_blkno = IBLK(bp, i); if (ilevel == 0) n = (*func)(idesc); else n = iblock(idesc, ilevel, isize); if (n & STOP) { bp->b_flags &= ~B_INUSE; return (n); } } else { 208: if (idesc->id_type == DATA && isize > 0) { /* An empty block in a directory XXX */ getpathname(pathbuf, idesc->id_number, idesc->id_number); pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS", pathbuf); if (reply("ADJUST LENGTH") == 1) { dp = ginode(idesc->id_number); DIP_SET(dp, di_size, DIP(dp, di_size) - isize); isize = 0; printf( "YOU MUST RERUN FSCK AFTERWARDS\n"); rerun = 1; inodirty(); bp->b_flags &= ~B_INUSE; return(STOP); } } } . . . } Thanks, Julien