[PATCH] xfsdump: dirs being created in list-only restore

Bill Kendall wkendall at sgi.com
Wed Feb 22 12:55:06 CST 2012


When xfsrestore is run with the -t option, it lists the files contained
in the dump but does not restore anything. This patch fixes code that
creates an orphaned file's parent directories without checking to see if
this is a list-only (table-of-contents) restore.

Signed-off-by: Bill Kendall <wkendall at sgi.com>
---
 restore/tree.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/restore/tree.c b/restore/tree.c
index 05e0628..a61fd16 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -1867,12 +1867,16 @@ tree_cb_links( xfs_ino_t ino,
 					return RV_NOTOK;
 				}
 			} else {
-				char *dir;
-				char tmp[PATH_MAX];
 
-				strcpy(tmp, path);
-				dir = dirname(tmp);
-				mkdir_r(dir);
+				if ( ! tranp->t_toconlypr ) {
+					char *dir;
+					char tmp[PATH_MAX];
+
+					strcpy(tmp, path);
+					dir = dirname(tmp);
+					mkdir_r(dir);
+				}
+
 				mlog (MLOG_VERBOSE | MLOG_NOTE | MLOG_TREE, _(
 				      "ino %llu salvaging file,"
 				      " placing in %s\n"), ino, path1);
-- 
1.7.0.4



More information about the xfs mailing list