Skip to contentSkip to conversation

main - thin: correct ptr test for thin snapshot merging

PATCH Zdenek Kabelac 1 participant 1 message Mar 10, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=413a114cdbb1fa0c198fb9a3f71d47dcb3d5e28d
Commit:        413a114cdbb1fa0c198fb9a3f71d47dcb3d5e28d
Parent:        b2616cd45670866b4f5b46675fe3f1563eea3415
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Mar 9 16:23:08 2021 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Mar 10 01:09:14 2021 +0100

thin: correct ptr test for thin snapshot merging

The correct test needs to actually check 'lv->snapshot' is not NULL, so the 'find_snapshot()' can work.

Test lv_is_snapshot was actually irrelavant for this case.

Also initialize device_id.

---
 tools/lvconvert_poll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lvconvert_poll.c +2 -2
index 0eae74616..5adb14506 100644
@@ -174,9 +174,9 @@ progress_t poll_thin_merge_progress(struct cmd_context *cmd,
 				    const char *name __attribute__((unused)),
 				    struct daemon_parms *parms)
 {
-	uint32_t device_id;
+	uint32_t device_id = 0;
 
-	if (!lv_thin_device_id(lv, &device_id) && !lv_is_snapshot(lv)) {
+	if (!lv_thin_device_id(lv, &device_id) || !lv->snapshot) {
 		stack;
 		return PROGRESS_CHECK_FAILED;
 	}