Subject: Re: install/25138: 2.0: sysinst upgrade broken: fsck_ffs bails out
To: Hubert Feyrer <hubert@feyrer.de>
From: Darrin B. Jewell <dbj@NetBSD.org>
List: netbsd-bugs
Date: 04/13/2004 23:49:18
--=-=-=

"Darrin B. Jewell" <dbj@NetBSD.org> writes:

> I'm working on support to downgrade a superblock from fslevel 4 to 3
> using fsck.  I include below a lightly tested patch which will do
> that.  Before I commit this patch, there needs to be some additional
> testing to verify that a filesystem created on 2.0 and downgraded with
> this option will work on 1.6.2 and 2.0 without problems.

Ok.  The first attempt at the fsck_ffs fslevel downgrade patch had
some problems.  This one should be tested now instead.

Darrin


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=pr25138.diff
Content-Description: patch to downgrade ffs1 filesystem from fslevel 4 to 3

Index: setup.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_ffs/setup.c,v
retrieving revision 1.70
diff -u -u -p -r1.70 setup.c
--- setup.c	21 Mar 2004 20:01:41 -0000	1.70
+++ setup.c	14 Apr 2004 03:38:13 -0000
@@ -198,6 +198,24 @@ setup(dev)
 		 */
 		sbdirty();
 	}
+	if (!is_ufs2 && cvtlevel == 3 &&
+	    (sblock->fs_old_flags & FS_FLAGS_UPDATED)) {
+		if (preen)
+			pwarn("DOWNGRADING TO OLD SUPERBLOCK LAYOUT\n");
+		else if (!reply("DOWNGRADE TO OLD SUPERBLOCK LAYOUT"))
+			return(0);
+		sblock->fs_old_flags &= ~FS_FLAGS_UPDATED;
+		sb_oldfscompat_write(sblock, sblock);
+		sblock->fs_old_flags &= ~FS_FLAGS_UPDATED; /* just in case */
+		/* Leave postbl tables disabled, but blank its superblock region anyway */
+		sblock->fs_old_postblformat = FS_DYNAMICPOSTBLFMT;
+		sblock->fs_old_cpc = 0;
+		sblock->fs_old_nrpos = 1;
+		sblock->fs_old_trackskew = 0;
+		memset(&sblock->fs_old_postbl_start, 0xff, 256);
+		sb_oldfscompat_read(sblock, &sblocksave);
+		sbdirty();
+	}
 	/*
 	 * Check and potentially fix certain fields in the super block.
 	 */

--=-=-=--