|
|
325406 |
diff --git a/include/dmraid/lib_context.h b/include/dmraid/lib_context.h
|
|
|
325406 |
index c2e16e6..c2b3c4d 100644
|
|
|
325406 |
--- a/include/dmraid/lib_context.h
|
|
|
325406 |
+++ b/include/dmraid/lib_context.h
|
|
|
325406 |
@@ -46,7 +46,8 @@ enum lc_options {
|
|
|
325406 |
LC_CREATE,
|
|
|
325406 |
LC_REBUILD_SET,
|
|
|
325406 |
LC_REBUILD_DISK,
|
|
|
325406 |
- LC_HOT_SPARE_SET, /* Add new options below this one ! */
|
|
|
325406 |
+ LC_HOT_SPARE_SET,
|
|
|
325406 |
+ LC_DEFER_UPDATE, /* Add new options below this one ! */
|
|
|
325406 |
LC_OPTIONS_SIZE, /* Must be the last enumerator. */
|
|
|
325406 |
};
|
|
|
325406 |
|
|
|
325406 |
@@ -67,6 +68,7 @@ enum lc_options {
|
|
|
325406 |
#define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE))
|
|
|
325406 |
#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET))
|
|
|
325406 |
#define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK))
|
|
|
325406 |
+#define OPT_DEFER_UPDATE(lc) (lc_opt(lc, LC_DEFER_UPDATE))
|
|
|
325406 |
|
|
|
325406 |
/* Return option value. */
|
|
|
325406 |
#define OPT_STR(lc, o) (lc->options[o].arg.str)
|
|
|
325406 |
@@ -76,6 +78,7 @@ enum lc_options {
|
|
|
325406 |
#define OPT_STR_PARTCHAR(lc) OPT_STR(lc, LC_PARTCHAR)
|
|
|
325406 |
#define OPT_STR_HOT_SPARE_SET(lc) OPT_STR(lc, LC_HOT_SPARE_SET)
|
|
|
325406 |
#define OPT_STR_REBUILD_DISK(lc) OPT_STR(lc, LC_REBUILD_DISK)
|
|
|
325406 |
+#define OPT_STR_DEFER_UPDATE(lc) OPT_STR(lc, LC_DEFER_UPDATE)
|
|
|
325406 |
|
|
|
325406 |
struct lib_version {
|
|
|
325406 |
const char *text;
|
|
|
325406 |
diff --git a/lib/metadata/reconfig.c b/lib/metadata/reconfig.c
|
|
|
325406 |
index 73f7604..19768a9 100644
|
|
|
325406 |
--- a/lib/metadata/reconfig.c
|
|
|
325406 |
+++ b/lib/metadata/reconfig.c
|
|
|
325406 |
@@ -249,9 +249,9 @@ add_dev_to_raid(struct lib_context *lc, struct raid_set *rs,
|
|
|
325406 |
strncat(lib_name, ".so", 3);
|
|
|
325406 |
} else
|
|
|
325406 |
goto err;
|
|
|
325406 |
-
|
|
|
325406 |
+
|
|
|
325406 |
/* Check registration */
|
|
|
325406 |
- if (!dm_monitored_events(&pending, sub_rs->name, lib_name)) {
|
|
|
325406 |
+ if (!dm_monitored_events(&pending, sub_rs->name, lib_name) && !OPT_DEFER_UPDATE(lc)) {
|
|
|
325406 |
/* If NOT registered update metadata to OK state. */
|
|
|
325406 |
if (check_rd->fmt->metadata_handler)
|
|
|
325406 |
check_rd->fmt->metadata_handler(lc, UPDATE_REBUILD_STATE, NULL, (void *) rs);
|
|
|
325406 |
diff --git a/man/dmraid.8 b/man/dmraid.8
|
|
|
325406 |
index b4de737..62a6091 100644
|
|
|
325406 |
--- a/man/dmraid.8
|
|
|
325406 |
+++ b/man/dmraid.8
|
|
|
325406 |
@@ -11,6 +11,7 @@ dmraid \- discover, configure and activate software (ATA)RAID
|
|
|
325406 |
[-Z|--rm_partitions]
|
|
|
325406 |
[--separator SEPARATOR]
|
|
|
325406 |
[-t|--test]
|
|
|
325406 |
+ [-u|--update_defer]
|
|
|
325406 |
[RAID-set...]
|
|
|
325406 |
|
|
|
325406 |
.B dmraid
|
|
|
325406 |
@@ -38,6 +39,7 @@ dmraid \- discover, configure and activate software (ATA)RAID
|
|
|
325406 |
{-R| --rebuild}
|
|
|
325406 |
RAID-set
|
|
|
325406 |
[device-path]
|
|
|
325406 |
+ [-u|--update_defer]
|
|
|
325406 |
|
|
|
325406 |
.B dmraid
|
|
|
325406 |
{-x| --remove}
|
|
|
325406 |
@@ -118,7 +120,14 @@ underlying the set, ie if sda is part of the set, remove sda1, sda2, etc.
|
|
|
325406 |
This prevents applications from directly accessiong the disks bypassing dmraid.
|
|
|
325406 |
RAID set names given on command line don't need to be fully specified
|
|
|
325406 |
(eg, "dmraid -ay sil" would activate all discovered Silicon Image Medley
|
|
|
325406 |
-RAID sets).
|
|
|
325406 |
+RAID sets). Option
|
|
|
325406 |
+.B -u
|
|
|
325406 |
+defers metadata update in case of rebuild is triggered parallelly with activation.
|
|
|
325406 |
+Awoids metadata update to "OK" state if volume is not registered to the event
|
|
|
325406 |
+monitoring.
|
|
|
325406 |
+Useful if volume is activating at early stage of booting process when registration
|
|
|
325406 |
+to the event monitoring is impossible.
|
|
|
325406 |
+
|
|
|
325406 |
|
|
|
325406 |
.TP
|
|
|
325406 |
.I {-b|--block_devices} [device-path...]
|
|
|
325406 |
@@ -208,7 +217,11 @@ Use CHAR as the separator between the device name and the partition number.
|
|
|
325406 |
.I {-R| --rebuild} RAID-set [device-path]
|
|
|
325406 |
Rebuild raid array after a drive has failed and a new drive is added.
|
|
|
325406 |
For Intel chipset based systems, there are two methods in which a new drive
|
|
|
325406 |
-is added to the system.
|
|
|
325406 |
+is added to the system. Option
|
|
|
325406 |
+.B -u
|
|
|
325406 |
+defers metadata update in case of rebuild is triggered.
|
|
|
325406 |
+Awoids metadata update to "OK" state if volume is not registered to the event
|
|
|
325406 |
+monitoring.
|
|
|
325406 |
|
|
|
325406 |
1. Using OROM to identify a new drive
|
|
|
325406 |
During system reboot, enter OROM and mark the new drive as the rebuild drive.
|
|
|
325406 |
diff --git a/tools/commands.c b/tools/commands.c
|
|
|
325406 |
index 4c71ae1..a3c77d2 100644
|
|
|
325406 |
--- a/tools/commands.c
|
|
|
325406 |
+++ b/tools/commands.c
|
|
|
325406 |
@@ -30,7 +30,7 @@ int add_dev_to_array(struct lib_context *lc, struct raid_set *rs,
|
|
|
325406 |
/*
|
|
|
325406 |
* Command line options.
|
|
|
325406 |
*/
|
|
|
325406 |
-static char const *short_opts = "a:hipP:"
|
|
|
325406 |
+static char const *short_opts = "a:hipP:u"
|
|
|
325406 |
#ifndef DMRAID_MINI
|
|
|
325406 |
"bc::dDEf:glxM:"
|
|
|
325406 |
#ifdef DMRAID_NATIVE_LOG
|
|
|
325406 |
@@ -46,6 +46,7 @@ static struct option long_opts[] = {
|
|
|
325406 |
{"format", required_argument, NULL, 'f'},
|
|
|
325406 |
{"partchar", required_argument, NULL, 'P'},
|
|
|
325406 |
{"no_partitions", no_argument, NULL, 'p'},
|
|
|
325406 |
+ {"update_defer", no_argument, NULL, 'u'},
|
|
|
325406 |
# ifndef DMRAID_MINI
|
|
|
325406 |
{"block_devices", no_argument, NULL, 'b'},
|
|
|
325406 |
{"display_columns", optional_argument, NULL, 'c'},
|
|
|
325406 |
@@ -197,6 +198,15 @@ check_part_separator(struct lib_context *lc, int arg)
|
|
|
325406 |
return lc_stralloc_opt(lc, LC_PARTCHAR, optarg) ? 1 : 0;
|
|
|
325406 |
}
|
|
|
325406 |
|
|
|
325406 |
+/* Defer any mtadata updates in case of volume activation
|
|
|
325406 |
+ * at early stage of OS boot */
|
|
|
325406 |
+static int
|
|
|
325406 |
+defer_update(struct lib_context *lc, int arg)
|
|
|
325406 |
+{
|
|
|
325406 |
+ lc_inc_opt(lc, arg);
|
|
|
325406 |
+ return 1;
|
|
|
325406 |
+}
|
|
|
325406 |
+
|
|
|
325406 |
/* Display help information */
|
|
|
325406 |
static int
|
|
|
325406 |
help(struct lib_context *lc, int arg)
|
|
|
325406 |
@@ -211,6 +221,7 @@ help(struct lib_context *lc, int arg)
|
|
|
325406 |
"\t[-P|--partchar CHAR]\n"
|
|
|
325406 |
"\t[-p|--no_partitions]\n"
|
|
|
325406 |
"\t[-Z|--rm_partitions]\n"
|
|
|
325406 |
+ "\t[-d|--update_defer]\n"
|
|
|
325406 |
"\t[--separator SEPARATOR]\n" "\t[RAID-set...]\n", c);
|
|
|
325406 |
log_print(lc, "%s\t{-h|--help}\n", c);
|
|
|
325406 |
log_print(lc, "%s\t{-V/--version}\n", c);
|
|
|
325406 |
@@ -219,11 +230,12 @@ help(struct lib_context *lc, int arg)
|
|
|
325406 |
log_print(lc,
|
|
|
325406 |
"* = [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking]\n");
|
|
|
325406 |
log_print(lc,
|
|
|
325406 |
- "%s\t{-a|--activate} {y|n|yes|no} *\n"
|
|
|
325406 |
+ "%s\t{-a|--activate} {y|n|yes|no} \n"
|
|
|
325406 |
"\t[-f|--format FORMAT[,FORMAT...]]\n"
|
|
|
325406 |
"\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n"
|
|
|
325406 |
"\t[--separator SEPARATOR]\n" "\t[-t|--test]\n"
|
|
|
325406 |
- "\t[-Z|--rm_partitions] [RAID-set...]\n", c);
|
|
|
325406 |
+ "\t[-Z|--rm_partitions] [RAID-set...]\n"
|
|
|
325406 |
+ "\t[-u|--update_defer]", c);
|
|
|
325406 |
log_print(lc,
|
|
|
325406 |
"%s\t{-b|--block_devices} *\n"
|
|
|
325406 |
"\t[-c|--display_columns][FIELD[,FIELD...]]...\n"
|
|
|
325406 |
@@ -255,7 +267,8 @@ help(struct lib_context *lc, int arg)
|
|
|
325406 |
"\t[--str[i[de]] [0-9]...[kK][bB]]\n"
|
|
|
325406 |
"\t{--disk[s] \"device-path[, device-path...\"}\n", c);
|
|
|
325406 |
log_print(lc, "%s\t{-x|--remove RAID-set} \n");
|
|
|
325406 |
- log_print(lc, "%s\t{-R|--rebuild} RAID-set [drive_name]\n", c);
|
|
|
325406 |
+ log_print(lc, "%s\t{-R|--rebuild} RAID-set [drive_name]\n"
|
|
|
325406 |
+ "\t[-u|--update_defer]", c);
|
|
|
325406 |
log_print(lc, "%s\t[{-f|--format FORMAT}]\n"
|
|
|
325406 |
"\t{-S|--spare [RAID-set]} \n"
|
|
|
325406 |
"\t{-M|--media \"device-path\"}\n", c);
|
|
|
325406 |
@@ -285,6 +298,19 @@ static struct actions actions[] = {
|
|
|
325406 |
0,
|
|
|
325406 |
},
|
|
|
325406 |
|
|
|
325406 |
+ /* Defer metadata update */
|
|
|
325406 |
+ {'u',
|
|
|
325406 |
+ UNDEF,
|
|
|
325406 |
+ UNDEF,
|
|
|
325406 |
+ ACTIVATE | REBUILD
|
|
|
325406 |
+#ifndef DMRAID_MINI
|
|
|
325406 |
+ | DBG | TEST | VERBOSE
|
|
|
325406 |
+#endif
|
|
|
325406 |
+ , NO_ARGS,
|
|
|
325406 |
+ defer_update,
|
|
|
325406 |
+ LC_DEFER_UPDATE,
|
|
|
325406 |
+ },
|
|
|
325406 |
+
|
|
|
325406 |
/* Format option. */
|
|
|
325406 |
{'f',
|
|
|
325406 |
FORMAT,
|
|
|
325406 |
@@ -726,7 +752,7 @@ handle_args(struct lib_context *lc, int argc, char ***argv)
|
|
|
325406 |
if (o == 'C') {
|
|
|
325406 |
*argv += optind - 1;
|
|
|
325406 |
return 1;
|
|
|
325406 |
- } else if (o == 'R' && argc == 4) {
|
|
|
325406 |
+ } else if (o == 'R' && (argc == 4 || argc == 5)) {
|
|
|
325406 |
if (*(*argv + optind))
|
|
|
325406 |
save_drive_name(lc, *(*argv + optind));
|
|
|
325406 |
}
|
|
|
325406 |
@@ -744,7 +770,7 @@ handle_args(struct lib_context *lc, int argc, char ***argv)
|
|
|
325406 |
ret = check_actions_arguments(lc);
|
|
|
325406 |
|
|
|
325406 |
*argv += optind;
|
|
|
325406 |
- if (argc == 4 && lc->options[LC_REBUILD_SET].opt)
|
|
|
325406 |
+ if ((argc == 4 || argc == 5) && lc->options[LC_REBUILD_SET].opt)
|
|
|
325406 |
*argv += 1;
|
|
|
325406 |
|
|
|
325406 |
return ret;
|
|
|
325406 |
@@ -871,7 +897,7 @@ struct prepost prepost[] = {
|
|
|
325406 |
0,
|
|
|
325406 |
activate_or_deactivate_sets,
|
|
|
325406 |
},
|
|
|
325406 |
-
|
|
|
325406 |
+
|
|
|
325406 |
#ifndef DMRAID_MINI
|
|
|
325406 |
/* Display block devices. */
|
|
|
325406 |
{BLOCK_DEVICES,
|
|
|
325406 |
--
|
|
|
325406 |
1.7.0.4
|
|
|
325406 |
|