diff -Nru LVM2-orig//lib/activate/activate.c LVM2-working//lib/activate/activate.c --- LVM2-orig//lib/activate/activate.c 2008-06-08 19:33:15.000000000 +0800 +++ LVM2-working//lib/activate/activate.c 2009-10-19 14:45:59.000000000 +0800 @@ -582,7 +582,7 @@ return r; } -static int _lv_preload(struct logical_volume *lv) +static int _lv_preload(struct logical_volume *lv, int *flush_required) { int r; struct dev_manager *dm; @@ -590,7 +590,7 @@ if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name))) return_0; - if (!(r = dev_manager_preload(dm, lv))) + if (!(r = dev_manager_preload(dm, lv, flush_required))) stack; dev_manager_destroy(dm); @@ -612,7 +612,7 @@ return r; } -static int _lv_suspend_lv(struct logical_volume *lv, int lockfs) +static int _lv_suspend_lv(struct logical_volume *lv, int lockfs, int flush_required) { int r; struct dev_manager *dm; @@ -620,7 +620,7 @@ if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name))) return_0; - if (!(r = dev_manager_suspend(dm, lv, lockfs))) + if (!(r = dev_manager_suspend(dm, lv, lockfs, flush_required))) stack; dev_manager_destroy(dm); @@ -838,7 +838,7 @@ { struct logical_volume *lv, *lv_pre; struct lvinfo info; - int lockfs = 0; + int lockfs = 0, flush_required = 0; if (!activation()) return 1; @@ -863,7 +863,7 @@ /* If VG was precommitted, preload devices for the LV */ if ((lv_pre->vg->status & PRECOMMITTED)) { - if (!_lv_preload(lv_pre)) { + if (!_lv_preload(lv_pre, &flush_required)) { /* FIXME Revert preloading */ return_0; } @@ -878,7 +878,7 @@ if (lv_is_origin(lv_pre) || lv_is_cow(lv_pre)) lockfs = 1; - if (!_lv_suspend_lv(lv, lockfs)) { + if (!_lv_suspend_lv(lv, lockfs, flush_required)) { memlock_dec(); fs_unlock(); return 0; diff -Nru LVM2-orig//lib/activate/dev_manager.c LVM2-working//lib/activate/dev_manager.c --- LVM2-orig//lib/activate/dev_manager.c 2008-06-18 19:32:14.000000000 +0800 +++ LVM2-working//lib/activate/dev_manager.c 2009-10-19 14:43:48.000000000 +0800 @@ -50,6 +50,7 @@ const char *stripe_filler; void *target_state; uint32_t pvmove_mirror_count; + int flush_required; char *vg_name; }; @@ -1072,7 +1073,7 @@ break; case SUSPEND: dm_tree_skip_lockfs(root); - if ((lv->status & MIRRORED) && !(lv->status & PVMOVE)) + if (!dm->flush_required && (lv->status & MIRRORED) && !(lv->status & PVMOVE)) dm_tree_use_no_flush_suspend(root); case SUSPEND_WITH_LOCKFS: if (!dm_tree_suspend_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) @@ -1088,6 +1089,9 @@ if (!dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) goto_out; + if (dm_tree_node_size_changed(root)) + dm->flush_required = 1; + if ((action == ACTIVATE) && !dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) goto_out; @@ -1118,13 +1122,19 @@ return _tree_action(dm, lv, CLEAN); } -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv) +int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, + int *flush_required) { /* FIXME Update the pvmove implementation! */ if ((lv->status & PVMOVE) || (lv->status & LOCKED)) return 1; - return _tree_action(dm, lv, PRELOAD); + if (!_tree_action(dm, lv, PRELOAD)) + return 0; + + *flush_required = dm->flush_required; + + return 1; } int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv) @@ -1139,8 +1149,10 @@ } int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, - int lockfs) + int lockfs, int flush_required) { + dm->flush_required = flush_required; + return _tree_action(dm, lv, lockfs ? SUSPEND_WITH_LOCKFS : SUSPEND); } diff -Nru LVM2-orig//lib/activate/dev_manager.h LVM2-working//lib/activate/dev_manager.h --- LVM2-orig//lib/activate/dev_manager.h 2007-11-13 04:51:53.000000000 +0800 +++ LVM2-working//lib/activate/dev_manager.h 2009-10-19 14:43:48.000000000 +0800 @@ -49,9 +49,10 @@ struct logical_volume *lv, int wait, float *percent, uint32_t *event_nr); int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, - int lockfs); + int lockfs, int flush_required); int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv); -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv); +int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, + int *flush_required); int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv); int dev_manager_lv_mknodes(const struct logical_volume *lv); diff -Nru LVM2-orig//tools/lvresize.c LVM2-working//tools/lvresize.c --- LVM2-orig//tools/lvresize.c 2008-04-29 23:25:28.000000000 +0800 +++ LVM2-working//tools/lvresize.c 2009-10-19 15:03:10.000000000 +0800 @@ -530,12 +530,6 @@ lp->resize = LV_EXTEND; } - if (lp->mirrors && activation() && - lv_info(cmd, lv, &info, 0, 0) && info.exists) { - log_error("Mirrors cannot be resized while active yet."); - return ECMD_FAILED; - } - if (lv_is_origin(lv)) { if (lp->resize == LV_REDUCE) { log_error("Snapshot origin volumes cannot be reduced "