1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

When turning merging origin into non-merging origin, there is bad sequence:

snapshots are suspended, new origin is created, snapshots are resumed, new
origin is resumed.  So it allocates memory while suspended.

To fix it, move vg_commit after suspend_lv, so that the suspend code will
treat it as precommitted vg and will preload new origin prior to suspend.

NOTE: agk doesn't like this "hack"; need to revisit and fix
This commit is contained in:
Mike Snitzer 2010-01-13 01:52:58 +00:00
parent 3a8d01b6e1
commit 28c3f0354a

View File

@ -2140,19 +2140,28 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
}
/* store it on disks */
if (!vg_write(vg) || !vg_commit(vg))
if (!vg_write(vg))
return_0;
backup(vg);
/* If no snapshots left or if we stopped merging, reload */
if (origin && (!lv_is_origin(origin) || was_merging)) {
if (!suspend_lv(cmd, origin))
if (!suspend_lv(cmd, origin)) {
log_error("Failed to refresh %s without snapshot.", origin->name);
else if (!resume_lv(cmd, origin))
return 0;
}
if (!vg_commit(vg))
return_0;
if (!resume_lv(cmd, origin)) {
log_error("Failed to resume %s.", origin->name);
return 0;
}
} else {
if (!vg_commit(vg))
return_0;
}
backup(vg);
if (lv_is_visible(lv))
log_print("Logical volume \"%s\" successfully removed", lv->name);