diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2018-10-31 23:05:08 +0100 |
---|---|---|
committer | Heinz Mauelshagen <heinzm@redhat.com> | 2018-12-11 16:35:34 +0100 |
commit | dd5716ddf258c4a44819fa90d3356833ccf767b4 (patch) | |
tree | e30f68547a530edf37523866b2ba7a9588abf7fa /lib/activate | |
parent | b2d1facd960e192b38ae4a9866f3bea9646e6cd5 (diff) | |
download | lvm2-dd5716ddf258c4a44819fa90d3356833ccf767b4.tar.gz |
raid: fix (de)activation of RaidLVs with visible SubLVs
There's a small window during creation of a new RaidLV when
rmeta SubLVs are made visible to wipe them in order to prevent
erroneous discovery of stale RAID metadata. In case a crash
prevents the SubLVs from being committed hidden after such
wiping, the RaidLV can still be activated with the SubLVs visible.
During deactivation though, a deadlock occurs because the visible
SubLVs are deactivated before the RaidLV.
The patch adds _check_raid_sublvs to the raid validation in merge.c,
an activation check to activate.c (paranoid, because the merge.c check
will prevent activation in case of visible SubLVs) and shares the
existing wiping function _clear_lvs in raid_manip.c moved to lv_manip.c
and renamed to activate_and_wipe_lvlist to remove code duplication.
Whilst on it, introduce activate_and_wipe_lv to share with
(lvconvert|lvchange).c.
Resolves: rhbz1633167
Diffstat (limited to 'lib/activate')
-rw-r--r-- | lib/activate/activate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/activate/activate.c b/lib/activate/activate.c index ce9d67c39..678dec9e8 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -2532,6 +2532,12 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, goto out; } + if (lv_raid_has_visible_sublvs(lv)) { + log_error("Refusing activation of RAID LV %s with " + "visible SubLVs.", display_lvname(lv)); + goto out; + } + if (test_mode()) { _skip("Activating %s.", display_lvname(lv)); r = 1; |