Skip to contentSkip to conversation

main - writecache: fix missing sync_dev_names when attaching cache

PATCH David Teigland 1 participant 1 message Jul 21, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d91c018732c07c5d8c6bfc05570dbc82644a957c
Commit:        d91c018732c07c5d8c6bfc05570dbc82644a957c
Parent:        640fe5cf42fd136e60778513c5fc28499e78f9c2
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Jul 21 13:16:21 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jul 21 13:16:21 2021 -0500

writecache: fix missing sync_dev_names when attaching cache

When activating an LV to check the fs block size, wait for the LV dev to be accessible before running blkid on it.

---
 tools/lvconvert.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/lvconvert.c +6 -0
index 7fbe84952..f699443fd 100644
@@ -6124,6 +6124,12 @@ int lvconvert_writecache_attach_single(struct cmd_context *cmd,
 			log_error("Failed to activate LV to check block size %s", display_lvname(lv));
 			goto bad;
 		}
+		if (!sync_local_dev_names(cmd)) {
+			log_error("Failed to sync local dev names.");
+			if (!deactivate_lv(cmd, lv))
+				stack;
+			goto bad;
+		}
 	}
 
 	if (!_set_writecache_block_size(cmd, lv, &block_size_sectors)) {