From 1a7e21fe38a6b02988bf0f3e0362edb8a6d89f0295fe69584a7d0f05b8131c14 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 19 Dec 2017 20:12:48 +0000 Subject: [PATCH 1/2] Accepting request 558516 from home:wqu:branches:filesystems - Fix rollback regression which can lead to data corruption * rollback-regression-fix.patch (bsc#1069478, upstream: "Subject: [PATCH] btrfs-progs: convert: Fix a bug in rollback check which overwrite return value") Would land in upstream v4.14.1. OBS-URL: https://build.opensuse.org/request/show/558516 OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=280 --- btrfsprogs.changes | 9 +++++++++ btrfsprogs.spec | 2 ++ rollback-regression-fix.patch | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 rollback-regression-fix.patch diff --git a/btrfsprogs.changes b/btrfsprogs.changes index 74141a1..a7946ec 100644 --- a/btrfsprogs.changes +++ b/btrfsprogs.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Dec 19 11:31:07 UTC 2017 - wqu@suse.de + +- Fix rollback regression which can lead to data corruption + * rollback-regression-fix.patch (bsc#1069478, + upstream: "Subject: [PATCH] btrfs-progs: convert: Fix a bug in rollback + check which overwrite return value") + Would land in upstream v4.14.1. + ------------------------------------------------------------------- Thu Dec 7 11:03:37 UTC 2017 - dimstar@opensuse.org diff --git a/btrfsprogs.spec b/btrfsprogs.spec index 0a36fe2..a08a660 100644 --- a/btrfsprogs.spec +++ b/btrfsprogs.spec @@ -43,6 +43,7 @@ Source4: setup-btrfs.sh Source5: sles11-defaults.h Patch1: mkfs-default-features.patch +Patch2: rollback-regression-fix.patch BuildRequires: asciidoc BuildRequires: autoconf @@ -137,6 +138,7 @@ thing. %prep %setup -q -n btrfs-progs-v%{version} %patch1 -p1 +%patch2 -p1 %build ./autogen.sh diff --git a/rollback-regression-fix.patch b/rollback-regression-fix.patch new file mode 100644 index 0000000..e1ab7ad --- /dev/null +++ b/rollback-regression-fix.patch @@ -0,0 +1,35 @@ +From: Qu Wenruo +Subject: [PATCH] btrfs-progs: convert: Fix a bug in rollback check which overwrite return value +Path-mainline: Will land in v4.14.1. + +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 +--- + convert/main.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: btrfs-progs-v4.13.3/convert/main.c +=================================================================== +--- btrfs-progs-v4.13.3.orig/convert/main.c ++++ btrfs-progs-v4.13.3/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 From fa80a5fc8b079df3dee4b173276222fdb1a6a66385f912e52b1e5f0d9c676493 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 19 Dec 2017 20:14:08 +0000 Subject: [PATCH 2/2] polish .changes OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=281 --- btrfsprogs.changes | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/btrfsprogs.changes b/btrfsprogs.changes index a7946ec..d849ddb 100644 --- a/btrfsprogs.changes +++ b/btrfsprogs.changes @@ -2,10 +2,7 @@ Tue Dec 19 11:31:07 UTC 2017 - wqu@suse.de - Fix rollback regression which can lead to data corruption - * rollback-regression-fix.patch (bsc#1069478, - upstream: "Subject: [PATCH] btrfs-progs: convert: Fix a bug in rollback - check which overwrite return value") - Would land in upstream v4.14.1. + Added patches: rollback-regression-fix.patch (bsc#1069478) ------------------------------------------------------------------- Thu Dec 7 11:03:37 UTC 2017 - dimstar@opensuse.org