From 013577fb6a47bb8df8eeaf277aaea0bd6760aa4a Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 26 Oct 2006 18:22:10 +0000 Subject: [PATCH] When adding snapshot leave cow LV mapped device active after zeroing. --- WHATS_NEW | 1 + tools/lvcreate.c | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 55787ce7a..62a9421d8 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.13 - =================================== + When adding snapshot leave cow LV mapped device active after zeroing. Fix a clvmd debug message. Add dev_flush() to set_lv(). Add lvchange --resync. diff --git a/tools/lvcreate.c b/tools/lvcreate.c index eb60b5551..707978ff6 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -761,13 +761,14 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) return 0; } - if (!activate_lv(cmd, lv)) { - if (lp->snapshot) - /* FIXME Remove the failed lv we just added */ + if (lp->snapshot) { + if (!activate_lv_excl(cmd, lv)) { log_error("Aborting. Failed to activate snapshot " "exception store. Remove new LV and retry."); - else - log_error("Failed to activate new LV."); + return 0; + } + } else if (!activate_lv(cmd, lv)) { + log_error("Failed to activate new LV."); return 0; } @@ -787,10 +788,8 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) /* Reset permission after zeroing */ if (!(lp->permission & LVM_WRITE)) lv->status &= ~LVM_WRITE; - if (!deactivate_lv(cmd, lv)) { - log_err("Couldn't deactivate new snapshot."); - return 0; - } + + /* cow LV remains active and becomes snapshot LV */ if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL, org->le_count, lp->chunk_size)) {