Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck_lfs Walk the segment list correctly when rolling f...



details:   https://anonhg.NetBSD.org/src/rev/a8811ad82dd6
branches:  trunk
changeset: 521760:a8811ad82dd6
user:      perseant <perseant%NetBSD.org@localhost>
date:      Mon Feb 04 23:43:43 2002 +0000

description:
Walk the segment list correctly when rolling forward between the two
primary superblocks.  This prevents spurious "block could not be read"
messages that might otherwise be seen if the filesystem had not been
properly unmounted.

diffstat:

 sbin/fsck_lfs/setup.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r e06055fb7872 -r a8811ad82dd6 sbin/fsck_lfs/setup.c
--- a/sbin/fsck_lfs/setup.c     Mon Feb 04 23:41:28 2002 +0000
+++ b/sbin/fsck_lfs/setup.c     Mon Feb 04 23:43:43 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.10 2001/09/25 00:03:03 wiz Exp $ */
+/* $NetBSD: setup.c,v 1.11 2002/02/04 23:43:43 perseant Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -89,7 +89,7 @@
 static daddr_t
 try_verify(struct lfs * osb, struct lfs * nsb)
 {
-       daddr_t         daddr;
+       daddr_t         daddr, odaddr;
        SEGSUM         *sp;
        char           *summary;
        int             bc, flag;
@@ -112,6 +112,7 @@
                  sp->ss_sumsum != cksum(&sp->ss_datasum, osb->lfs_sumsize -
                                         sizeof(sp->ss_sumsum))) {
                        if (flag == 0) {
+                               flag = 1;
                                daddr += btofsb(osb, LFS_SBPAD);
                                goto oncemore;
                        }
@@ -120,10 +121,13 @@
                bc = check_summary(osb, sp, daddr);
                if (bc == 0)
                        break;
+               odaddr = daddr;
                daddr += btofsb(osb, osb->lfs_sumsize + bc);
-               if (dtosn(osb, daddr) != dtosn(osb, daddr +
-                       btofsb(osb, osb->lfs_sumsize + osb->lfs_bsize)))
+               if (dtosn(osb, odaddr) != dtosn(osb, daddr) ||
+                   dtosn(osb, daddr) != dtosn(osb, daddr +
+                       btofsb(osb, osb->lfs_sumsize + osb->lfs_bsize))) {
                        daddr = ((SEGSUM *)summary)->ss_next;
+               }
        }
        return daddr;
 }



Home | Main Index | Thread Index | Old Index