xfsdump: fix metadata restore on split files

xfsrestore does not apply certain metadata until all of the file's
data has been restored. This allows, for example, files with the
immutable flag set to be restored properly.

While testing multi-stream restores, I noticed that files split
across multiple streams did not have their metadata restored.
Looking into this further, it also can occur with just a single
stream when the dump spans multiple tapes. Specifically it requires
that end-of-tape is hit just as a file is finished (before a new
file is begun), and the restore is performed as separate xfsrestore
invocations (one per tape).

The fix is to check to see if a file is completely restored whenever
we hit the end of a media file. The current code is broken because
it relies on all media files being applied during the same restore
session.

This also moves the S_ISREG() check into restore_complete_reg()
rather than relying on callers to make the check.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
1 file changed