xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfsdump: dirs being created in list-only restore
From: Bill Kendall <wkendall@xxxxxxx>
Date: Wed, 22 Feb 2012 12:55:06 -0600
Cc: Bill Kendall <wkendall@xxxxxxx>
In-reply-to: <CAGdb-8fC4-3swyyfP3xO=camgzDjR5GYV3qoaB1w+xAfiNeYPw@xxxxxxxxxxxxxx>
References: <CAGdb-8fC4-3swyyfP3xO=camgzDjR5GYV3qoaB1w+xAfiNeYPw@xxxxxxxxxxxxxx>
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@xxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>