master - clvmd: drop old saved_vg when returning new saved_vg
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5b6e62dc1f3b27089179308fa2f7d004850d5a2c Commit: 5b6e62dc1f3b27089179308fa2f7d004850d5a2c Parent: cdb8400de2d89e2e5901524acdd2178118d740b7 Author: David Teigland <[email protected]> AuthorDate: Thu Apr 26 14:41:57 2018 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Apr 26 14:57:45 2018 -0500
clvmd: drop old saved_vg when returning new saved_vg
In some pvmove tests, clvmd uses the new (precommitted) saved_vg, but then requests the old saved_vg, and expects that the new saved_vg be returned instead of the old. So, when returning the new saved_vg, forget the old one so we don't return it again.
--- lib/activate/activate.c | 12 +++++- lib/cache/lvmcache.c | 89 +++++++++++++++++++++++++++++++++++++++++++++-- lib/metadata/metadata.c | 2 +- 3 files changed, 97 insertions(+), 6 deletions(-)
lib/activate/activate.c +10 -2
@@ -2164,6 +2164,8 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s, vg_pre =lvmcache_get_saved_vg (vgid,1 );if (!vg || !vg_pre) { +log_debug ("lv_suspend dropping both saved vgs and rereading" ); +lvmcache_drop_saved_vgid (vgid); vg =vg_read_by_vgid (cmd, vgid,0 );
@@ -2175,8 +2177,14 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s, goto out; } -log_debug ("lv_suspend found vg %s vg %p vg_pre %p" , - vg->name, vg, vg_pre); +/* +* Note that vg and vg_pre returned by vg_read_by_vgid will +* not be the same as saved_vg_old/saved_vg_new that would +* be returned by lvmcache_get_saved_vg() because the saved_vg's +* are copies of the vg struct that is created by _vg_read. +* (Should we grab and use the saved_vg to use here instead of +* the vg returned by vg_read_by_vgid?) +*/ if ((vg->status &EXPORTED_VG ) || (vg_pre->status &EXPORTED_VG )) {log_error ("Volume group \"%s\" is exported" , vg->name);
lib/cache/lvmcache.c +86 -3
123 lines not on this page · raw message
lib/metadata/metadata.c +1 -1
@@ -3869,7 +3869,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,if (warn_flags &SKIP_RESCAN ) goto find_vg; skipped_rescan =0 ; -log_debug_metadata ("Rescanning devices for for %s" , vgname); +log_debug_metadata ("Rescanning devices for %s" , vgname);lvmcache_label_rescan_vg (cmd, vgname, vgid); }else {log_debug_metadata ("Skipped rescanning devices for %s" , vgname);