]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add --update=force-no-bbl.
authorNeilBrown <neilb@suse.com>
Mon, 21 Dec 2015 03:56:38 +0000 (14:56 +1100)
committerNeilBrown <neilb@suse.com>
Mon, 21 Dec 2015 03:56:38 +0000 (14:56 +1100)
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>
mdadm.c
mdadm.h
super1.c

diff --git a/mdadm.c b/mdadm.c
index feec3b70e4c9d0c65d946816d4c59572189dbc34..51e16f3fccb223f1c64370a5c6190404e29fb4ff 100644 (file)
--- 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 99802c381a788cb3a1838c8130731ce147b7d592..dd02be710c8951d68eacbd980877d79633c19cd1 100755 (executable)
--- 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.
         */
index 2df590ee9b311e051a9b364a2db964a6b7ac3f51..10e00652c4eed59ae7f4fab4348ec5c6a48c05dd 100644 (file)
--- 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);