Skip to contentSkip to conversation

main - writecache: don't pvmove device used by writecache

PATCH David Teigland 1 participant 1 message Jun 2, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7f107c24666c8577f30e530b74f1ce0347e459b
Commit:        e7f107c24666c8577f30e530b74f1ce0347e459b
Parent:        247f69f9aafe731ef85268da1e6ce817295b265d
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Jun 2 11:12:20 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jun 2 11:12:20 2021 -0500

writecache: don't pvmove device used by writecache

The existing check didn't cover the unusual case where the cachevol exists on the same device as the origin LV.

---
 tools/pvmove.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/pvmove.c +9 -0
index da635a662..bb372f7dc 100644
@@ -387,6 +387,15 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
 			return NULL;
 		}
 
+		if (lv_is_writecache(lv)) {
+			struct logical_volume *lv_cachevol = first_seg(lv)->writecache;
+			if (lv_is_on_pvs(lv_cachevol, source_pvl)) {
+				log_error("Unable to move device used for writecache cachevol %s.", display_lvname(lv_cachevol));
+				return NULL;
+			}
+
+		}
+
 		if (lv_is_raid(lv) && lv_raid_has_integrity(lv)) {
 			log_error("Unable to pvmove device used for raid with integrity.");
 			return NULL;