Module Name:    src
Committed By:   riz
Date:           Tue Dec  7 23:29:56 UTC 2010

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

Log Message:
As currently written, writeat() expects disk blocks, not fs blocks, so
when testing that the last sector of the new size is writeable, make
sure we're ACTUALLY writing in the new space, instead of possibly
overwriting something in the existing fs.

Discovered while writing tests - tests which uncovered file corruption at
certain block sizes.

XXX should rewrite writeat() to expect fs blocks instead of disk blocks.

OK mlelstv@


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.17 src/sbin/resize_ffs/resize_ffs.c:1.18
--- src/sbin/resize_ffs/resize_ffs.c:1.17	Thu Dec  2 22:00:27 2010
+++ src/sbin/resize_ffs/resize_ffs.c	Tue Dec  7 23:29:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.17 2010/12/02 22:00:27 riz Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.18 2010/12/07 23:29:55 riz Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -880,7 +880,7 @@
 	 * overwriting anything important by this.  (The choice of sbbuf as
 	 * what to write is irrelevant; it's just something handy that's known
 	 * to be at least one frag in size.) */
-	writeat(newsb->fs_size - 1, &sbbuf, newsb->fs_fsize);
+	writeat(fsbtodb(newsb,newsb->fs_size - 1), &sbbuf, newsb->fs_fsize);
 	/* Update fs_old_ncyl and fs_ncg. */
 	newsb->fs_old_ncyl = howmany(newsb->fs_size * NSPF(newsb),
 	    newsb->fs_old_spc);

Reply via email to