Skip to contentSkip to conversation

master - pv_write: check for lvmcache_add_mda failure

PATCH Zdenek Kabelac 1 participant 1 message Nov 22, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d3b8bfd1c7cc22383580b2723415ddcf9fbe7d7
Commit:        3d3b8bfd1c7cc22383580b2723415ddcf9fbe7d7
Parent:        a50a297f6e75d650abe9fe084b499a7968cc59ee
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Nov 22 13:25:27 2013 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Nov 22 20:55:09 2013 +0100

pv_write: check for lvmcache_add_mda failure

Add missing test of failing lvmcache_add_mda() call.

---
 WHATS_NEW                     |    1 +
 lib/format_text/format-text.c |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
WHATS_NEW +1 -0
index 99f9067..41251b8 100644
@@ -1,5 +1,6 @@
 Version 2.02.105 -
 =====================================
+  Check for failure of lvmcache_add_mda() when writing pv.
   Check for failure of dev_get_size() when reporting device size.
   Drop extra unneeded '/' when scanning sysfs directory.
   Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
lib/format_text/format-text.c +4 -2
index e67d24d..275d16f 100644
@@ -1328,8 +1328,10 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
 				   mdac->area.size >> SECTOR_SHIFT);
 
 		// if fmt is not the same as info->fmt we are in trouble
-		lvmcache_add_mda(info, mdac->area.dev,
-				 mdac->area.start, mdac->area.size, mda_is_ignored(mda));
+		if (!lvmcache_add_mda(info, mdac->area.dev,
+				      mdac->area.start, mdac->area.size,
+				      mda_is_ignored(mda)))
+			return_0;
 	}
 
 	if (!lvmcache_update_bas(info, pv))