Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2001 12:50:35 +0000
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        wilko@FreeBSD.org
Cc:        freebsd-bugs@FreeBSD.org, mjacob@FreeBSD.org
Subject:   Re: bin/4176: restore gets confused when run over pipe "Changing volumes on pipe input" 
Message-ID:   <200111241250.aa74326@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Sat, 24 Nov 2001 03:48:39 PST." <200111241148.fAOBmdO65084@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200111241148.fAOBmdO65084@freefall.freebsd.org>, wilko@FreeBSD.org 
writes:
>Matt, I saw you did some work on dump/restore PRs. Do you have a clue
>to offer for this one?

I have a patch for one such restore bug. The problem it fixes occurs
when the highest inode number in the dump symbol table disappears
while dump is running _and_ if another inode with a greater inode
number is present in the dump, but not in the symbol table. This
triggers restore's code for skipping a volume when the first inode
on the volume is greater than the last inode requested (reproduced
and analysed mostly during the coffee break before "BSD question
time" at BSDCon Europe, with help from dwmalone :-)

The patch still could do with some simplification, and I haven't
tested multi-volume restores yet, but here it is anyway:

Ian

Index: restore.c
===================================================================
RCS file: /dump/FreeBSD-CVS/src/sbin/restore/restore.c,v
retrieving revision 1.7
diff -u -r1.7 restore.c
--- restore.c	28 Aug 1999 00:14:08 -0000	1.7
+++ restore.c	11 Nov 2001 16:41:54 -0000
@@ -689,6 +689,7 @@
 
 	vprintf(stdout, "Extract requested files\n");
 	curfile.action = SKIP;
+	curvol = -1;
 	getvol((long)1);
 	skipmaps();
 	skipdirs();
@@ -702,35 +703,40 @@
 		 */
 		if (first > last)
 			return;
-		/*
-		 * Reject any volumes with inodes greater
-		 * than the last one needed
-		 */
-		while (curfile.ino > last) {
-			curfile.action = SKIP;
-			getvol((long)0);
-			skipmaps();
-			skipdirs();
+		if (curvol != volno) {
+			/*
+			 * If at the beginning of a volume, reject any
+			 * volumes with inodes greater than the last one
+			 * needed
+			 */
+			while (curfile.ino > last) {
+				curfile.action = SKIP;
+				getvol((long)0);
+				skipmaps();
+				skipdirs();
+			}
+		}
+		if (curfile.ino <= last) {
+			/*
+			 * Decide on the next inode needed.
+			 * Skip across the inodes until it is found
+			 * or an out of order volume change is encountered
+			 */
+			next = lowerbnd(curfile.ino);
+			do	{
+				curvol = volno;
+				while (next > curfile.ino && volno == curvol)
+					skipfile();
+				skipmaps();
+				skipdirs();
+			} while (volno == curvol + 1);
+			/*
+			 * If volume change out of order occurred the
+			 * current state must be recalculated
+			 */
+			if (volno != curvol)
+				continue;
 		}
-		/*
-		 * Decide on the next inode needed.
-		 * Skip across the inodes until it is found
-		 * or an out of order volume change is encountered
-		 */
-		next = lowerbnd(curfile.ino);
-		do	{
-			curvol = volno;
-			while (next > curfile.ino && volno == curvol)
-				skipfile();
-			skipmaps();
-			skipdirs();
-		} while (volno == curvol + 1);
-		/*
-		 * If volume change out of order occurred the
-		 * current state must be recalculated
-		 */
-		if (volno != curvol)
-			continue;
 		/*
 		 * If the current inode is greater than the one we were
 		 * looking for then we missed the one we were looking for.
@@ -762,6 +768,7 @@
 			if (volno != curvol)
 				skipmaps();
 		}
+		curvol = volno;
 	}
 }
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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