Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2011 16:36:39 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221392 - stable/8/sbin/newfs
Message-ID:  <201105031636.p43GadGd002218@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Tue May  3 16:36:39 2011
New Revision: 221392
URL: http://svn.freebsd.org/changeset/base/221392

Log:
  MFC r221049: Stop zeroing UFS1 superblocks if we fall off the end of the
  disk, in order to avoid wasting time (potentially many hours) in the event
  that we find a partially-overwritten UFS1 superblock.

Modified:
  stable/8/sbin/newfs/mkfs.c
Directory Properties:
  stable/8/sbin/newfs/   (props changed)

Modified: stable/8/sbin/newfs/mkfs.c
==============================================================================
--- stable/8/sbin/newfs/mkfs.c	Tue May  3 16:00:36 2011	(r221391)
+++ stable/8/sbin/newfs/mkfs.c	Tue May  3 16:36:39 2011	(r221392)
@@ -517,9 +517,12 @@ restart:
 			fsdummy.fs_magic = 0;
 			bwrite(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize,
 			    chdummy, SBLOCKSIZE);
-			for (cg = 0; cg < fsdummy.fs_ncg; cg++)
+			for (cg = 0; cg < fsdummy.fs_ncg; cg++) {
+				if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) > fssize)
+					break;
 				bwrite(&disk, part_ofs + fsbtodb(&fsdummy,
 				  cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE);
+			}
 		}
 	}
 	if (!Nflag)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105031636.p43GadGd002218>