]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_mdrestore: Don't rewind source file stream
authorMarco Benatto <marco.antonio.780@gmail.com>
Mon, 5 Feb 2018 20:43:02 +0000 (14:43 -0600)
committerEric Sandeen <sandeen@redhat.com>
Mon, 5 Feb 2018 20:43:02 +0000 (14:43 -0600)
commitd789af70600f1c494aac9e2edbd8baff002d249d
tree8434a17286b157a18dbc0775f6d0825bd4195e21
parent720eec0f83c4adce70629d5d0f217595fa4b1f31
xfs_mdrestore: Don't rewind source file stream

Today, xfs_mdrestore from stdin will fail if the -i flag is
specified, because it attempts to rewind the stream after
the initial read of the metablock.  This fails, and
results in an abort with "specified file is not a metadata
dump."

Read the metablock exactly once in main(), validate the magic,
print informational flags if requested, and then pass it to
perform_restore() which will then continue the restore process.

Reported-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Marco A Benatto <marco.antonio.780@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mdrestore/xfs_mdrestore.c