bcache-tools/0022-bcache-tools-check-incompatible-feature-set.patch
Jan Engelhardt 78695432ff Accepting request 860492 from home:colyli:branches:filesystems
- bcache.h: fix typo from SUUP to SUPP (jsc#SLE-9807)
  0019-bcache.h-fix-typo-from-SUUP-to-SUPP.patch
- bcache-tools: only call set_bucket_size() for cache device
  (jsc#SLE-9807)
  0020-bcache-tools-only-call-set_bucket_size-for-cache-dev.patch
- bcache.h: add BCH_FEATURE_INCOMPAT_LARGE_BUCKET to
  BCH_FEATURE_INCOMPAT_SUPP (jsc#SLE-9807)
  0021-bcache.h-add-BCH_FEATURE_INCOMPAT_LARGE_BUCKET-to-BC.patch
- bcache-tools: check incompatible feature set (jsc#SLE-9807)
  0022-bcache-tools-check-incompatible-feature-set.patch
- bcache-tools: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE
  for large bucket (jsc#SLE-9807)
  0023-bcache-tools-introduce-BCH_FEATURE_INCOMPAT_LOG_LARG.patch
- bcache-tools: display obsoleted bucket size configuration
  (jsc#SLE-9807)
  0024-bcache-tools-display-obsoleted-bucket-size-configura.patch
- bcache-tools: recover the missing sb.csum for showing bcache device
  super block (jsc#SLE-9807)
  0025-bcache-tools-recover-the-missing-sb.csum-for-showing.patch
- bcache-tools: only call to_cache_sb() for bcache device
  in may_add_item() (jsc#SLE-9807)
  0026-bcache-tools-only-call-to_cache_sb-for-bcache-device.patch
- bcache-tools: improve column alignment for "bcache show
  -m" output (jsc#SLE-9807)
  0027-bcache-tools-improve-column-alignment-for-bcache-sho.patch

OBS-URL: https://build.opensuse.org/request/show/860492
OBS-URL: https://build.opensuse.org/package/show/filesystems/bcache-tools?expand=0&rev=31
2021-01-05 15:18:42 +00:00

63 lines
1.8 KiB
Diff

From 93e83d620d21411eb82fd3c4e95d7b73e79ce49d Mon Sep 17 00:00:00 2001
From: Coly Li <colyli@suse.de>
Date: Thu, 31 Dec 2020 23:59:16 +0800
Subject: [PATCH 4/9] bcache-tools: check incompatible feature set
Git-commit: 93e83d620d21411eb82fd3c4e95d7b73e79ce49d
References: jsc#SLE-9807
When bcache-tools is not updated with kernel driver (or on the versus),
we need to make sure the feature set conflict can be detected to avoid
unexpected data operation.
This patch checks whether there is unsupported {compatc, ro_compat,
incompat} features detected in detail_dev(). If there is, prints out
error message and return error to its caller.
Signed-off-by: Coly Li <colyli@suse.de>
---
lib.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/lib.c b/lib.c
index 29172f5..a529ad3 100644
--- a/lib.c
+++ b/lib.c
@@ -442,6 +442,33 @@ int detail_dev(char *devname, struct bdev *bd, struct cdev *cd, int *type)
goto Fail;
}
+ /* Check for incompat feature set */
+ if (sb.version >= BCACHE_SB_VERSION_BDEV_WITH_FEATURES ||
+ sb.version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
+ uint64_t features;
+
+ features = sb.feature_compat & ~BCH_FEATURE_COMPAT_SUPP;
+ if (features) {
+ fprintf(stderr,
+ "Unsupported compatible feature found\n");
+ goto Fail;
+ }
+
+ features = sb.feature_ro_compat & ~BCH_FEATURE_RO_COMPAT_SUPP;
+ if (features) {
+ fprintf(stderr,
+ "Unsupported read-only compatible feature found\n");
+ goto Fail;
+ }
+
+ features = sb.feature_incompat & ~BCH_FEATURE_INCOMPAT_SUPP;
+ if (features) {
+ fprintf(stderr,
+ "Unsupported incompatible feature found\n");
+ goto Fail;
+ }
+ }
+
*type = sb.version;
if (sb.version == BCACHE_SB_VERSION_BDEV ||
sb.version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET ||
--
2.26.2