Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/metadata.c

PATCH [email protected] 3 participants 3 messages Apr 7, 2008 – Apr 10, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-04-07 22:12:37

Modified files:
. : WHATS_NEW
lib/metadata : metadata.c

Log message:
create fids for internal orphan VGs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.828&r2=1.829
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.165&r2=1.166

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Create a fid for internal orphan VGs.
   Update lvmcache VG lock state for all locking types now.
   Fix output if overriding command_names on cmdline.
   Add detection of clustered mirror log capability.
lib/metadata/metadata.c +9 -0
@@ -1382,6 +1382,15 @@
 		return NULL;
 	}
 
+	/* create format instance with appropriate metadata area */
+	if (!(vg->fid = vginfo->fmt->ops->create_instance(vginfo->fmt,
+							  orphan_vgname, NULL,
+							  NULL))) {
+		log_error("Failed to create format instance");
+		dm_pool_free(cmd->mem, vg);
+		return NULL;
+	}
+
 	list_iterate_items(info, &vginfo->infos) {
 		if (!(pv = _pv_read(cmd, dev_name(info->dev), NULL, NULL, 1))) {
 			continue;
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

lib/metadata/metadata.c line 1393

Quoted 9 lines · agk at sourceware.org
lib/metadata/metadata.c +9 -0
+	/* create format instance with appropriate metadata area */
+	if (!(vg->fid = vginfo->fmt->ops->create_instance(vginfo->fmt,
+							  orphan_vgname, NULL,
+							  NULL))) {
+		log_error("Failed to create format instance");
+		dm_pool_free(cmd->mem, vg);
+		return NULL;
+	}
+

This breaks _vg_read_orphans if there are no orphans of the required format type on-disk. In that case, vginfo_from_vgname returns NULL - we cannot rely on getting the format type from the cache since that requires there to always be at least one orphan for each format type on-disk (or we need to change the cache to make one up in that case).

This is the reason for determining the format type from the orphan VG name in the patch I sent.

With this version, the patch to make vgreduce use vg_split_mdas would fail with:

# vgreduce t0 /dev/loop0
Unable to read orphan PVs

Unless you already have at least one orphan PV of the same format type.

Regards,
Bryn.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFH+08G6YSQoMYUY94RAlwxAKC+yMxjLJay78Z1Rv6vholXBw+AzgCfRBYN MsKfwV/LPJyHI2mqrMX5BSE=
=aD5d
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 6 lines · Bryn M. Reeves

In that case, vginfo_from_vgname returns NULL - we
cannot rely on getting the format type from the cache since that requires there to always be at least one orphan for each format type on-disk (or we need to change the cache to make one up in that case).

Unless you already have at least one orphan PV of the same format type.

I changed the cache to be pre-populated with all the orphan VGs, even if they contain no PVs.

Alasdair

Signature · 1 line
agk at redhat.com