public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2009-09-14 22:47 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2009-09-14 22:47 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-09-14 22:47:50

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c no_locking.c 
	tools          : dumpconfig.c lvchange.c lvconvert.c lvcreate.c 
	                 lvmcmdline.c lvremove.c lvrename.c polldaemon.c 
	                 pvchange.c pvcreate.c pvresize.c pvscan.c 
	                 reporter.c toollib.c vgcfgbackup.c 
	                 vgcfgrestore.c vgchange.c vgck.c vgconvert.c 
	                 vgcreate.c vgdisplay.c vgexport.c vgextend.c 
	                 vgimport.c vgmerge.c vgmknodes.c vgreduce.c 
	                 vgremove.c vgrename.c vgscan.c vgsplit.c 

Log message:
	Add lots of missing stack debug messages to tools.
	Make readonly locking available as locking type 4.
	Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1259&r2=1.1260
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/no_locking.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dumpconfig.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.109&r2=1.110
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.207&r2=1.208
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.105&r2=1.106
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvremove.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.84&r2=1.85
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvscan.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.167&r2=1.168
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgbackup.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgrestore.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgck.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgdisplay.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgexport.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgimport.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmknodes.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgscan.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94

--- LVM2/WHATS_NEW	2009/09/11 16:06:31	1.1259
+++ LVM2/WHATS_NEW	2009/09/14 22:47:49	1.1260
@@ -1,5 +1,8 @@
 Version 2.02.52 -
 =================================
+  Add lots of missing stack debug messages to tools.
+  Make readonly locking available as locking type 4.
+  Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)
   Add manpage entry for dmsetup's udevcomplete_all and udevcookies commands.
   Add DM_UDEV_RULES_VSN udev enviroment variable.
   Check that udev is running and set internal state appropriately.
@@ -97,6 +100,7 @@
 
 Version 2.02.49 - 15th July 2009
 ================================
+  Add readonly locking type to replace implementation of --ignorelockingfailure.
   Exclude VG_GLOBAL from vg_write_lock_held so scans open devs read-only again.
   Add unit test case for liblvm VG create/delete APIs.
   Add liblvm APIs to implement creation and deletion of VGs.
--- LVM2/lib/locking/locking.c	2009/09/02 21:34:11	1.65
+++ LVM2/lib/locking/locking.c	2009/09/14 22:47:49	1.66
@@ -261,6 +261,13 @@
 		return 1;
 #endif
 
+	case 4:
+		log_verbose("Read-only locking selected. "
+			    "Only read operations permitted.");
+		if (!init_readonly_locking(&_locking, cmd))
+			break;
+		return 1;
+
 	default:
 		log_error("Unknown locking type requested.");
 		return 0;
@@ -280,7 +287,6 @@
 	if (!ignorelockingfailure())
 		return 0;
 
-	/* FIXME Ensure only read ops are permitted */
 	log_verbose("Locking disabled - only read operations permitted.");
 	init_readonly_locking(&_locking, cmd);
 
--- LVM2/lib/locking/no_locking.c	2009/08/02 21:03:09	1.18
+++ LVM2/lib/locking/no_locking.c	2009/09/14 22:47:49	1.19
@@ -71,10 +71,13 @@
 				   uint32_t flags)
 {
 	if ((flags & LCK_TYPE_MASK) == LCK_WRITE &&
-	    (flags & LCK_SCOPE_MASK) == LCK_VG) {
+	    (flags & LCK_SCOPE_MASK) == LCK_VG &&
+	    !(flags & LCK_CACHE) &&
+	    strcmp(resource, VG_GLOBAL)) {
 		log_error("Write locks are prohibited with --ignorelockingfailure.");
 		return 0;
 	}
+
 	return _no_lock_resource(cmd, resource, flags);
 }
 
--- LVM2/tools/dumpconfig.c	2008/01/30 14:00:01	1.7
+++ LVM2/tools/dumpconfig.c	2009/09/14 22:47:49	1.8
@@ -22,8 +22,10 @@
 	if (arg_count(cmd, file_ARG))
 		file = arg_str_value(cmd, file_ARG, "");
 
