File 0143-Add-update-force-no-bbl.patch of Package mdadm.5365
From 6dd16dac40010a23c4e7e14b69703f4296c60496 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Mon, 21 Dec 2015 14:56:38 +1100
Subject: [PATCH 198/359] Add --update=force-no-bbl.
References: bsc#1081910
This forcibly removed the bad-block log. There can be situations where it is hard to
remove bad blocks by writing to them - partiularly on RAID5.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
mdadm.c | 7 +++++--
mdadm.h | 3 ++-
super1.c | 5 +++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/mdadm.c b/mdadm.c
index feec3b7..51e16f3 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -757,6 +757,8 @@ int main(int argc, char *argv[])
continue;
if (strcmp(c.update, "no-bbl") == 0)
continue;
+ if (strcmp(c.update, "force-no-bbl") == 0)
+ continue;
if (strcmp(c.update, "metadata") == 0)
continue;
if (strcmp(c.update, "revert-reshape") == 0)
@@ -790,7 +792,7 @@ int main(int argc, char *argv[])
" 'sparc2.2', 'super-minor', 'uuid', 'name', 'nodes', 'resync',\n"
" 'summaries', 'homehost', 'home-cluster', 'byteorder', 'devicesize',\n"
" 'no-bitmap', 'metadata', 'revert-reshape'\n"
- " 'bbl', 'no-bbl'\n"
+ " 'bbl', 'no-bbl', 'force-no-bbl'\n"
);
exit(outf == stdout ? 0 : 2);
@@ -808,8 +810,9 @@ int main(int argc, char *argv[])
c.update = optarg;
if (strcmp(c.update, "devicesize") != 0 &&
strcmp(c.update, "bbl") != 0 &&
+ strcmp(c.update, "force-no-bbl") != 0 &&
strcmp(c.update, "no-bbl") != 0) {
- pr_err("only 'devicesize', 'bbl' and 'no-bbl' can be updated with --re-add\n");
+ pr_err("only 'devicesize', 'bbl', 'no-bbl', and 'force-no-bbl' can be updated with --re-add\n");
exit(2);
}
continue;
diff --git a/mdadm.h b/mdadm.h
index 99802c3..dd02be7 100755
--- a/mdadm.h
+++ b/mdadm.h
@@ -820,7 +820,8 @@ extern struct superswitch {
* readwrite - clear the WriteMostly1 bit in the superblock devflags
* no-bitmap - clear any record that a bitmap is present.
* bbl - add a bad-block-log if possible
- * no-bbl - remove and bad-block-log is it is empty.
+ * no-bbl - remove any bad-block-log is it is empty.
+ * force-no-bbl - remove any bad-block-log even if empty.
* revert-reshape - If a reshape is in progress, modify metadata so
* it will resume going in the opposite direction.
*/
diff --git a/super1.c b/super1.c
index 2df590e..10e0065 100644
--- a/super1.c
+++ b/super1.c
@@ -1282,6 +1282,11 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
sb->bblog_shift = 0;
sb->bblog_offset = 0;
}
+ } else if (strcmp(update, "force-no-bbl") == 0) {
+ sb->feature_map &= ~ __cpu_to_le32(MD_FEATURE_BAD_BLOCKS);
+ sb->bblog_size = 0;
+ sb->bblog_shift = 0;
+ sb->bblog_offset = 0;
} else if (strcmp(update, "name") == 0) {
if (info->name[0] == 0)
sprintf(info->name, "%d", info->array.md_minor);
--
2.16.1