From f3f439bb3f853329adb10cfb8dd3f817fd2d35975418b7651a9685fa04e69cd8 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 28 Feb 2021 14:49:39 +0000 Subject: [PATCH] Accepting request 874878 from home:colyli:branches:filesystems - bcache-tools: Update super block version in bch_set_feature_* routines (jsc#SLE-9807) 0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch OBS-URL: https://build.opensuse.org/request/show/874878 OBS-URL: https://build.opensuse.org/package/show/filesystems/bcache-tools?expand=0&rev=33 --- ...ate-super-block-version-in-bch_set_f.patch | 56 +++++++++++++++++++ bcache-tools.changes | 7 +++ bcache-tools.spec | 1 + 3 files changed, 64 insertions(+) create mode 100644 0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch diff --git a/0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch b/0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch new file mode 100644 index 0000000..1b5ac54 --- /dev/null +++ b/0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch @@ -0,0 +1,56 @@ +From 9e72a28b0faca4754ebcc1d7030d555120b03be4 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Fri, 22 Jan 2021 23:05:07 +0800 +Subject: [PATCH] bcache-tools: Update super block version in bch_set_feature_* + routines +Git-commit: 9e72a28b0faca4754ebcc1d7030d555120b03be4 +References: jsc#SLE-9807 + +When calling bch_set_feature_* routines, it indicates the super block +supports feature set and its version of cache device should at least be +BCACHE_SB_VERSION_CDEV_WITH_FEATURES. + +In order to always keep the cache device super block version being +updated, this patch checks whether the super block version is set +correctly when calling bch_set_feature_* routines, if not then set +the version to BCACHE_SB_VERSION_CDEV_WITH_FEATURES. + +Signed-off-by: Coly Li +--- + bcache.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/bcache.h b/bcache.h +index 6dcdbb7..46d9683 100644 +--- a/bcache.h ++++ b/bcache.h +@@ -228,6 +228,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ + } \ + static inline void bch_set_feature_##name(struct cache_sb *sb) \ + { \ ++ if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ + (sb)->feature_compat |= \ + BCH##_FEATURE_COMPAT_##flagname; \ + } \ +@@ -245,6 +247,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ + } \ + static inline void bch_set_feature_##name(struct cache_sb *sb) \ + { \ ++ if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ + (sb)->feature_ro_compat |= \ + BCH##_FEATURE_RO_COMPAT_##flagname; \ + } \ +@@ -262,6 +266,8 @@ static inline int bch_has_feature_##name(struct cache_sb *sb) \ + } \ + static inline void bch_set_feature_##name(struct cache_sb *sb) \ + { \ ++ if ((sb)->version < BCACHE_SB_VERSION_CDEV_WITH_FEATURES) \ ++ (sb)->version = BCACHE_SB_VERSION_CDEV_WITH_FEATURES; \ + (sb)->feature_incompat |= \ + BCH##_FEATURE_INCOMPAT_##flagname; \ + } \ +-- +2.26.2 + diff --git a/bcache-tools.changes b/bcache-tools.changes index d25f646..6379e2b 100644 --- a/bcache-tools.changes +++ b/bcache-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Feb 24 14:00:08 UTC 2021 - Coly Li + +- bcache-tools: Update super block version in bch_set_feature_* + routines (jsc#SLE-9807) + 0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch + ------------------------------------------------------------------- Tue Jan 5 14:20:48 UTC 2021 - Coly Li diff --git a/bcache-tools.spec b/bcache-tools.spec index 2242421..6029bcd 100644 --- a/bcache-tools.spec +++ b/bcache-tools.spec @@ -52,6 +52,7 @@ Patch24: 0024-bcache-tools-display-obsoleted-bucket-size-configura.patch Patch25: 0025-bcache-tools-recover-the-missing-sb.csum-for-showing.patch Patch26: 0026-bcache-tools-only-call-to_cache_sb-for-bcache-device.patch Patch27: 0027-bcache-tools-improve-column-alignment-for-bcache-sho.patch +Patch28: 0028-bcache-tools-Update-super-block-version-in-bch_set_f.patch BuildRequires: pkg-config BuildRequires: xz BuildRequires: pkgconfig(blkid)