-	if (!write_config_file(cmd->cft, file, argc, argv))
+	if (!write_config_file(cmd->cft, file, argc, argv)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/lvchange.c	2009/08/13 14:27:33	1.109
+++ LVM2/tools/lvchange.c	2009/09/14 22:47:49	1.110
@@ -591,8 +591,10 @@
 
 	/* access permission change */
 	if (arg_count(cmd, permission_ARG)) {
-		if (!archive(lv->vg))
+		if (!archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_permission(cmd, lv);
 		docmds++;
@@ -600,8 +602,10 @@
 
 	/* allocation policy change */
 	if (arg_count(cmd, contiguous_ARG) || arg_count(cmd, alloc_ARG)) {
-		if (!archived && !archive(lv->vg))
+		if (!archived && !archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_alloc(cmd, lv);
 		docmds++;
@@ -609,8 +613,10 @@
 
 	/* read ahead sector change */
 	if (arg_count(cmd, readahead_ARG)) {
-		if (!archived && !archive(lv->vg))
+		if (!archived && !archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_readahead(cmd, lv);
 		docmds++;
@@ -618,19 +624,25 @@
 
 	/* read ahead sector change */
 	if (arg_count(cmd, persistent_ARG)) {
-		if (!archived && !archive(lv->vg))
+		if (!archived && !archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_persistent(cmd, lv);
 		docmds++;
-		if (sigint_caught())
+		if (sigint_caught()) {
+			stack;
 			return ECMD_FAILED;
+		}
 	}
 
 	/* add tag */
 	if (arg_count(cmd, addtag_ARG)) {
-		if (!archived && !archive(lv->vg))
+		if (!archived && !archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_tag(cmd, lv, addtag_ARG);
 		docmds++;
@@ -638,8 +650,10 @@
 
 	/* del tag */
 	if (arg_count(cmd, deltag_ARG)) {
-		if (!archived && !archive(lv->vg))
+		if (!archived && !archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 		archived = 1;
 		doit += lvchange_tag(cmd, lv, deltag_ARG);
 		docmds++;
@@ -649,28 +663,38 @@
 		log_print("Logical volume \"%s\" changed", lv->name);
 
 	if (arg_count(cmd, resync_ARG))
-		if (!lvchange_resync(cmd, lv))
+		if (!lvchange_resync(cmd, lv)) {
+			stack;
 			return ECMD_FAILED;
+		}
 
 	/* availability change */
 	if (arg_count(cmd, available_ARG)) {
-		if (!lvchange_availability(cmd, lv))
+		if (!lvchange_availability(cmd, lv)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	}
 
 	if (arg_count(cmd, refresh_ARG))
-		if (!lvchange_refresh(cmd, lv))
+		if (!lvchange_refresh(cmd, lv)) {
+			stack;
 			return ECMD_FAILED;
+		}
 
 	if (!arg_count(cmd, available_ARG) &&
 	    !arg_count(cmd, refresh_ARG) &&
 	    arg_count(cmd, monitor_ARG)) {
-		if (!lvchange_monitoring(cmd, lv))
+		if (!lvchange_monitoring(cmd, lv)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	}
 
-	if (doit != docmds)
+	if (doit != docmds) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/lvconvert.c	2009/08/02 21:59:21	1.91
+++ LVM2/tools/lvconvert.c	2009/09/14 22:47:49	1.92
@@ -904,15 +904,23 @@
 			log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
 			return ECMD_FAILED;
 		}
-		if (!archive(lv->vg))
+		if (!archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
-		if (!lvconvert_snapshot(cmd, lv, lp))
+		}
+		if (!lvconvert_snapshot(cmd, lv, lp)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	} else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) {
-		if (!archive(lv->vg))
+		if (!archive(lv->vg)) {
+			stack;
 			return ECMD_FAILED;
-		if (!_lvconvert_mirrors(cmd, lv, lp))
+		}
+		if (!_lvconvert_mirrors(cmd, lv, lp)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	}
 
 	return ECMD_PROCESSED;
--- LVM2/tools/lvcreate.c	2009/07/26 02:34:09	1.207
+++ LVM2/tools/lvcreate.c	2009/09/14 22:47:49	1.208
@@ -586,14 +586,19 @@
 	vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0);
 	if (vg_read_error(vg)) {
 		vg_release(vg);
+		stack;
 		return ECMD_FAILED;
 	}
 
-	if (!_update_extents_params(vg, &lp, &lcp))
+	if (!_update_extents_params(vg, &lp, &lcp)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!lv_create_single(vg, &lp))
+	if (!lv_create_single(vg, &lp)) {
+		stack;
 		r = ECMD_FAILED;
+	}
 
 	unlock_and_release_vg(cmd, vg, lp.vg_name);
 	return r;
--- LVM2/tools/lvmcmdline.c	2009/08/04 15:36:15	1.105
+++ LVM2/tools/lvmcmdline.c	2009/09/14 22:47:49	1.106
@@ -963,8 +963,10 @@
 	/* each command should start out with sigint flag cleared */
 	sigint_clear();
 
-	if (!(cmd->cmd_line = _copy_command_line(cmd, argc, argv)))
+	if (!(cmd->cmd_line = _copy_command_line(cmd, argc, argv))) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	log_debug("Parsing: %s", cmd->cmd_line);
 
--- LVM2/tools/lvremove.c	2009/07/01 17:00:52	1.58
+++ LVM2/tools/lvremove.c	2009/09/14 22:47:49	1.59
@@ -26,8 +26,10 @@
         if (lv_is_cow(lv) && lv_is_virtual_origin(origin = origin_from_cow(lv)))
                 lv = origin;
 
-	if (!lv_remove_with_dependencies(cmd, lv, arg_count(cmd, force_ARG)))
+	if (!lv_remove_with_dependencies(cmd, lv, arg_count(cmd, force_ARG))) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/lvrename.c	2009/07/07 01:18:35	1.55
+++ LVM2/tools/lvrename.c	2009/09/14 22:47:49	1.56
@@ -105,6 +105,7 @@
 	vg = vg_read_for_update(cmd, vg_name, NULL, 0);
 	if (vg_read_error(vg)) {
 		vg_release(vg);
+		stack;
 		return ECMD_FAILED;
 	}
 
--- LVM2/tools/polldaemon.c	2009/07/07 01:18:35	1.21
+++ LVM2/tools/polldaemon.c	2009/09/14 22:47:49	1.22
@@ -185,8 +185,10 @@
 	const char *name;
 	int finished;
 
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
 		lv_mirr = lvl->lv;
@@ -253,8 +255,10 @@
 	}
 
 	if (name) {
-		if (!_wait_for_single_mirror(cmd, name, uuid, &parms))
+		if (!_wait_for_single_mirror(cmd, name, uuid, &parms)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	} else
 		_poll_for_all_vgs(cmd, &parms);
 
--- LVM2/tools/pvchange.c	2009/07/08 18:15:51	1.72
+++ LVM2/tools/pvchange.c	2009/09/14 22:47:49	1.73
@@ -274,6 +274,7 @@
 	} else {
 		log_verbose("Scanning for physical volume names");
 		if (!(pvslist = get_pvs(cmd))) {
+			stack;
 			return ECMD_FAILED;
 		}
 
--- LVM2/tools/pvcreate.c	2009/07/30 17:45:30	1.84
+++ LVM2/tools/pvcreate.c	2009/09/14 22:47:49	1.85
@@ -195,8 +195,10 @@
 			return ECMD_FAILED;
 		}
 
-		if (!pvcreate_single(cmd, argv[i], &pp))
+		if (!pvcreate_single(cmd, argv[i], &pp)) {
+			stack;
 			ret = ECMD_FAILED;
+		}
 
 		unlock_vg(cmd, VG_ORPHANS);
 		if (sigint_caught())
--- LVM2/tools/pvresize.c	2009/07/15 05:50:22	1.32
+++ LVM2/tools/pvresize.c	2009/09/14 22:47:49	1.33
@@ -176,8 +176,10 @@
 
 	params->total++;
 
-	if (!_pv_resize_single(cmd, vg, pv, params->new_size))
+	if (!_pv_resize_single(cmd, vg, pv, params->new_size)) {
+		stack;
 		return ECMD_FAILED;
+	}
 	
 	params->done++;
 
--- LVM2/tools/pvscan.c	2008/11/03 22:14:30	1.47
+++ LVM2/tools/pvscan.c	2009/09/14 22:47:49	1.48
@@ -135,6 +135,7 @@
 	log_verbose("Walking through all physical volumes");
 	if (!(pvslist = get_pvs(cmd))) {
 		unlock_vg(cmd, VG_GLOBAL);
+		stack;
 		return ECMD_FAILED;
 	}
 
--- LVM2/tools/reporter.c	2009/07/15 05:50:22	1.54
+++ LVM2/tools/reporter.c	2009/09/14 22:47:49	1.55
@@ -20,11 +20,15 @@
 		       const char *vg_name, struct volume_group *vg,
 		       void *handle)
 {
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!report_object(handle, vg, NULL, NULL, NULL, NULL))
+	if (!report_object(handle, vg, NULL, NULL, NULL, NULL)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	check_current_backup(vg);
 
@@ -37,8 +41,10 @@
 	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
-	if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL))
+	if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
@@ -46,8 +52,10 @@
 static int _segs_single(struct cmd_context *cmd __attribute((unused)),
 			struct lv_segment *seg, void *handle)
 {
-	if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL))
+	if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
@@ -102,8 +110,10 @@
 	dm_list_init(&_free_logical_volume.snapshot_segs);
 
 	if (!report_object(handle, vg, seg ? seg->lv : &_free_logical_volume, pvseg->pv,
-			   seg ? : &_free_lv_segment, pvseg))
+			   seg ? : &_free_lv_segment, pvseg)) {
+		stack;
 		ret = ECMD_FAILED;
+	}
 
 	return ret;
 }
@@ -155,8 +165,10 @@
 		 pv = pvl->pv;
 	}
 
-	if (!report_object(handle, vg, NULL, pv, NULL, NULL))
+	if (!report_object(handle, vg, NULL, pv, NULL, NULL)) {
+		stack;
 		ret = ECMD_FAILED;
+	}
 
 out:
 	if (vg_name)
@@ -171,8 +183,10 @@
 static int _label_single(struct cmd_context *cmd, struct volume_group *vg,
 		       struct physical_volume *pv, void *handle)
 {
-	if (!report_object(handle, vg, NULL, pv, NULL, NULL))
+	if (!report_object(handle, vg, NULL, pv, NULL, NULL)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
@@ -181,8 +195,10 @@
 		      struct volume_group *vg,
 		      void *handle)
 {
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return process_each_pv_in_vg(cmd, vg, NULL, handle, &_pvs_single);
 }
@@ -191,8 +207,10 @@
 			 struct volume_group *vg,
 			 void *handle)
 {
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return process_each_pv_in_vg(cmd, vg, NULL, handle, &_pvsegs_single);
 }
--- LVM2/tools/toollib.c	2009/08/24 11:37:21	1.167
+++ LVM2/tools/toollib.c	2009/09/14 22:47:49	1.168
@@ -293,7 +293,8 @@
 			if (ret_max < ECMD_FAILED) {
 				log_error("Skipping volume group %s", vgname);
 				ret_max = ECMD_FAILED;
-			}
+			} else
+				stack;
 			continue;
 		}
 
@@ -431,9 +432,10 @@
 	log_verbose("Finding volume group \"%s\"", vg_name);
 
 	vg = vg_read(cmd, vg_name, vgid, flags);
-	if (vg_read_error(vg) == FAILED_ALLOCATION ||
-	    vg_read_error(vg) == FAILED_NOTFOUND) {
+	/* Allow FAILED_INCONSISTENT through only for vgcfgrestore */
+	if (vg_read_error(vg) && (vg_read_error(vg) != FAILED_INCONSISTENT)) {
 		vg_release(vg);
+		stack;
 		return ECMD_FAILED;
 	}
 
@@ -445,9 +447,8 @@
 	}
 
 	if ((ret = process_single(cmd, vg_name, vg,
-				  handle)) > ret_max) {
+				  handle)) > ret_max)
 		ret_max = ret;
-	}
 
 out:
 	unlock_and_release_vg(cmd, vg, vg_name);
@@ -728,6 +729,7 @@
 				if (vg_read_error(vg)) {
 					ret_max = ECMD_FAILED;
 					vg_release(vg);
+					stack;
 					continue;
 				}
 
--- LVM2/tools/vgcfgbackup.c	2009/07/15 03:30:04	1.29
+++ LVM2/tools/vgcfgbackup.c	2009/09/14 22:47:49	1.30
@@ -54,9 +54,6 @@
 	char **last_filename = (char **)handle;
 	char *filename;
 
