From nobody@FreeBSD.org  Thu Mar 29 18:22:27 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6318F106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 29 Mar 2012 18:22:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D8268FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 29 Mar 2012 18:22:27 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TIMR7v006712
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 29 Mar 2012 18:22:27 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q2TIMQ90006711;
	Thu, 29 Mar 2012 18:22:26 GMT
	(envelope-from nobody)
Message-Id: <201203291822.q2TIMQ90006711@red.freebsd.org>
Date: Thu, 29 Mar 2012 18:22:26 GMT
From: Dieter <freebsd@sopwith.solgatos.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fsck behaviour does not match doc (PARTIALLY TRUNCATED INODE)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         166499
>Category:       bin
>Synopsis:       fsck(8) behaviour does not match doc (PARTIALLY TRUNCATED INODE)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 29 18:30:15 UTC 2012
>Closed-Date:    
>Last-Modified:  Thu Mar 29 18:55:25 UTC 2012
>Originator:     Dieter
>Release:        8.2
>Organization:
>Environment:
8.2-RELEASE amd64
>Description:
/usr/share/doc/smm/03.fsck/paper.ascii.gz says:

 "All errors in this phase
 except INCORRECT BLOCK COUNT and PARTIALLY TRUNCATED INODE
 are fatal if the file system is being preen'ed."

 "PARTIALLY TRUNCATED INODE I=I (SALVAGE)
 Fsck_ffs has found inode I whose size is shorter than the
 number of blocks allocated to it. This condition should
 only occur if the system crashes while in the midst of trun-
 cating a file. When preen'ing the file system, fsck_ffs
 completes the truncation to the specified size."

In reality, PARTIALLY TRUNCATED INODE is fatal in preen mode,
and the inode is not automagically truncated.  I don't know
whether fsck is wrong or the documentation is wrong, but they
don't match, so at least one is wrong.

Since fsck doesn't automagically fix the problem, the filesystem
doesn't get mounted, and would typically prevent the system from
going multiuser.  So if it is safe to do so, fsck should be changed.
If it is not safe, then the documentation should be changed to
match fsck's actual behaviour.

FYI, the file in question should have been in the process of being
appended to, not being truncated.  No clue what's going on there.

If it matters, newfs was called with
-e 100000000 -b 65536 -f 8192 -g 67108864 -h 16 -i 67108864 -U -o space

density reduced from 67108864 to 14860288
/dev/ada8p2: 2861588.5MB (5860533088 sectors) block size 65536,
fragment size 8192
 using 789 cylinder groups of 3628.00MB, 58048 blks, 256 inodes.
 with soft updates

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
