Skip to contentSkip to conversation

When a resume_lv() fails, fail also in resume_lvs().

PATCH New Greg Price 1 participant 1 message Apr 7, 2009

lore
Share & tools
lore

Greg Price

author
#0 lore raw

PATCH 1/1 When a resume_lv() fails, fail also in resume_lvs().

When a resume fails because device-mapper returns EINVAL to a reload ioctl, this bug can cause pvmove to update an LV's metadata as if it had been copied over, when in fact it has not. This can lead to data loss if not swiftly and manually noticed.

The corresponding code in suspend_lvs() attempts to resume any successfully suspended LVs after an error. It's possible resume_lvs() should do likewise. On the other hand, it's not clear what to do if one of those attempts itself fails. suspend_lvs() ignores further errors in that case; presumably, like resume_lvs(), it was written under the assumption that resume_lv() cannot fail.

---
 lib/locking/locking.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
lib/locking/locking.c +6 -2
index 81cb992..0c225ed 100644
@@ -369,8 +369,12 @@ int resume_lvs(struct cmd_context *cmd, struct list *lvs)
 {
 	struct lv_list *lvl;
 
-	list_iterate_items(lvl, lvs)
-		resume_lv(cmd, lvl->lv);
+	list_iterate_items(lvl, lvs) {
+		if (!resume_lv(cmd, lvl->lv)) {
+			log_error("Failed to resume %s", lvl->lv->name);
+			return 0;
+		}
+        }
 
 	return 1;
 }
Signature · 1 line
1.5.2.2