-	if (vg_read_error(vg) && (vg_read_error(vg) != FAILED_INCONSISTENT))
-		return ECMD_FAILED;
-
 	if (arg_count(cmd, file_ARG)) {
 		if (!(filename = _expand_filename(arg_value(cmd, file_ARG),
 						  vg->name, last_filename))) {
@@ -64,8 +61,10 @@
 			return ECMD_FAILED;
 		}
 
-		if (!backup_to_file(filename, vg->cmd->cmd_line, vg))
+		if (!backup_to_file(filename, vg->cmd->cmd_line, vg)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	} else {
 		if (vg_read_error(vg) == FAILED_INCONSISTENT) {
 			log_error("No backup taken: specify filename with -f "
--- LVM2/tools/vgcfgrestore.c	2009/08/13 17:16:39	1.22
+++ LVM2/tools/vgcfgrestore.c	2009/09/14 22:47:50	1.23
@@ -36,10 +36,12 @@
 	 */
 	if (arg_count(cmd, list_ARG)) {
 		if (!(arg_count(cmd,file_ARG) ?
-			archive_display_file(cmd,
-					arg_str_value(cmd, file_ARG, "")) :
-			archive_display(cmd, vg_name)))
+			    archive_display_file(cmd,
+				arg_str_value(cmd, file_ARG, "")) :
+			    archive_display(cmd, vg_name))) {
+			stack;
 			return ECMD_FAILED;
+		}
 		return ECMD_PROCESSED;
 	}
 
--- LVM2/tools/vgchange.c	2009/09/14 19:44:16	1.83
+++ LVM2/tools/vgchange.c	2009/09/14 22:47:50	1.84
@@ -179,8 +179,10 @@
 
 	alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	/* FIXME: make consistent with vg_set_alloc_policy() */
 	if (alloc == vg->alloc) {
@@ -188,11 +190,15 @@
 			  get_alloc_string(vg->alloc));
 		return ECMD_FAILED;
 	}
-	if (!vg_set_alloc_policy(vg, alloc))
+	if (!vg_set_alloc_policy(vg, alloc)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -218,16 +224,20 @@
 		return ECMD_FAILED;
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (resizeable)
 		vg->status |= RESIZEABLE_VG;
 	else
 		vg->status &= ~RESIZEABLE_VG;
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -265,16 +275,20 @@
 		}
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (clustered)
 		vg->status |= CLUSTERED;
 	else
 		vg->status &= ~CLUSTERED;
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -288,14 +302,20 @@
 {
 	uint32_t max_lv = arg_uint_value(cmd, logicalvolume_ARG, 0);
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_set_max_lv(vg, max_lv))
+	if (!vg_set_max_lv(vg, max_lv)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -314,14 +334,20 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_set_max_pv(vg, max_pv))
+	if (!vg_set_max_pv(vg, max_pv)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -347,16 +373,20 @@
 		return ECMD_PROCESSED;
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (!vg_set_extent_size(vg, extent_size)) {
 		stack;
 		return EINVALID_CMD_LINE;
 	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -380,8 +410,10 @@
 		return ECMD_FAILED;
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if ((arg == addtag_ARG)) {
 		if (!str_list_add(cmd->mem, &vg->tags, tag)) {
@@ -397,8 +429,10 @@
 		}
 	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -417,8 +451,10 @@
 		return ECMD_FAILED;
 	}
 
-	if (!archive(vg))
+	if (!archive(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (!id_create(&vg->id)) {
 		log_error("Failed to generate new random UUID for VG %s.",
@@ -430,8 +466,10 @@
 		memcpy(&lvl->lv->lvid, &vg->id, sizeof(vg->id));
 	}
 
-	if (!vg_write(vg) || !vg_commit(vg))
+	if (!vg_write(vg) || !vg_commit(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	backup(vg);
 
@@ -444,8 +482,10 @@
 {
 	log_verbose("Refreshing volume group \"%s\"", vg->name);
 
-	if (!vg_refresh_visible(cmd, vg))
+	if (!vg_refresh_visible(cmd, vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
@@ -456,8 +496,10 @@
 {
 	int r = ECMD_FAILED;
 
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (vg_is_exported(vg)) {
 		log_error("Volume group \"%s\" is exported", vg_name);
--- LVM2/tools/vgck.c	2009/07/14 19:37:18	1.23
+++ LVM2/tools/vgck.c	2009/09/14 22:47:50	1.24
@@ -21,14 +21,20 @@
 		       struct volume_group *vg,
 		       void *handle __attribute((unused)))
 {
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_check_status(vg, EXPORTED_VG))
+	if (!vg_check_status(vg, EXPORTED_VG)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_validate(vg))
+	if (!vg_validate(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/vgconvert.c	2009/09/02 21:39:07	1.38
+++ LVM2/tools/vgconvert.c	2009/09/14 22:47:50	1.39
@@ -32,11 +32,15 @@
 	struct lvinfo info;
 	int active = 0;
 
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_check_status(vg, LVM_WRITE | EXPORTED_VG))
+	if (!vg_check_status(vg, LVM_WRITE | EXPORTED_VG)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	if (vg->fid->fmt == cmd->fmt) {
 		log_error("Volume group \"%s\" already uses format %s",
@@ -111,8 +115,10 @@
 		}
 	}
 
-	if (active)
+	if (active) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	dm_list_iterate_items(pvl, &vg->pvs) {
 		existing_pv = pvl->pv;
--- LVM2/tools/vgcreate.c	2009/07/24 15:01:44	1.65
+++ LVM2/tools/vgcreate.c	2009/09/14 22:47:50	1.66
@@ -102,14 +102,12 @@
 			clustered_message = "Non-clustered ";
 	}
 
-	if (!archive(vg)) {
-		goto bad;
-	}
+	if (!archive(vg))
+		goto_bad;
 
 	/* Store VG on disk(s) */
-	if (!vg_write(vg) || !vg_commit(vg)) {
-		goto bad;
-	}
+	if (!vg_write(vg) || !vg_commit(vg))
+		goto_bad;
 
 	unlock_vg(cmd, VG_ORPHANS);
 	unlock_vg(cmd, vp_new.vg_name);
--- LVM2/tools/vgdisplay.c	2009/07/01 17:00:52	1.24
+++ LVM2/tools/vgdisplay.c	2009/09/14 22:47:50	1.25
@@ -20,8 +20,10 @@
 			    void *handle __attribute((unused)))
 {
 	/* FIXME Do the active check here if activevolumegroups_ARG ? */
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	vg_check_status(vg, EXPORTED_VG);
 
--- LVM2/tools/vgexport.c	2009/07/01 17:00:52	1.21
+++ LVM2/tools/vgexport.c	2009/09/14 22:47:50	1.22
@@ -24,16 +24,16 @@
 	struct physical_volume *pv;
 
 	if (vg_read_error(vg))
-		goto error;
+		goto_bad;
 
 	if (lvs_in_vg_activated(vg)) {
 		log_error("Volume group \"%s\" has active logical volumes",
 			  vg_name);
-		goto error;
+		goto bad;
 	}
 
 	if (!archive(vg))
-		goto error;
+		goto_bad;
 
 	vg->status |= EXPORTED_VG;
 
@@ -43,7 +43,7 @@
 	}
 
 	if (!vg_write(vg) || !vg_commit(vg))
-		goto error;
+		goto_bad;
 
 	backup(vg);
 
@@ -51,7 +51,7 @@
 
 	return ECMD_PROCESSED;
 
-      error:
+bad:
 	return ECMD_FAILED;
 }
 
--- LVM2/tools/vgextend.c	2009/08/13 12:03:46	1.49
+++ LVM2/tools/vgextend.c	2009/09/14 22:47:50	1.50
@@ -40,6 +40,7 @@
 	vg = vg_read_for_update(cmd, vg_name, NULL, 0);
 	if (vg_read_error(vg)) {
 		vg_release(vg);
+		stack;
 		return ECMD_FAILED;
 	}
 
@@ -50,11 +51,11 @@
 	}
 
 	if (!archive(vg))
-		goto error;
+		goto_bad;
 
 	/* extend vg */
 	if (!vg_extend(vg, argc, argv))
-		goto error;
+		goto_bad;
 
 	/* ret > 0 */
 	log_verbose("Volume group \"%s\" will be extended by %d new "
@@ -62,13 +63,13 @@
 
 	/* store vg on disk(s) */
 	if (!vg_write(vg) || !vg_commit(vg))
-		goto error;
+		goto_bad;
 
 	backup(vg);
 	log_print("Volume group \"%s\" successfully extended", vg_name);
 	r = ECMD_PROCESSED;
 
-error:
+bad:
 	unlock_vg(cmd, VG_ORPHANS);
 	unlock_and_release_vg(cmd, vg, vg_name);
 	return r;
--- LVM2/tools/vgimport.c	2009/09/14 19:44:16	1.21
+++ LVM2/tools/vgimport.c	2009/09/14 22:47:50	1.22
@@ -24,20 +24,20 @@
 	struct physical_volume *pv;
 
 	if (vg_read_error(vg))
-		goto error;
+		goto_bad;
 
 	if (!vg_is_exported(vg)) {
 		log_error("Volume group \"%s\" is not exported", vg_name);
-		goto error;
+		goto bad;
 	}
 
 	if (vg_status(vg) & PARTIAL_VG) {
 		log_error("Volume group \"%s\" is partially missing", vg_name);
-		goto error;
+		goto bad;
 	}
 
 	if (!archive(vg))
-		goto error;
+		goto_bad;
 
 	vg->status &= ~EXPORTED_VG;
 
@@ -47,7 +47,7 @@
 	}
 
 	if (!vg_write(vg) || !vg_commit(vg))
-		goto error;
+		goto_bad;
 
 	backup(vg);
 
@@ -55,7 +55,7 @@
 
 	return ECMD_PROCESSED;
 
-      error:
+bad:
 	return ECMD_FAILED;
 }
 
--- LVM2/tools/vgmerge.c	2009/09/02 21:28:43	1.64
+++ LVM2/tools/vgmerge.c	2009/09/14 22:47:50	1.65
@@ -46,20 +46,26 @@
 
 	if (lock_vg_from_first) {
 		vg_from = _vgmerge_vg_read(cmd, vg_name_from);
-		if (!vg_from)
+		if (!vg_from) {
+			stack;
 			return ECMD_FAILED;
+		}
 		vg_to = _vgmerge_vg_read(cmd, vg_name_to);
 		if (!vg_to) {
+			stack;
 			unlock_and_release_vg(cmd, vg_from, vg_name_from);
 			return ECMD_FAILED;
 		}
 	} else {
 		vg_to = _vgmerge_vg_read(cmd, vg_name_to);
-		if (!vg_to)
+		if (!vg_to) {
+			stack;
 			return ECMD_FAILED;
+		}
 
 		vg_from = _vgmerge_vg_read(cmd, vg_name_from);
 		if (!vg_from) {
+			stack;
 			unlock_and_release_vg(cmd, vg_to, vg_name_to);
 			return ECMD_FAILED;
 		}
--- LVM2/tools/vgmknodes.c	2008/12/22 09:00:51	1.7
+++ LVM2/tools/vgmknodes.c	2009/09/14 22:47:50	1.8
@@ -19,19 +19,25 @@
 			     void *handle __attribute((unused)))
 {
 	if (arg_count(cmd, refresh_ARG) && lv_is_visible(lv))
-		if (!lv_refresh(cmd, lv))
+		if (!lv_refresh(cmd, lv)) {
+			stack;
 			return ECMD_FAILED;
+		}
 
-	if (!lv_mknodes(cmd, lv))
+	if (!lv_mknodes(cmd, lv)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
 
 int vgmknodes(struct cmd_context *cmd, int argc, char **argv)
 {
-	if (!lv_mknodes(cmd, NULL))
+	if (!lv_mknodes(cmd, NULL)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL,
 			    &_vgmknodes_single);
--- LVM2/tools/vgreduce.c	2009/07/24 11:13:36	1.97
+++ LVM2/tools/vgreduce.c	2009/09/14 22:47:50	1.98
@@ -404,7 +404,7 @@
 	pvl = find_pv_in_vg(vg, name);
 
 	if (!archive(vg))
-		goto bad;
+		goto_bad;
 
 	log_verbose("Removing \"%s\" from volume group \"%s\"", name, vg->name);
 
@@ -512,12 +512,12 @@
 	vg = vg_read_for_update(cmd, vg_name, NULL, READ_ALLOW_EXPORTED);
 	if (vg_read_error(vg) == FAILED_ALLOCATION ||
 	    vg_read_error(vg) == FAILED_NOTFOUND)
-		goto out;
+		goto_out;
 
 	/* FIXME We want to allow read-only VGs to be changed here? */
 	if (vg_read_error(vg) && vg_read_error(vg) != FAILED_READ_ONLY
 	    && !arg_count(cmd, removemissing_ARG))
-		goto out;
+		goto_out;
 
 	if (repairing) {
 		if (!vg_read_error(vg) && !vg_missing_pv_count(vg)) {
@@ -536,14 +536,14 @@
 
 		if (vg_read_error(vg) && vg_read_error(vg) != FAILED_READ_ONLY
 		    && vg_read_error(vg) != FAILED_INCONSISTENT)
-			goto out;
+			goto_out;
 
 		if (!archive(vg))
-			goto out;
+			goto_out;
 
 		if (arg_count(cmd, force_ARG)) {
 			if (!_make_vg_consistent(cmd, vg))
-				goto out;
+				goto_out;
 		} else
 			fixed = _consolidate_vg(cmd, vg);
 
@@ -563,7 +563,7 @@
 
 	} else {
 		if (!vg_check_status(vg, EXPORTED_VG | LVM_WRITE | RESIZEABLE_VG))
-			goto out;
+			goto_out;
 
 		/* FIXME: Pass private struct through to all these functions */
 		/* and update in batch here? */
--- LVM2/tools/vgremove.c	2009/09/02 21:39:29	1.55
+++ LVM2/tools/vgremove.c	2009/09/14 22:47:50	1.56
@@ -22,11 +22,15 @@
 	unsigned lv_count;
 	force_t force;
 
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_check_status(vg, EXPORTED_VG))
+	if (!vg_check_status(vg, EXPORTED_VG)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	lv_count = vg_visible_lvs(vg);
 
@@ -40,15 +44,21 @@
 			log_print("Volume group \"%s\" not removed", vg_name);
 			return ECMD_FAILED;
 		}
-		if (!remove_lvs_in_vg(cmd, vg, force))
+		if (!remove_lvs_in_vg(cmd, vg, force)) {
+			stack;
 			return ECMD_FAILED;
+		}
 	}
 
-	if (!vg_remove_check(vg))
+	if (!vg_remove_check(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
-	if (!vg_remove(vg))
+	if (!vg_remove(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/vgrename.c	2009/09/02 21:29:40	1.67
+++ LVM2/tools/vgrename.c	2009/09/14 22:47:50	1.68
@@ -206,8 +206,10 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	if (!vg_rename_path(cmd, argv[0], argv[1]))
+	if (!vg_rename_path(cmd, argv[0], argv[1])) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	return ECMD_PROCESSED;
 }
--- LVM2/tools/vgscan.c	2009/09/14 19:44:16	1.35
+++ LVM2/tools/vgscan.c	2009/09/14 22:47:50	1.36
@@ -19,8 +19,10 @@
 			 struct volume_group *vg,
 			 void *handle __attribute((unused)))
 {
-	if (vg_read_error(vg))
+	if (vg_read_error(vg)) {
+		stack;
 		return ECMD_FAILED;
+	}
 
 	log_print("Found %svolume group \"%s\" using metadata type %s",
 		  vg_is_exported(vg) ? "exported " : "", vg_name,
--- LVM2/tools/vgsplit.c	2009/09/02 21:27:39	1.93
+++ LVM2/tools/vgsplit.c	2009/09/14 22:47:50	1.94
@@ -319,8 +319,10 @@
 
 	if (lock_vg_from_first) {
 		vg_from = _vgsplit_from(cmd, vg_name_from);
-		if (!vg_from)
+		if (!vg_from) {
+			stack;
 			return ECMD_FAILED;
+		}
 		/*
 		 * Set metadata format of original VG.
 		 * NOTE: We must set the format before calling vg_create()
@@ -331,15 +333,19 @@
 		vg_to = _vgsplit_to(cmd, vg_name_to, &existing_vg);
 		if (!vg_to) {
 			unlock_and_release_vg(cmd, vg_from, vg_name_from);
+			stack;
 			return ECMD_FAILED;
 		}
 	} else {
 		vg_to = _vgsplit_to(cmd, vg_name_to, &existing_vg);
-		if (!vg_to)
+		if (!vg_to) {
+			stack;
 			return ECMD_FAILED;
+		}
 		vg_from = _vgsplit_from(cmd, vg_name_from);
 		if (!vg_from) {
 			unlock_and_release_vg(cmd, vg_to, vg_name_to);
+			stack;
 			return ECMD_FAILED;
 		}
 
@@ -355,7 +361,7 @@
 		if (new_vg_option_specified(cmd)) {
 			log_error("Volume group \"%s\" exists, but new VG "
 				    "option specified", vg_name_to);
-			goto_bad;
+			goto bad;
 		}
 		if (!vgs_are_compatible(cmd, vg_from,vg_to))
 			goto_bad;
@@ -369,12 +375,12 @@
 
 		if (fill_vg_create_params(cmd, vg_name_to, &vp_new, &vp_def)) {
 			r = EINVALID_CMD_LINE;
-			goto bad;
+			goto_bad;
 		}
 
 		if (validate_vg_create_params(cmd, &vp_new)) {
 			r = EINVALID_CMD_LINE;
-			goto bad;
+			goto_bad;
 		}
 
 		if (!vg_set_extent_size(vg_to, vp_new.extent_size) ||
@@ -416,7 +422,7 @@
 	/* Split metadata areas and check if both vgs have at least one area */
 	if (!(vg_split_mdas(cmd, vg_from, vg_to)) && vg_from->pv_count) {
 		log_error("Cannot split: Nowhere to store metadata for new Volume Group");
-		goto_bad;
+		goto bad;
 	}
 
 	/* Set proper name for all PVs in new VG */
@@ -465,7 +471,7 @@
 		if (vg_read_error(vg_to)) {
 			log_error("Volume group \"%s\" became inconsistent: "
 				  "please fix manually", vg_name_to);
-			goto_bad;
+			goto bad;
 		}
 	}
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2011-09-27 17:09 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2011-09-27 17:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-09-27 17:09:44

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c locking.h 
	lib/metadata   : lv_manip.c metadata-exported.h metadata.c 
	tools          : pvmove.c 

Log message:
	Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
	Change suspend_lvs to call vg_revert internally.
	Change vg_revert to void and remove superfluous calls after failed vg_commit.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2140&r2=1.2141
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.290&r2=1.291
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.211&r2=1.212
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.467&r2=1.468
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88

--- LVM2/WHATS_NEW	2011/09/26 07:51:23	1.2140
+++ LVM2/WHATS_NEW	2011/09/27 17:09:42	1.2141
@@ -1,5 +1,8 @@
 Version 2.02.89 - 
 ==================================
+  Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
+  Change suspend_lvs to call vg_revert internally.
+  Change vg_revert to void and remove superfluous calls after failed vg_commit.
   Use execvp for CLVMD restart to preserve environment settings.
   Restart CLVMD with same cluster manager.
   Fix log_error() usage in raid and unknown segtype initialisation.
--- LVM2/lib/locking/locking.c	2011/08/11 15:27:46	1.98
+++ LVM2/lib/locking/locking.c	2011/09/27 17:09:43	1.99
@@ -493,8 +493,13 @@
 	return r;
 }
 
-/* Lock a list of LVs */
-int suspend_lvs(struct cmd_context *cmd, struct dm_list *lvs)
+/*
+ * Lock a list of LVs.
+ * On failure to lock any LV, calls vg_revert() if vg_to_revert is set and 
+ * then unlocks any LVs on the list already successfully locked.
+ */
+int suspend_lvs(struct cmd_context *cmd, struct dm_list *lvs,
+		struct volume_group *vg_to_revert)
 {
 	struct dm_list *lvh;
 	struct lv_list *lvl;
@@ -502,6 +507,8 @@
 	dm_list_iterate_items(lvl, lvs) {
 		if (!suspend_lv(cmd, lvl->lv)) {
 			log_error("Failed to suspend %s", lvl->lv->name);
+			if (vg_to_revert)
+				vg_revert(vg_to_revert);
 			dm_list_uniterate(lvh, lvs, &lvl->list) {
 				lvl = dm_list_item(lvh, struct lv_list);
 				if (!resume_lv(cmd, lvl->lv))
--- LVM2/lib/locking/locking.h	2011/08/10 20:25:30	1.67
+++ LVM2/lib/locking/locking.h	2011/09/27 17:09:43	1.68
@@ -187,7 +187,9 @@
 int sync_dev_names(struct cmd_context* cmd);
 
 /* Process list of LVs */
-int suspend_lvs(struct cmd_context *cmd, struct dm_list *lvs);
+struct volume_group;
+int suspend_lvs(struct cmd_context *cmd, struct dm_list *lvs,
+		struct volume_group *vg_to_revert);
 int resume_lvs(struct cmd_context *cmd, struct dm_list *lvs);
 int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive);
 
--- LVM2/lib/metadata/lv_manip.c	2011/09/22 17:33:51	1.290
+++ LVM2/lib/metadata/lv_manip.c	2011/09/27 17:09:43	1.291
@@ -2793,11 +2793,8 @@
 	if (!vg_write(vg))
 		return 0;
 
-
-	if (!suspend_lvs(cmd, &lvs_changed)) {
-		vg_revert(vg);
+	if (!suspend_lvs(cmd, &lvs_changed, vg))
 		goto_out;
-	}
 
 	if (!(r = vg_commit(vg)))
 		stack;
--- LVM2/lib/metadata/metadata-exported.h	2011/09/14 09:57:35	1.211
+++ LVM2/lib/metadata/metadata-exported.h	2011/09/27 17:09:43	1.212
@@ -400,7 +400,7 @@
 */
 int vg_write(struct volume_group *vg);
 int vg_commit(struct volume_group *vg);
-int vg_revert(struct volume_group *vg);
+void vg_revert(struct volume_group *vg);
 struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
 				      const char *vgid, int warnings, int *consistent);
 struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
--- LVM2/lib/metadata/metadata.c	2011/09/07 08:34:22	1.467
+++ LVM2/lib/metadata/metadata.c	2011/09/27 17:09:43	1.468
@@ -2685,7 +2685,7 @@
 }
 
 /* Don't commit any pending changes */
-int vg_revert(struct volume_group *vg)
+void vg_revert(struct volume_group *vg)
 {
 	struct metadata_area *mda;
 
@@ -2701,8 +2701,6 @@
 			  "after reverted update for VG %s.", vg->name);
 
 	remote_revert_cached_metadata(vg);
-
-	return 1;
 }
 
 /* Make orphan PVs look like a VG */
--- LVM2/tools/pvmove.c	2011/09/21 16:36:39	1.87
+++ LVM2/tools/pvmove.c	2011/09/27 17:09:43	1.88
@@ -307,17 +307,21 @@
 
 static int _suspend_lvs(struct cmd_context *cmd, unsigned first_time,
 			struct logical_volume *lv_mirr,
-			struct dm_list *lvs_changed)
+			struct dm_list *lvs_changed,
+			struct volume_group *vg_to_revert)
 {
 	/*
 	 * Suspend lvs_changed the first time.
 	 * Suspend mirrors on subsequent calls.
 	 */
 	if (first_time) {
-		if (!suspend_lvs(cmd, lvs_changed))
+		if (!suspend_lvs(cmd, lvs_changed, vg_to_revert))
 			return_0;
-	} else if (!suspend_lv(cmd, lv_mirr))
+	} else if (!suspend_lv(cmd, lv_mirr)) {
+		if (vg_to_revert)
+			vg_revert(vg_to_revert);
 		return_0;
+	}
 
 	return 1;
 }
@@ -364,16 +368,14 @@
 		return 0;
 	}
 
-	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed)) {
-		/* FIXME vg_revert must be moved *before* any LV resumes */
-		vg_revert(vg);
-		goto_out;
+	if (!_suspend_lvs(cmd, first_time, lv_mirr, lvs_changed, vg)) {
+		log_error("ABORTING: Volume group metadata update failed.");
+		goto out;
 	}
 
 	/* Commit on-disk metadata */
 	if (!vg_commit(vg)) {
 		log_error("ABORTING: Volume group metadata update failed.");
-		vg_revert(vg);
 		goto out;
 	}
 
@@ -555,16 +557,15 @@
 	}
 
 	/* Suspend LVs changed (implicitly suspends lv_mirr) */
-	if (!suspend_lvs(cmd, lvs_changed)) {
-		log_error("Locking LVs to remove temporary mirror failed");
-		r = 0;
+	if (!suspend_lvs(cmd, lvs_changed, vg)) {
+		log_error("ABORTING: Locking LVs to remove temporary mirror failed");
+		return 0;
 	}
 
 	/* Store metadata without dependencies on mirror segments */
 	if (!vg_commit(vg)) {
 		log_error("ABORTING: Failed to write new data locations "
 			  "to disk.");
-		vg_revert(vg);
 		if (!resume_lv(cmd, lv_mirr))
 			stack;
 		if (!resume_lvs(cmd, lvs_changed))


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2010-05-06 11:15 prajnoha
  0 siblings, 0 replies; 7+ messages in thread
From: prajnoha @ 2010-05-06 11:15 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-05-06 11:15:56

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c locking.h 
	liblvm         : lvm_base.c 
	man            : lvchange.8.in vgchange.8.in 
	tools          : args.h commands.h lvchange.c lvmcmdline.c 
	                 toollib.c vgchange.c 

Log message:
	Add new --sysinit option for vgchange and lvchange.
	
	A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options
	and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at
	once in initialisation scripts (e.g. rc.sysinit or initrd).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1548&r2=1.1549
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.53&r2=1.54
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_base.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvchange.8.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgchange.8.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.73&r2=1.74
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.196&r2=1.197
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102

--- LVM2/WHATS_NEW	2010/05/06 10:10:15	1.1548
+++ LVM2/WHATS_NEW	2010/05/06 11:15:55	1.1549
@@ -1,5 +1,6 @@
 Version 2.02.65 - 
 =================================
+  Add new --sysinit option for vgchange and lvchange.
   Suppress duplicate error messages about read failures and missing devices.
   Install plugins to $(libdir)/device-mapper and $(libdir)/lvm2.
   Add dm_list_splice() function to join two lists together.
--- LVM2/lib/locking/locking.c	2010/04/13 01:54:33	1.79
+++ LVM2/lib/locking/locking.c	2010/05/06 11:15:55	1.80
@@ -217,10 +217,8 @@
  * Select a locking type
  * type: locking type; if < 0, then read config tree value
  */
-int init_locking(int type, struct cmd_context *cmd)
+int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
 {
-	int suppress_messages = 0;
-
 	if (ignorelockingfailure() && getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES"))
 		suppress_messages = 1;
 
--- LVM2/lib/locking/locking.h	2010/01/05 16:09:34	1.53
+++ LVM2/lib/locking/locking.h	2010/05/06 11:15:55	1.54
@@ -19,7 +19,7 @@
 #include "uuid.h"
 #include "config.h"
 
-int init_locking(int type, struct cmd_context *cmd);
+int init_locking(int type, struct cmd_context *cmd, int suppress_messages);
 void fin_locking(void);
 void reset_locking(void);
 int vg_write_lock_held(void);
--- LVM2/liblvm/lvm_base.c	2010/03/17 14:45:28	1.15
+++ LVM2/liblvm/lvm_base.c	2010/05/06 11:15:55	1.16
@@ -50,7 +50,7 @@
 
 	/* FIXME: locking_type config option needed? */
 	/* initialize locking */
-	if (!init_locking(-1, cmd)) {
+	if (!init_locking(-1, cmd, 0)) {
 		/* FIXME: use EAGAIN as error code here */
 		lvm_quit((lvm_t) cmd);
 		return NULL;
--- LVM2/man/lvchange.8.in	2010/03/23 22:30:20	1.7
+++ LVM2/man/lvchange.8.in	2010/05/06 11:15:55	1.8
@@ -13,6 +13,7 @@
 [\-\-ignoremonitoring]
 [\-\-monitor {y|n}]
 [\-\-poll {y|n}]
+[\-\-sysinit]
 [\-\-noudevsync]
 [\-M|\-\-persistent y|n] [\-\-minor minor]
 [\-P|\-\-partial]
@@ -71,6 +72,15 @@
 immediately poll a logical volume when it is activated, use \fB--poll
 n\fP to defer and then \fB--poll y\fP to restart the process.
 .TP
+.I \-\-sysinit
+Indicates that lvchange(8) is being invoked from early system initialisation
+scripts (e.g. rc.sysinit or an initrd), before writeable filesystems are
+available. As such, some functionality needs to be disabled and this option
+acts as a shortcut which selects an appropriate set of options. Currently
+this is equivalent to using  \fB--ignorelockingfailure\fP, \fB--ignoremonitoring\fP,
+\fB--poll n\fP and setting \fBLVM_SUPPRESS_LOCKING_FAILURE_MESSAGES\fP
+environment variable.
+.TP
 .I \-\-noudevsync
 Disable udev synchronisation. The
 process will not wait for notification from udev.
--- LVM2/man/vgchange.8.in	2010/03/23 22:30:20	1.8
+++ LVM2/man/vgchange.8.in	2010/05/06 11:15:55	1.9
@@ -19,6 +19,7 @@
 .RB [ \-h | \-\-help]
 .RB [ \-\-ignorelockingfailure]
 .RB [ \-\-ignoremonitoring]
+.RB [ \-\-sysinit]
 .RB [ \-\-noudevsync ]
 .RB [ \-l | \-\-logicalvolume
 .IR MaxLogicalVolumes ]
@@ -96,6 +97,15 @@
 immediately poll a logical volume when it is activated, use \fB--poll
 n\fP to defer and then \fB--poll y\fP to restart the process.
 .TP
+.BR \-\-sysinit
+Indicates that vgchange(8) is being invoked from early system initialisation
+scripts (e.g. rc.sysinit or an initrd), before writeable filesystems are
+available. As such, some functionality needs to be disabled and this option
+acts as a shortcut which selects an appropriate set of options. Currently
+this is equivalent to using  \fB--ignorelockingfailure\fP, \fB--ignoremonitoring\fP,
+\fB--poll n\fP and setting \fBLVM_SUPPRESS_LOCKING_FAILURE_MESSAGES\fP
+environment variable.
+.TP
 .BR \-\-noudevsync
 Disable udev synchronisation. The
 process will not wait for notification from udev.
--- LVM2/tools/args.h	2010/04/13 01:54:33	1.73
+++ LVM2/tools/args.h	2010/05/06 11:15:55	1.74
@@ -66,6 +66,7 @@
 arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0)
 arg(poll_ARG, '\0', "poll", yes_no_arg, 0)
 arg(stripes_long_ARG, '\0', "stripes", int_arg, 0)
+arg(sysinit_ARG, '\0', "sysinit", NULL, 0)
 
 /* Allow some variations */
 arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
--- LVM2/tools/commands.h	2010/04/20 18:17:56	1.145
+++ LVM2/tools/commands.h	2010/05/06 11:15:55	1.146
@@ -80,6 +80,7 @@
    "\t[-r|--readahead ReadAheadSectors|auto|none]\n"
    "\t[--refresh]\n"
    "\t[--resync]\n"
+   "\t[--sysinit]\n"
    "\t[-t|--test]\n"
    "\t[-v|--verbose]\n"
    "\t[-y|--yes]\n"
@@ -90,7 +91,7 @@
    ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
    monitor_ARG, noudevsync_ARG, partial_ARG, permission_ARG, persistent_ARG,
    poll_ARG, readahead_ARG, resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG,
-   test_ARG, yes_ARG)
+   sysinit_ARG, test_ARG, yes_ARG)
 
 xx(lvconvert,
    "Change logical volume layout",
@@ -711,6 +712,7 @@
    "\t[--poll {y|n}]\n"
    "\t[--noudevsync]\n"
    "\t[--refresh]\n"
+   "\t[--sysinit]\n"
    "\t[-t|--test]" "\n"
    "\t[-u|--uuid] " "\n"
    "\t[-v|--verbose] " "\n"
@@ -729,7 +731,7 @@
    clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG,
    logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, noudevsync_ARG,
    partial_ARG, physicalextentsize_ARG, poll_ARG, refresh_ARG, resizeable_ARG,
-   resizable_ARG, test_ARG, uuid_ARG)
+   resizable_ARG, sysinit_ARG, test_ARG, uuid_ARG)
 
 xx(vgck,
    "Check the consistency of volume group(s)",
--- LVM2/tools/lvchange.c	2010/03/29 16:09:41	1.119
+++ LVM2/tools/lvchange.c	2010/05/06 11:15:56	1.120
@@ -586,9 +586,12 @@
 	 * should only be started if the LV is not already active. So:
 	 * 1) change the activation code to say if the LV was actually activated
 	 * 2) make polling of an LV tightly coupled with LV activation
+	 *
+	 * Do not initiate any polling if --sysinit option is used.
 	 */
-	init_background_polling(arg_int_value(cmd, poll_ARG,
-					      DEFAULT_BACKGROUND_POLLING));
+	init_background_polling(arg_count(cmd, sysinit_ARG) ? 0 :
+						arg_int_value(cmd, poll_ARG,
+						DEFAULT_BACKGROUND_POLLING));
 
 	/* access permission change */
 	if (arg_count(cmd, permission_ARG)) {
@@ -730,8 +733,9 @@
 	     arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
 	     arg_count(cmd, resync_ARG) || arg_count(cmd, alloc_ARG));
 
-	if (arg_count(cmd, ignorelockingfailure_ARG) && !avail_only) {
-		log_error("Only -a permitted with --ignorelockingfailure");
+	if ((arg_count(cmd, ignorelockingfailure_ARG) ||
+	     arg_count(cmd, sysinit_ARG)) && !avail_only) {
+		log_error("Only -a permitted with --ignorelockingfailure and --sysinit");
 		return EINVALID_CMD_LINE;
 	}
 
@@ -759,6 +763,11 @@
 		return EINVALID_CMD_LINE;
 	}
 
+	if (arg_count(cmd, poll_ARG) && arg_count(cmd, sysinit_ARG)) {
+		log_error("Only one of --poll and --sysinit permitted");
+		return EINVALID_CMD_LINE;
+	}
+
 	return process_each_lv(cmd, argc, argv,
 			       avail_only ? 0 : READ_FOR_UPDATE, NULL,
 			       &lvchange_single);
--- LVM2/tools/lvmcmdline.c	2010/05/05 22:37:53	1.121
+++ LVM2/tools/lvmcmdline.c	2010/05/06 11:15:56	1.122
@@ -793,7 +793,7 @@
 			  "be activated read-only.");
 	}
 
-	if (arg_count(cmd, ignorelockingfailure_ARG))
+	if (arg_count(cmd, ignorelockingfailure_ARG) || arg_count(cmd, sysinit_ARG))
 		init_ignorelockingfailure(1);
 	else
 		init_ignorelockingfailure(0);
@@ -1049,7 +1049,7 @@
 	else
 		locking_type = -1;
 
-	if (!init_locking(locking_type, cmd)) {
+	if (!init_locking(locking_type, cmd, arg_count(cmd, sysinit_ARG))) {
 		ret = ECMD_FAILED;
 		goto out;
 	}
--- LVM2/tools/toollib.c	2010/04/28 12:23:11	1.196
+++ LVM2/tools/toollib.c	2010/05/06 11:15:56	1.197
@@ -1372,8 +1372,9 @@
 	*monitoring_mode = DEFAULT_DMEVENTD_MONITOR;
 
 	if (arg_count(cmd, monitor_ARG) &&
-	    arg_count(cmd, ignoremonitoring_ARG)) {
-		log_error("Conflicting monitor and ignoremonitoring options");
+	    (arg_count(cmd, ignoremonitoring_ARG) ||
+	     arg_count(cmd, sysinit_ARG))) {
+		log_error("--ignoremonitoring or --sysinit option not allowed with --monitor option");
 		return 0;
 	}
 
@@ -1381,6 +1382,7 @@
 		*monitoring_mode = arg_int_value(cmd, monitor_ARG,
 						 DEFAULT_DMEVENTD_MONITOR);
 	else if (is_static() || arg_count(cmd, ignoremonitoring_ARG) ||
+		 arg_count(cmd, sysinit_ARG) ||
 		 !find_config_tree_bool(cmd, "activation/monitoring",
 					DEFAULT_DMEVENTD_MONITOR))
 		*monitoring_mode = DMEVENTD_MONITOR_IGNORE;
--- LVM2/tools/vgchange.c	2010/03/29 16:09:41	1.101
+++ LVM2/tools/vgchange.c	2010/05/06 11:15:56	1.102
@@ -540,9 +540,12 @@
 	 * should only be started if the LV is not already active. So:
 	 * 1) change the activation code to say if the LV was actually activated
 	 * 2) make polling of an LV tightly coupled with LV activation
+	 *
+	 * Do not initiate any polling if --sysinit option is used.
 	 */
-	init_background_polling(arg_int_value(cmd, poll_ARG,
-					      DEFAULT_BACKGROUND_POLLING));
+	init_background_polling(arg_count(cmd, sysinit_ARG) ? 0 :
+						arg_int_value(cmd, poll_ARG,
+						DEFAULT_BACKGROUND_POLLING));
 
 	if (arg_count(cmd, available_ARG))
 		r = _vgchange_available(cmd, vg);
@@ -615,9 +618,14 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	if (arg_count(cmd, ignorelockingfailure_ARG) &&
-	    !arg_count(cmd, available_ARG)) {
-		log_error("--ignorelockingfailure only available with -a");
+	if ((arg_count(cmd, ignorelockingfailure_ARG) ||
+	     arg_count(cmd, sysinit_ARG)) && !arg_count(cmd, available_ARG)) {
+		log_error("Only -a premitted with --ignorelockingfailure and --sysinit");
+		return EINVALID_CMD_LINE;
+	}
+
+	if (arg_count(cmd, poll_ARG) && arg_count(cmd, sysinit_ARG)) {
+		log_error("Only one of --poll and --sysinit permitted.");
 		return EINVALID_CMD_LINE;
 	}
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2010-01-22  9:45 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2010-01-22  9:45 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-01-22 09:45:30

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c no_locking.c 
	liblvm         : lvm_base.c 
	tools          : lvmcmdline.c 

Log message:
	Move error message to locking constructor and print
	more descriptive message if locking fails instead of
	"Locking type -1 initialisation failed."
	
	Use read-only locking instead of misleading ignorelocking option
	in message.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1401&r2=1.1402
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/no_locking.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_base.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.112&r2=1.113

--- LVM2/WHATS_NEW	2010/01/22 01:09:09	1.1401
+++ LVM2/WHATS_NEW	2010/01/22 09:45:29	1.1402
@@ -1,5 +1,6 @@
 Version 2.02.60
 ===================================
+  Fix failed locking messages to be more descriptive.
 
 Version 2.02.59 - 21st January 2010
 ===================================
--- LVM2/lib/locking/locking.c	2010/01/13 17:40:17	1.72
+++ LVM2/lib/locking/locking.c	2010/01/22 09:45:29	1.73
@@ -224,7 +224,7 @@
 
 	_blocking_supported = find_config_tree_int(cmd,
 	    "global/wait_for_locks", DEFAULT_WAIT_FOR_LOCKS);
-	
+
 	switch (type) {
 	case 0:
 		init_no_locking(&_locking, cmd);
@@ -236,8 +236,10 @@
 		log_very_verbose("%sFile-based locking selected.",
 				 _blocking_supported ? "" : "Non-blocking ");
 
-		if (!init_file_locking(&_locking, cmd))
+		if (!init_file_locking(&_locking, cmd)) {
+			log_error("File-based locking initialisation failed.");
 			break;
+		}
 		return 1;
 
 #ifdef HAVE_LIBDL
@@ -249,8 +251,10 @@
 		}
 		if (!find_config_tree_int(cmd, "locking/fallback_to_clustered_locking",
 			    find_config_tree_int(cmd, "global/fallback_to_clustered_locking",
-						 DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING)))
+						 DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING))) {
+			log_error("External locking initialisation failed.");
 			break;
+		}
 #endif
 
 #ifdef CLUSTER_LOCKING_INTERNAL
@@ -259,8 +263,10 @@
 
 	case 3:
 		log_very_verbose("Cluster locking selected.");
-		if (!init_cluster_locking(&_locking, cmd))
+		if (!init_cluster_locking(&_locking, cmd)) {
+			log_error("Internal cluster locking initialisation failed.");
 			break;
+		}
 		return 1;
 #endif
 
@@ -285,6 +291,8 @@
 			  "be inaccessible.");
 		if (init_file_locking(&_locking, cmd))
 			return 1;
+		else
+			log_error("File-based locking initialisation failed.");
 	}
 
 	if (!ignorelockingfailure())
--- LVM2/lib/locking/no_locking.c	2009/12/11 13:16:38	1.20
+++ LVM2/lib/locking/no_locking.c	2010/01/22 09:45:29	1.21
@@ -72,7 +72,7 @@
 	    (flags & LCK_SCOPE_MASK) == LCK_VG &&
 	    !(flags & LCK_CACHE) &&
 	    strcmp(resource, VG_GLOBAL)) {
-		log_error("Write locks are prohibited with --ignorelockingfailure.");
+		log_error("Write locks are prohibited with read-only locking.");
 		return 0;
 	}
 
--- LVM2/liblvm/lvm_base.c	2009/07/29 18:38:27	1.13
+++ LVM2/liblvm/lvm_base.c	2010/01/22 09:45:29	1.14
@@ -51,7 +51,6 @@
 	/* initialize locking */
 	if (!init_locking(-1, cmd)) {
 		/* FIXME: use EAGAIN as error code here */
-		log_error("Locking initialisation failed.");
 		lvm_quit((lvm_t) cmd);
 		return NULL;
 	}
--- LVM2/tools/lvmcmdline.c	2010/01/21 13:41:39	1.112
+++ LVM2/tools/lvmcmdline.c	2010/01/22 09:45:29	1.113
@@ -1027,8 +1027,6 @@
 		locking_type = -1;
 
 	if (!init_locking(locking_type, cmd)) {
-		log_error("Locking type %d initialisation failed.",
-			  locking_type);
 		ret = ECMD_FAILED;
 		goto out;
 	}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2008-04-09 12:56 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2008-04-09 12:56 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-04-09 12:56:34

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c locking.h 
	tools          : lvconvert.c polldaemon.h pvmove.c 

Log message:
	Use clustered mirror log with pvmove in clustered VGs, if available.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.836&r2=1.837
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52

--- LVM2/WHATS_NEW	2008/04/09 12:45:32	1.836
+++ LVM2/WHATS_NEW	2008/04/09 12:56:34	1.837
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Use clustered mirror log with pvmove in clustered VGs, if available.
   Fix some pvmove error status codes.
   Fix vgsplit error paths to release vg_to lock.
   Indicate whether or not VG is clustered in vgcreate log message.
--- LVM2/lib/locking/locking.c	2008/04/07 19:17:29	1.45
+++ LVM2/lib/locking/locking.c	2008/04/09 12:56:34	1.46
@@ -412,19 +412,23 @@
 }
 
 /* Lock a list of LVs */
-int activate_lvs_excl(struct cmd_context *cmd, struct list *lvs)
+int activate_lvs(struct cmd_context *cmd, struct list *lvs, unsigned exclusive)
 {
 	struct list *lvh;
 	struct lv_list *lvl;
 
 	list_iterate_items(lvl, lvs) {
-		if (!activate_lv_excl(cmd, lvl->lv)) {
+		if (!exclusive) {
+			if (!activate_lv(cmd, lvl->lv)) {
+				log_error("Failed to activate %s", lvl->lv->name);
+				return 0;
+			}
+		} else if (!activate_lv_excl(cmd, lvl->lv)) {
 			log_error("Failed to activate %s", lvl->lv->name);
 			list_uniterate(lvh, lvs, &lvl->list) {
 				lvl = list_item(lvh, struct lv_list);
 				activate_lv(cmd, lvl->lv);
 			}
-
 			return 0;
 		}
 	}
--- LVM2/lib/locking/locking.h	2007/11/15 21:30:52	1.37
+++ LVM2/lib/locking/locking.h	2008/04/09 12:56:34	1.38
@@ -120,7 +120,7 @@
 /* Process list of LVs */
 int suspend_lvs(struct cmd_context *cmd, struct list *lvs);
 int resume_lvs(struct cmd_context *cmd, struct list *lvs);
-int activate_lvs_excl(struct cmd_context *cmd, struct list *lvs);
+int activate_lvs(struct cmd_context *cmd, struct list *lvs, unsigned exclusive);
 
 /* Interrupt handling */
 void sigint_clear(void);
--- LVM2/tools/lvconvert.c	2008/04/07 10:23:47	1.62
+++ LVM2/tools/lvconvert.c	2008/04/09 12:56:34	1.63
@@ -258,7 +258,7 @@
 				    struct volume_group *vg __attribute((unused)),
 				    struct logical_volume *lv __attribute((unused)),
 				    struct list *lvs_changed __attribute((unused)),
-				    int first_time __attribute((unused)))
+				    unsigned flags __attribute((unused)))
 {
 	/* lvconvert mirror doesn't require periodical metadata update */
 	return 1;
--- LVM2/tools/polldaemon.h	2008/04/09 12:45:32	1.5
+++ LVM2/tools/polldaemon.h	2008/04/09 12:56:34	1.6
@@ -29,7 +29,7 @@
 	int (*update_metadata) (struct cmd_context *cmd,
 				struct volume_group *vg,
 				struct logical_volume *lv_mirr,
-				struct list *lvs_changed, int first_time);
+				struct list *lvs_changed, unsigned flags);
 	int (*finish_copy) (struct cmd_context *cmd,
 			    struct volume_group *vg,
 			    struct logical_volume *lv_mirr,
--- LVM2/tools/pvmove.c	2008/04/09 12:45:32	1.51
+++ LVM2/tools/pvmove.c	2008/04/09 12:56:34	1.52
@@ -17,28 +17,43 @@
 #include "polldaemon.h"
 #include "display.h"
 
-static int pvmove_target_present(struct cmd_context *cmd, int clustered)
+#define PVMOVE_FIRST_TIME   0x00000001      /* Called for first time */
+
+static int _pvmove_target_present(struct cmd_context *cmd, int clustered)
 {
 	const struct segment_type *segtype;
 	unsigned attr = 0;
+	int found = 1;
+	static int _clustered_found = -1;
+
+	if (clustered && _clustered_found >= 0)
+		return _clustered_found;
 
 	if (!(segtype = get_segtype_from_string(cmd, "mirror")))
 		return_0;
 
 	if (activation() && segtype->ops->target_present &&
-	    !segtype->ops->target_present(NULL, clustered ? &attr : NULL)) {
-		log_error("%s: Required device-mapper target(s) not "
-			  "detected in your kernel", segtype->name);
-		return 0;
-	}
+	    !segtype->ops->target_present(NULL, clustered ? &attr : NULL))
+		found = 0;
 
-	if (clustered && !(attr & MIRROR_LOG_CLUSTERED)) {
-		log_error("%s: Required device-mapper clustered log "
-			  "module not detected in your kernel", segtype->name);
-		return 0;
+	if (activation() && clustered) {
+		if (found && (attr & MIRROR_LOG_CLUSTERED))
+			_clustered_found = found = 1;
+		else
+			_clustered_found = found = 0;
 	}
 
-	return 1;
+	return found;
+}
+
+static unsigned _pvmove_is_exclusive(struct cmd_context *cmd,
+				     struct volume_group *vg)
+{
+	if (vg_status(vg) & CLUSTERED)
+		if (!_pvmove_target_present(cmd, 1))
+			return 1;
+
+	return 0;
 }
 
 /* Allow /dev/vgname/lvname, vgname/lvname or lvname */
@@ -250,10 +265,22 @@
 	return lv_mirr;
 }
 
+static int _activate_lv(struct cmd_context *cmd, struct logical_volume *lv_mirr,
+			unsigned exclusive)
+{
+	if (exclusive)
+		return activate_lv_excl(cmd, lv_mirr);
+
+	return activate_lv(cmd, lv_mirr);
+}
+
 static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
 			    struct logical_volume *lv_mirr,
-			    struct list *lvs_changed, int first_time)
+			    struct list *lvs_changed, unsigned flags)
 {
+	unsigned exclusive = _pvmove_is_exclusive(cmd, vg);
+	unsigned first_time = (flags & PVMOVE_FIRST_TIME) ? 1 : 0;
+
 	log_verbose("Updating volume group metadata");
 	if (!vg_write(vg)) {
 		log_error("ABORTING: Volume group metadata update failed.");
@@ -289,7 +316,7 @@
 	/* Only the first mirror segment gets activated as a mirror */
 	/* FIXME: Add option to use a log */
 	if (first_time) {
-		if (!activate_lv_excl(cmd, lv_mirr)) {
+		if (!_activate_lv(cmd, lv_mirr, exclusive)) {
 			if (!test_mode())
 				log_error("ABORTING: Temporary mirror "
 					  "activation failed.  "
@@ -326,7 +353,8 @@
 	struct list *lvs_changed;
 	struct physical_volume *pv;
 	struct logical_volume *lv_mirr;
-	int first_time = 1;
+	unsigned first_time = 1;
+	unsigned exclusive;
 
 	pv_name_arg = argv[0];
 	argc--;
@@ -359,6 +387,8 @@
 		return ECMD_FAILED;
 	}
 
+	exclusive = _pvmove_is_exclusive(cmd, vg);
+
 	if ((lv_mirr = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) {
 		log_print("Detected pvmove in progress for %s", pv_name);
 		if (argc || lv_name)
@@ -372,7 +402,7 @@
 		}
 
 		/* Ensure mirror LV is active */
-		if (!activate_lv_excl(cmd, lv_mirr)) {
+		if (!_activate_lv(cmd, lv_mirr, exclusive)) {
 			log_error
 			    ("ABORTING: Temporary mirror activation failed.");
 			unlock_vg(cmd, pv_vg_name(pv));
@@ -416,8 +446,8 @@
 		}
 	}
 
-	/* Lock lvs_changed for exclusive use and activate (with old metadata) */
-	if (!activate_lvs_excl(cmd, lvs_changed)) {
+	/* Lock lvs_changed and activate (with old metadata) */
+	if (!activate_lvs(cmd, lvs_changed, exclusive)) {
 		stack;
 		unlock_vg(cmd, pv_vg_name(pv));
 		return ECMD_FAILED;
@@ -429,7 +459,7 @@
 
 	if (first_time) {
 		if (!_update_metadata
-		    (cmd, vg, lv_mirr, lvs_changed, first_time)) {
+		    (cmd, vg, lv_mirr, lvs_changed, PVMOVE_FIRST_TIME)) {
 			stack;
 			unlock_vg(cmd, pv_vg_name(pv));
 			return ECMD_FAILED;
@@ -565,8 +595,10 @@
 	char *colon;
 	int ret;
 
-	if (!pvmove_target_present(cmd, 0)) {
-		stack;
+	/* dm raid1 target must be present in every case */
+	if (!_pvmove_target_present(cmd, 0)) {
+		log_error("Required device-mapper target(s) not "
+			  "detected in your kernel");
 		return ECMD_FAILED;
 	}
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2007-06-15 10:11 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2007-06-15 10:11 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2007-06-15 10:11:15

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c locking.h 
	tools          : lvchange.c lvmcmdline.c lvresize.c pvcreate.c 
	                 toollib.c 

Log message:
	Allow keyboard interrupts in yes_no_prompt(). Add code to toollib.c
	loops and to pvcreate.c, lvchange.c and lvresize.c to handle
	interrupted prompts.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.632&r2=1.633
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100

--- LVM2/WHATS_NEW	2007/06/14 10:16:34	1.632
+++ LVM2/WHATS_NEW	2007/06/15 10:11:14	1.633
@@ -1,5 +1,6 @@
 Version 2.02.26 -
 =================================
+  Allow keyboard interrupt in user prompts where appropriate.
   Remove system-lv code from clvmd. It's highly dodgy and never used.
   Convert a lot of code pv dereferences to use get_pv_* functions.
   Suppress a couple benign warnings by adding variable initializations.
--- LVM2/lib/locking/locking.c	2006/11/30 23:11:41	1.35
+++ LVM2/lib/locking/locking.c	2007/06/15 10:11:14	1.36
@@ -34,6 +34,87 @@
 static int _vg_write_lock_held = 0;	/* VG write lock held? */
 static int _signals_blocked = 0;
 
+static volatile sig_atomic_t _sigint_caught = 0;
+static volatile sig_atomic_t _handler_installed;
+static struct sigaction _oldhandler;
+static int _oldmasked;
+
+static void _catch_sigint(int unused __attribute__((unused)))
+{
+	_sigint_caught = 1;
+}
+
+int sigint_caught() {
+	return _sigint_caught;
+}
+
+void sigint_clear()
+{
+	_sigint_caught = 0;
+}
+
+/* Temporarily allow keyboard interrupts to be intercepted and noted;
+   saves interrupt handler state for sigint_restore(). Users should
+   use the sigint_caught() predicate to check whether interrupt was
+   requested and act appropriately. Interrupt flags are never
+   automatically cleared by this code, but lvm_run_command() clears
+   the flag before running any command. All other places where the
+   flag needs to be cleared need to call sigint_clear(). */
+
+void sigint_allow()
+{
+	struct sigaction handler;
+	sigset_t sigs;
+
+	/* do not overwrite the backed up handler data with our
+	   override ones; we just increase nesting count */
+	if (_handler_installed) {
+		_handler_installed++;
+		return;
+	}
+
+	/* grab old sigaction for SIGINT; shall not fail */
+	sigaction(SIGINT, NULL, &handler);
+	handler.sa_flags &= ~SA_RESTART; /* clear restart flag */
+	handler.sa_handler = _catch_sigint;
+
+	_handler_installed = 1;
+
+	/* override the signal handler; shall not fail */
+	sigaction(SIGINT, &handler, &_oldhandler);
+
+	/* unmask SIGINT, remember to mask it again on restore */
+	sigprocmask(0, NULL, &sigs);
+	if ((_oldmasked = sigismember(&sigs, SIGINT))) {
+		sigdelset(&sigs, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigs, NULL);
+	}
+}
+
+void sigint_restore()
+{
+	/* extra call, ignore */
+	if (!_handler_installed)
+		return;
+
+	if (_handler_installed > 1) {
+		_handler_installed--;
+		return;
+	}
+
+	/* nesting count went down to 0 */
+	_handler_installed = 0;
+
+	if (_oldmasked) {
+		sigset_t sigs;
+		sigprocmask(0, NULL, &sigs);
+		sigaddset(&sigs, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigs, NULL);
+	}
+
+	sigaction(SIGINT, &_oldhandler, NULL);
+}
+
 static void _block_signals(int flags __attribute((unused)))
 {
 	sigset_t set;
--- LVM2/lib/locking/locking.h	2007/01/19 22:21:45	1.30
+++ LVM2/lib/locking/locking.h	2007/06/15 10:11:14	1.31
@@ -115,4 +115,11 @@
 int resume_lvs(struct cmd_context *cmd, struct list *lvs);
 int activate_lvs_excl(struct cmd_context *cmd, struct list *lvs);
 
+/* interrupt handling */
+
+void sigint_clear();
+void sigint_allow();
+void sigint_restore();
+int sigint_caught();
+
 #endif
--- LVM2/tools/lvchange.c	2007/01/24 23:43:27	1.78
+++ LVM2/tools/lvchange.c	2007/06/15 10:11:14	1.79
@@ -212,6 +212,9 @@
 				return ECMD_FAILED;
 			}
 
+			if (sigint_caught())
+				return ECMD_FAILED;
+
 			active = 1;
 		}
 	}
@@ -454,6 +457,10 @@
 				  lv->name);
 			return 0;
 		}
+
+		if (sigint_caught())
+			return 0;
+
 		log_verbose("Ensuring %s is inactive.", lv->name);
 		if (!deactivate_lv(cmd, lv)) {
 			log_error("%s: deactivation failed", lv->name);
@@ -626,6 +633,8 @@
 			return ECMD_FAILED;
 		archived = 1;
 		doit += lvchange_persistent(cmd, lv);
+		if (sigint_caught())
+			return ECMD_FAILED;
 	}
 
 	/* add tag */
--- LVM2/tools/lvmcmdline.c	2007/04/26 16:44:59	1.42
+++ LVM2/tools/lvmcmdline.c	2007/06/15 10:11:14	1.43
@@ -373,6 +373,7 @@
 	int c = 0, ret = 0;
 	va_list ap;
 
+	sigint_allow();
 	do {
 		if (c == '\n' || !c) {
 			va_start(ap, prompt);
@@ -390,6 +391,8 @@
 			ret = c;
 	} while (!ret || c != '\n');
 
+	sigint_restore();
+
 	if (c != '\n')
 		printf("\n");
 
@@ -865,6 +868,9 @@
 	int ret = 0;
 	int locking_type;
 
+	/* each command should start out with sigint flag cleared */
+	sigint_clear();
+
 	if (!(cmd->cmd_line = _copy_command_line(cmd, argc, argv)))
 		return ECMD_FAILED;
 
--- LVM2/tools/lvresize.c	2007/06/06 19:40:28	1.77
+++ LVM2/tools/lvresize.c	2007/06/15 10:11:14	1.78
@@ -485,6 +485,8 @@
 						  "reduced", lp->lv_name);
 					return ECMD_FAILED;
 				}
+				if (sigint_caught())
+					return ECMD_FAILED;
 			}
 		}
 	}
--- LVM2/tools/pvcreate.c	2007/06/14 15:48:04	1.51
+++ LVM2/tools/pvcreate.c	2007/06/15 10:11:14	1.52
@@ -58,6 +58,9 @@
 		return 0;
 	}
 
+	if (sigint_caught())
+		return 0;
+
 	dev = dev_cache_get(name, cmd->filter);
 
 	/* Is there an md superblock here? */
@@ -103,6 +106,9 @@
 		}
 	}
 
+	if (sigint_caught())
+		return 0;
+
 	if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG)) {
 		log_print("WARNING: Forcing physical volume creation on "
 			  "%s%s%s%s", name,
@@ -173,6 +179,9 @@
 	if (!pvcreate_check(cmd, pv_name))
 		goto error;
 
+	if (sigint_caught())
+		goto error;
+
 	if (arg_sign_value(cmd, physicalvolumesize_ARG, 0) == SIGN_MINUS) {
 		log_error("Physical volume size may not be negative");
 		goto error;
@@ -309,6 +318,8 @@
 		r = pvcreate_single(cmd, argv[i], &pp);
 		if (r > ret)
 			ret = r;
+		if (sigint_caught())
+			return ret;
 	}
 
 	return ret;
--- LVM2/tools/toollib.c	2007/06/06 19:40:28	1.99
+++ LVM2/tools/toollib.c	2007/06/15 10:11:14	1.100
@@ -209,6 +209,8 @@
 		ret = process_single(cmd, lvl->lv, handle);
 		if (ret > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	if (lvargs_supplied && lvargs_matched != list_size(arg_lvnames)) {
@@ -407,6 +409,8 @@
 		unlock_vg(cmd, vgname);
 		if (ret > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	return ret_max;
@@ -429,6 +433,8 @@
 		ret = process_single(cmd, vg, pvseg, handle);
 		if (ret > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	return ret_max;
@@ -449,6 +455,8 @@
 		ret = process_single(cmd, seg, handle);
 		if (ret > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	return ret_max;
@@ -498,6 +506,9 @@
 		ret_max = ret;
 	}
 
+	if (sigint_caught())
+		return ret_max;
+
 	unlock_vg(cmd, vg_name);
 
 	return ret_max;
@@ -573,6 +584,8 @@
 						  &arg_vgnames,
 					  	  lock_type, consistent, handle,
 					  	  ret_max, process_single);
+			if (sigint_caught())
+				return ret_max;
 		}
 	} else {
 		list_iterate_items(sl, vgnames) {
@@ -583,6 +596,8 @@
 						  &arg_vgnames,
 					  	  lock_type, consistent, handle,
 					  	  ret_max, process_single);
+			if (sigint_caught())
+				return ret_max;
 		}
 	}
 
@@ -607,6 +622,8 @@
 		}
 		if ((ret = process_single(cmd, vg, pvl->pv, handle)) > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	return ret_max;
@@ -643,6 +660,8 @@
 		ret = process_single(cmd, NULL, pv, handle);
 		if (ret > ret_max)
 			ret_max = ret;
+		if (sigint_caught())
+			return ret_max;
 	}
 
 	dev_iter_destroy(iter);
@@ -715,6 +734,8 @@
 			ret = process_single(cmd, vg, pv, handle);
 			if (ret > ret_max)
 				ret_max = ret;
+			if (sigint_caught())
+				return ret_max;
 		}
 		if (!list_empty(&tags) && (vgnames = get_vgs(cmd, 0)) &&
 		    !list_empty(vgnames)) {
@@ -735,6 +756,8 @@
 							    process_single);
 				if (ret > ret_max)
 					ret_max = ret;
