summaryrefslogtreecommitdiff
path: root/tools/lvchange.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lvchange.c')
-rw-r--r--tools/lvchange.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 08d31d716..1c8b14cba 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -739,6 +739,21 @@ static int _lvchange_writemostly(struct logical_volume *lv)
struct cmd_context *cmd = lv->vg->cmd;
struct lv_segment *raid_seg = first_seg(lv);
+ /*
+ * Prohibit on synchronization.
+ *
+ * FIXME: we can do better once we can distingush between
+ * an initial sync after a linear -> raid1 upconversion
+ * and any later additions of legs, requested resyncs
+ * via lvchange or leg repairs/replacements.
+ */
+ if (!lv_raid_in_sync(lv)) {
+ log_error("Unable to change write%s on %s while it is not in-sync.",
+ arg_is_set(cmd, writemostly_ARG) ? "mostly" : "behind",
+ display_lvname(lv));
+ return 0;
+ }
+
if (arg_is_set(cmd, writebehind_ARG))
raid_seg->writebehind = arg_uint_value(cmd, writebehind_ARG, 0);
@@ -816,7 +831,6 @@ static int _lvchange_writemostly(struct logical_volume *lv)
}
}
- /* FIXME: prohibit on primary if not in-sync! */
if (!lv_update_and_reload(lv))
return_0;