Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/resize_ffs As currently written, writeat() expects disk...



details:   https://anonhg.NetBSD.org/src/rev/cafcb40330f7
branches:  trunk
changeset: 759384:cafcb40330f7
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Dec 07 23:29:55 2010 +0000

description:
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@

diffstat:

 sbin/resize_ffs/resize_ffs.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 85cd28da5db3 -r cafcb40330f7 sbin/resize_ffs/resize_ffs.c
--- a/sbin/resize_ffs/resize_ffs.c      Tue Dec 07 22:50:37 2010 +0000
+++ b/sbin/resize_ffs/resize_ffs.c      Tue Dec 07 23:29:55 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index