+				if (sigint_caught())
+					return ret_max;
 			}
 		}
 	} else {
@@ -745,10 +768,14 @@
 						    process_single);
 			if (ret > ret_max)
 				ret_max = ret;
+			if (sigint_caught())
+				return ret_max;
 		} else if (arg_count(cmd, all_ARG)) {
 			ret = _process_all_devs(cmd, handle, process_single);
 			if (ret > ret_max)
 				ret_max = ret;
+			if (sigint_caught())
+				return ret_max;
 		} else {
 			log_verbose("Scanning for physical volume names");
 			if (!(pvslist = get_pvs(cmd)))
@@ -759,6 +786,8 @@
 						     handle);
 				if (ret > ret_max)
 					ret_max = ret;
+				if (sigint_caught())
+					return ret_max;
 			}
 		}
 	}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc ...
@ 2005-08-15 12:00 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2005-08-15 12:00 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-08-15 12:00:05

Modified files:
	.              : WHATS_NEW 
	lib/locking    : locking.c locking.h 
	tools          : lvchange.c lvconvert.c lvcreate.c lvremove.c 
	                 lvrename.c lvresize.c pvmove.c vgchange.c 
	                 vgreduce.c 

Log message:
	Change LV locking macros to take lv instead of lvid.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.281&r2=1.282
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvremove.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-27 17:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-14 22:47 LVM2 ./WHATS_NEW lib/locking/locking.c lib/loc agk
  -- strict thread matches above, loose matches on Subject: below --
2011-09-27 17:09 agk
2010-05-06 11:15 prajnoha
2010-01-22  9:45 mbroz
2008-04-09 12:56 agk
2007-06-15 10:11 mornfall
2005-08-15 12:00 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).