btrfs-progs: restore: don't modify metadata in dry-run mode

In Dry run the following error appeared and aborted execution:

  ERROR: failed to access 'XYZ' to restore metadata/xattrs: No such file or directory

Skip the metadata and xattrs handling when dry run is enabled.

Signed-off-by: Holger Jakob <jakob@dsi.uni-stuttgart.de>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Holger Jakob 2023-02-01 20:33:45 -08:00 committed by David Sterba
parent 5c1fb686aa
commit 7647192c23

View File

@ -1117,7 +1117,7 @@ next:
path.slots[0]++;
}
if (restore_metadata || get_xattrs) {
if ((restore_metadata || get_xattrs) && !dry_run) {
snprintf(path_name, PATH_MAX, "%s%s", output_rootdir, in_dir);
fd = open(path_name, O_RDONLY);
if (fd < 0) {