From: Qu Wenruo Date: Wed, 29 Nov 2017 13:48:05 +0000 (+0800) Subject: btrfs-progs: convert: Fix a bug in rollback check which overwrite return value X-Git-Tag: upstream/4.16.1~236 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8f9653fc04513db59b0d1438367ecee1552db9d;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: convert: Fix a bug in rollback check which overwrite return value Commit 1170ac307900 ("btrfs-progs: convert: Introduce function to check if convert image is able to be rolled back") reworked rollback check condition, by checking 1:1 mapping of each file extent. The idea itself has nothing wrong, but error handler is not implemented correctly, which over writes the return value and always try to rollback the fs even it fails to pass the check. Fix it by correctly return the error before rollback the fs. Fixes: 1170ac307900 ("btrfs-progs: convert: Introduce function to check if convert image is able to be rolled back") Reported-by: Jeff Mahoney Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- diff --git a/convert/main.c b/convert/main.c index af28553..89f9261 100644 --- a/convert/main.c +++ b/convert/main.c @@ -1443,6 +1443,8 @@ next: } } btrfs_release_path(&path); + if (ret) + return ret; /* * For HOLES mode (without NO_HOLES), we must ensure file extents * cover the whole range of the image