In createfiles(), properly handle a number of cases where no further
volumes are available, instead of getting stuck in a loop calling getvol(). Normally restore in 'x' or 'i' modes will ask for a new (earlier) volume when the current inode number on the tape is greater than the last inode to be restored, since there can be no further inodes of interest on that volume. However we don't want to change volumes in this case either if the user explicitly said that there are no more tapes, or if we are looking at the first volume. When no more volumes are available but there are still inodes that we have not found, we now just fall through to the code that prints out a list of any missing files, so the restore completes normally. Also simplify the logic a bit by always returning to the start of the main for(;;) loop whenever the volume has changed. This should completely fix the "Changing volumes on pipe input" bug that is often observed when restoring dumps of active filesystems. PR: bin/4176, bin/34604, misc/34675
This commit is contained in:
parent
2598b9f117
commit
cfd8a00918
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90642
@ -695,6 +695,7 @@ createfiles()
|
||||
first = lowerbnd(ROOTINO);
|
||||
last = upperbnd(maxino - 1);
|
||||
for (;;) {
|
||||
curvol = volno;
|
||||
first = lowerbnd(first);
|
||||
last = upperbnd(last);
|
||||
/*
|
||||
@ -703,34 +704,41 @@ createfiles()
|
||||
if (first > last)
|
||||
return;
|
||||
/*
|
||||
* Reject any volumes with inodes greater
|
||||
* than the last one needed
|
||||
* Reject any volumes with inodes greater than the last
|
||||
* one needed, so that we can quickly skip backwards to
|
||||
* a volume containing useful inodes. We can't do this
|
||||
* if there are no further volumes available (curfile.ino
|
||||
* >= maxino) or if we are already at the first tape.
|
||||
*/
|
||||
while (curfile.ino > last) {
|
||||
if (curfile.ino > last && curfile.ino < maxino && volno > 1) {
|
||||
curfile.action = SKIP;
|
||||
getvol((long)0);
|
||||
skipmaps();
|
||||
skipdirs();
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Decide on the next inode needed.
|
||||
* Skip across the inodes until it is found
|
||||
* or an out of order volume change is encountered
|
||||
* or a volume change is encountered
|
||||
*/
|
||||
if (curfile.ino < maxino) {
|
||||
next = lowerbnd(curfile.ino);
|
||||
do {
|
||||
curvol = volno;
|
||||
while (next > curfile.ino && volno == curvol)
|
||||
skipfile();
|
||||
if (volno != curvol) {
|
||||
skipmaps();
|
||||
skipdirs();
|
||||
} while (volno == curvol + 1);
|
||||
/*
|
||||
* If volume change out of order occurred the
|
||||
* current state must be recalculated
|
||||
*/
|
||||
if (volno != curvol)
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* No further volumes or inodes available. Set
|
||||
* `next' to the first inode, so that a warning
|
||||
* is emitted below for each missing file.
|
||||
*/
|
||||
next = first;
|
||||
}
|
||||
/*
|
||||
* If the current inode is greater than the one we were
|
||||
* looking for then we missed the one we were looking for.
|
||||
|
Loading…
Reference in New Issue
Block a user