|
|
5ef8b0 |
commit 0ece1a1c5bd9224a158138ea79bdffdcb7feda68
|
|
|
5ef8b0 |
Author: Eric Sandeen <sandeen@sandeen.net>
|
|
|
5ef8b0 |
Date: Wed Oct 2 18:41:09 2013 +0000
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
xfsdump: handle large, wholly-sparse files
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
In restore_extent_group(), we loop over all extent headers for an inode
|
|
|
5ef8b0 |
in the stream, and add up the cumulatively restored size, accounting
|
|
|
5ef8b0 |
for both HOLE and DATA records and advancing restoredsz as we go.
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
But for a wholly-sparse file, we have no HOLE header, only
|
|
|
5ef8b0 |
a LAST header, and restoredsz remains at 0.
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
This makes it look like it's a partially-restored file, split
|
|
|
5ef8b0 |
across streams because the final restoredsz for this stream is
|
|
|
5ef8b0 |
less than the file size, and we go to partial_reg(), which
|
|
|
5ef8b0 |
allocates one slot in persp->a.parrest[] for this inode. But
|
|
|
5ef8b0 |
we've also called partial_reg() with offset/sz of 0/0, which is
|
|
|
5ef8b0 |
less than the file size so this inode never looks "done."
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
Normally partial_check2() would clear the persp->a.parrest[]
|
|
|
5ef8b0 |
slot in the array when the file is fully restored, but in
|
|
|
5ef8b0 |
this case, that is never satisfied. So all stream slots
|
|
|
5ef8b0 |
get filled as we encounter more inodes like this, and we
|
|
|
5ef8b0 |
eventually get:
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
"partial_reg: Out of records. Extend attrs applied early."
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
Fix this by recognizing that if we hit a LAST header with
|
|
|
5ef8b0 |
no restoredsz set (i.e. the LAST header is the only header),
|
|
|
5ef8b0 |
set restoredsz to EOF (bstatp->bs_size) to indicate that
|
|
|
5ef8b0 |
restoration of this file is complete, skip the call to
|
|
|
5ef8b0 |
partial_reg(), and all is well.
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
5ef8b0 |
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
|
|
|
5ef8b0 |
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
|
|
|
5ef8b0 |
|
|
|
5ef8b0 |
Index: xfsdump-3.1.3/restore/content.c
|
|
|
5ef8b0 |
===================================================================
|
|
|
5ef8b0 |
--- xfsdump-3.1.3.orig/restore/content.c
|
|
|
5ef8b0 |
+++ xfsdump-3.1.3/restore/content.c
|
|
|
5ef8b0 |
@@ -7516,6 +7516,11 @@ restore_extent_group( drive_t *drivep,
|
|
|
5ef8b0 |
* we are done.
|
|
|
5ef8b0 |
*/
|
|
|
5ef8b0 |
if ( ehdr.eh_type == EXTENTHDR_TYPE_LAST ) {
|
|
|
5ef8b0 |
+ /* For a wholly sparse file, there is no HOLE
|
|
|
5ef8b0 |
+ * record; advance restoredsz to EOF.
|
|
|
5ef8b0 |
+ */
|
|
|
5ef8b0 |
+ if (!restoredsz)
|
|
|
5ef8b0 |
+ restoredsz = bstatp->bs_size;
|
|
|
5ef8b0 |
break;
|
|
|
5ef8b0 |
}
|
|
|
5ef8b0 |
|