NetBSD Problem Report #44177

From riz@lychee.tastylime.net  Tue Nov 30 19:50:06 2010
Return-Path: <riz@lychee.tastylime.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B12B963B95F
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 30 Nov 2010 19:50:06 +0000 (UTC)
Message-Id: <20101130195006.22D412C46FA@lychee.tastylime.net>
Date: Tue, 30 Nov 2010 11:50:06 -0800 (PST)
From: riz@netbsd.org
Reply-To: riz@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: resize_ffs(8) produces unclean ffsv1 when shrinking
X-Send-Pr-Version: 3.95

>Number:         44177
>Category:       bin
>Synopsis:       resize_ffs(8) produces unclean ffsv1 when shrinking
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 30 19:55:00 +0000 2010
>Closed-Date:    Thu Dec 02 22:26:04 +0000 2010
>Last-Modified:  Thu Dec 02 22:26:04 +0000 2010
>Originator:     riz@netbsd.org
>Release:        NetBSD 5.99.40
>Organization:

>Environment:
NetBSD netbsd6 5.99.40 NetBSD 5.99.40 (GENERIC) #1: Sat Nov 27 16:16:54 PST 2010  riz@hack.lan:/Users/riz/Documents/code/netbsd/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: amd64
Machine: amd64
>Description:
	For a simple ffvs1 file system (also for more complex ones, but
there may be other problems lurking there), shrinking the file system
results in a file system that fsck has to fix DESPITE being marked as clean.
>How-To-Repeat:
	Create a new ffsv1 of any size, shrink it, and run the result
through fsck -f.  Like so:

# cat >/tmp/disktab <<EOF
floppy288|2.88MB 3.5in Extra High Density Floppy:\
        :ty=floppy:se#512:nt#2:rm#300:ns#36:nc#80:\
        :pa#5760:oa#0:ba#4096:fa#512:ta=4.2BSD:\
        :pb#5760:ob#0:\
        :pc#5760:oc#0:
EOF
# dd if=/dev/zero of=/tmp/floppy.img count=5760
5760+0 records in
5760+0 records out
2949120 bytes transferred in 0.145 secs (20338758 bytes/sec)
# vnconfig -c vnd0 /tmp/floppy.img
# disklabel -f /tmp/disktab -rw vnd0 floppy288
# newfs -V1 /dev/rvnd0a
/dev/rvnd0a: 2.8MB (5760 sectors) block size 4096, fragment size 512
	using 4 cylinder groups of 0.70MB, 180 blks, 352 inodes.
# resize_ffs -s 3000 -y /dev/rvnd0a
# fsck -f -n /dev/rvnd0a
** /dev/rvnd0a (NO WRITE)
** File system is already clean
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? no

SUMMARY INFORMATION BAD
SALVAGE? no

BLK(S) MISSING IN BIT MAPS
SALVAGE? no

1 files, 1 used, 1303 free (15 frags, 161 blocks, 0.6% fragmentation)

***** UNRESOLVED INCONSISTENCIES REMAIN *****
#

>Fix:
	None given.

>Release-Note:

>Audit-Trail:
From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44177 CVS commit: src/tests
Date: Tue, 30 Nov 2010 23:17:28 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Tue Nov 30 23:17:27 UTC 2010

 Modified Files:
 	src/tests: Makefile
 Added Files:
 	src/tests/sbin: Makefile Makefile.inc
 	src/tests/sbin/resize_ffs: Makefile t_resize_ffs.sh

 Log Message:
 Add some basic tests of resize_ffs(8).  The 'grow' test does nothing
 more than create an empty file system, grow it, and makes sure fsck
 finds the result clean.  The 'shrink' test does likewise for shrinking,
 but is an expected failure at the moment due to PR bin/44177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/tests/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/sbin/Makefile src/tests/sbin/Makefile.inc
 cvs rdiff -u -r0 -r1.1 src/tests/sbin/resize_ffs/Makefile \
     src/tests/sbin/resize_ffs/t_resize_ffs.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/44177
Date: Thu, 02 Dec 2010 10:48:59 -0800

 Just a note:  the problem only manifests itself when the last cylinder
 group of the shrunken file system is a partial cg.  When removing an
 even number of cgs, it seems to correctly produce a clean fs.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44177 CVS commit: src/sbin/resize_ffs
Date: Thu, 2 Dec 2010 22:00:27 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Thu Dec  2 22:00:27 UTC 2010

 Modified Files:
 	src/sbin/resize_ffs: resize_ffs.c

 Log Message:
 Use howmany() instead of "/" to calculate the number of cylinders for
 the changed file system, so as to not drop a partial cylinder at the
 end.  Fixes PR bin/44177.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/sbin/resize_ffs/resize_ffs.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44177 CVS commit: src/tests/sbin/resize_ffs
Date: Thu, 2 Dec 2010 22:03:23 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Thu Dec  2 22:03:23 UTC 2010

 Modified Files:
 	src/tests/sbin/resize_ffs: t_resize_ffs.sh

 Log Message:
 Update existing test cases and add a couple more:

 - PR bin/44177 is fixed
 - test grow/shrink on a ffsv1 with 64k blocksize, which was broken until
   recently
 - make sure the partial cylinder left over is big enough so it doesn't
   get thrown away now that resize_ffs properly uses the last cyl.

 XXX TODO:  add tests which ensure data integrity.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/resize_ffs/t_resize_ffs.sh

 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: riz@NetBSD.org
State-Changed-When: Thu, 02 Dec 2010 22:26:04 +0000
State-Changed-Why:
I fixed the bug and added a test.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.