[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] Allow metadata correction even when PVs are missing



Same patch, with a test added (who would have guessed that the testsuite
already had a test for this, just disabled since it was broken?)

--- old-upstream/lib/metadata/metadata.c	2009-06-10 21:50:17.987384143 +0200
+++ new-upstream/lib/metadata/metadata.c	2009-06-10 21:50:18.019381645 +0200
@@ -1835,6 +1835,7 @@ static struct volume_group *_vg_read(str
 	int inconsistent_vgid = 0;
 	int inconsistent_pvs = 0;
 	unsigned use_precommitted = precommitted;
+	unsigned saved_handles_missing_pvs = cmd->handles_missing_pvs;
 	struct dm_list *pvids;
 	struct pv_list *pvl, *pvl2;
 	struct dm_list all_pvs;
@@ -2076,11 +2077,14 @@ static struct volume_group *_vg_read(str
 		log_warn("WARNING: Inconsistent metadata found for VG %s - updating "
 			 "to use version %u", vgname, correct_vg->seqno);
 
+		cmd->handles_missing_pvs = 1;
 		if (!vg_write(correct_vg)) {
 			log_error("Automatic metadata correction failed");
 			vg_release(correct_vg);
+			cmd->handles_missing_pvs = saved_handles_missing_pvs;
 			return NULL;
 		}
+		cmd->handles_missing_pvs = saved_handles_missing_pvs;
 
 		if (!vg_commit(correct_vg)) {
 			log_error("Automatic metadata correction commit "

--- old-upstream/test/t-unlost-pv.sh	2009-06-10 21:50:17.987384143 +0200
+++ new-upstream/test/t-unlost-pv.sh	2009-06-10 21:50:18.023382573 +0200
@@ -29,7 +29,6 @@ vgreduce --removemissing --force $vg
 enable_dev $dev1
 check
 
-exit 0 # FIXME, bug demonstration code follows
 # try to just change metadata; we expect the new version (with MISSING_PV set
 # on the reappeared volume) to be written out to the previously missing PV
 vgextend $vg $dev1
Yours,
   Petr.

-- 
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]