diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-01-28 13:39:41 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-01-28 13:45:18 +0100 |
commit | 93b90157605f557cd4b0e48c38e6f290eaa871b1 (patch) | |
tree | eb43e3cb686febb6ef74ac3880f69ff3b536640a /lib | |
parent | b254d330e4410e3eb10ab65fbe892ba56f95e2e9 (diff) | |
download | lvm2-93b90157605f557cd4b0e48c38e6f290eaa871b1.tar.gz |
raid: fix raid image splitting
When raid leg is extracted, now the preload code handles this state
correctly and put proper new table entry into dm tree,
so the activation of extracted leg and removed metadata works
after commit.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/metadata/raid_manip.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 5c2ca95ae..4ce84a0fd 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1149,12 +1149,6 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name, return 0; } - if (!resume_lv(lv->vg->cmd, lv_lock_holder(lv))) { - log_error("Failed to resume %s/%s after committing changes", - lv->vg->name, lv->name); - return 0; - } - /* * First activate the newly split LV and LVs on the removal list. * This is necessary so that there are no name collisions due to @@ -1164,26 +1158,22 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name, if (!activate_lv_excl_local(cmd, lvl->lv)) return_0; + dm_list_iterate_items(lvl, &removal_list) + if (!activate_lv_excl_local(cmd, lvl->lv)) + return_0; + + if (!resume_lv(cmd, lv_lock_holder(lv))) { + log_error("Failed to resume %s/%s after committing changes", + lv->vg->name, lv->name); + return 0; + } + /* * Since newly split LV is typically already active - we need to call * suspend() and resume() to also rename it. * * TODO: activate should recognize it and avoid these 2 calls */ - if (!suspend_lv(cmd, lvl->lv)) { - log_error("Failed to suspend %s.", lvl->lv->name); - return 0; - } - - if (!resume_lv(cmd, lvl->lv)) { - log_error("Failed to reactivate %s.", lvl->lv->name); - return 0; - } - - dm_list_iterate_items(lvl, &removal_list) - if (!activate_lv_excl_local(cmd, lvl->lv)) - return_0; - /* * Eliminate the residual LVs |