Source-Changes-HG archive

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

[src/netbsd-8]: src/sbin/fsck_ffs Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/bc46d0d9d335
branches:  netbsd-8
changeset: 852035:bc46d0d9d335
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 09 09:53:20 2018 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1051):

        sbin/fsck_ffs/setup.c: revision 1.102

Add a test for duplicate inodes on the persistent snapshot list.

diffstat:

 sbin/fsck_ffs/setup.c |  52 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diffs (84 lines):

diff -r c37be96df5b6 -r bc46d0d9d335 sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c     Tue Oct 09 09:51:57 2018 +0000
+++ b/sbin/fsck_ffs/setup.c     Tue Oct 09 09:53:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $  */
+/*     $NetBSD: setup.c,v 1.101.4.1 2018/10/09 09:53:20 martin Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c    8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $");
+__RCSID("$NetBSD: setup.c,v 1.101.4.1 2018/10/09 09:53:20 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -73,6 +73,7 @@
 #ifndef NO_APPLE_UFS
 static int readappleufs(void);
 #endif
+static int check_snapinum(void);
 
 int16_t sblkpostbl[256];
 
@@ -341,6 +342,14 @@
                        dirty(&asblk);
                }
        }
+       if (check_snapinum()) {
+               if (preen)
+                       printf(" (FIXED)\n");
+               if (preen || reply("FIX") == 1) {
+                       sbdirty();
+                       dirty(&asblk);
+               }
+       }
        if (is_ufs2 || sblock->fs_old_inodefmt >= FS_44INODEFMT) {
                if (sblock->fs_maxfilesize != maxfilesize) {
                        pwarn("INCORRECT MAXFILESIZE=%lld IN SUPERBLOCK",
@@ -1094,3 +1103,42 @@
        }
        return (1);
 }
+
+/*
+ * Test the list of snapshot inode numbers for duplicates and repair.
+ */
+static int
+check_snapinum(void)
+{
+       int loc, loc2, res;
+       int *snapinum = &sblock->fs_snapinum[0];
+
+       res = 0;
+ 
+       if (isappleufs)
+               return 0;
+
+       for (loc = 0; loc < FSMAXSNAP; loc++) {
+               if (snapinum[loc] == 0)
+                       break;
+               for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) {
+                       if (snapinum[loc2] == 0 ||
+                           snapinum[loc2] == snapinum[loc])
+                               break;
+               }
+               if (loc2 >= FSMAXSNAP || snapinum[loc2] == 0)
+                       continue;
+               pwarn("SNAPSHOT INODE %u ALREADY ON LIST%s", snapinum[loc2],
+                   (res ? "" : "\n"));
+               res = 1;
+               for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) {
+                       if (snapinum[loc2] == 0)
+                               break;
+                       snapinum[loc2 - 1] = snapinum[loc2];
+               }
+               snapinum[loc2 - 1] = 0;
+               loc--;
+       }
+
+       return res;
+}



Home | Main Index | Thread Index | Old Index