All of lore.kernel.org
 help / color / mirror / Atom feed
From: snitzer@sourceware.org <snitzer@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/activate dev_manager.c
Date: 10 Feb 2010 14:38:25 -0000	[thread overview]
Message-ID: <20100210143825.9535.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer at sourceware.org	2010-02-10 14:38:24

Modified files:
	lib/activate   : dev_manager.c 

Log message:
	Add 'fail_if_percent_unsupported' arg to _percent() and _percent_run().
	
	We unfortunately don't yet _know_, in dev_manager_snapshot_percent(), if
	a snapshot-merge target is active (activation is deferred if dev is
	open); so we can't short-circuit origin devices based purely on existing
	LVM LV attributes.
	
	Set 'fail_if_percent_unsupported' in dev_manager_snapshot_percent() for
	a merging origin LV, otherwise passing unsupported LV types to _percent
	will lead to a default successful return with percent_range as
	PERCENT_100.
	
	For a merging origin, PERCENT_100 will result in a polldaemon that runs
	infinitely (because completion is PERCENT_0).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.179&r2=1.180

--- LVM2/lib/activate/dev_manager.c	2010/02/08 23:28:06	1.179
+++ LVM2/lib/activate/dev_manager.c	2010/02/10 14:38:24	1.180
@@ -423,7 +423,7 @@
 			const char *target_type, int wait,
 			const struct logical_volume *lv, float *percent,
 			percent_range_t *overall_percent_range,
-			uint32_t *event_nr)
+			uint32_t *event_nr, int fail_if_percent_unsupported)
 {
 	int r = 0;
 	struct dm_task *dmt;
@@ -516,10 +516,8 @@
 			/* above ->target_percent() was not executed! */
 			/* FIXME why return PERCENT_100 et. al. in this case? */
 			*overall_percent_range = PERCENT_100;
-			if (lv && lv_is_merging_origin(lv)) {
-				/* must fail in snapshot-merge case */
+			if (fail_if_percent_unsupported)
 				goto_out;
-			}
 		} else
 			*overall_percent_range = combined_percent_range;
 	}
@@ -535,20 +533,24 @@
 static int _percent(struct dev_manager *dm, const char *name, const char *dlid,
 		    const char *target_type, int wait,
 		    const struct logical_volume *lv, float *percent,
-		    percent_range_t *overall_percent_range, uint32_t *event_nr)
+		    percent_range_t *overall_percent_range, uint32_t *event_nr,
+		    int fail_if_percent_unsupported)
 {
 	if (dlid && *dlid) {
 		if (_percent_run(dm, NULL, dlid, target_type, wait, lv, percent,
-				 overall_percent_range, event_nr))
+				 overall_percent_range, event_nr,
+				 fail_if_percent_unsupported))
 			return 1;
 		else if (_percent_run(dm, NULL, dlid + sizeof(UUID_PREFIX) - 1,
 				      target_type, wait, lv, percent,
-				      overall_percent_range, event_nr))
+				      overall_percent_range, event_nr,
+				      fail_if_percent_unsupported))
 			return 1;
 	}
 
 	if (name && _percent_run(dm, name, NULL, target_type, wait, lv, percent,
-				 overall_percent_range, event_nr))
+				 overall_percent_range, event_nr,
+				 fail_if_percent_unsupported))
 		return 1;
 
 	return 0;
@@ -607,6 +609,22 @@
 {
 	char *name;
 	const char *dlid;
+	int fail_if_percent_unsupported = 0;
+
+	if (lv_is_merging_origin(lv)) {
+		/*
+		 * Set 'fail_if_percent_unsupported', otherwise passing
+		 * unsupported LV types to _percent will lead to a default
+		 * successful return with percent_range as PERCENT_100.
+		 * - For a merging origin, this will result in a polldaemon
+		 *   that runs infinitely (because completion is PERCENT_0)
+		 * - We unfortunately don't yet _know_ if a snapshot-merge
+		 *   target is active (activation is deferred if dev is open);
+		 *   so we can't short-circuit origin devices based purely on
+		 *   existing LVM LV attributes.
+		 */
+		fail_if_percent_unsupported = 1;
+	}
 
 	/*
 	 * Build a name for the top layer.
@@ -621,8 +639,8 @@
 	 * Try and get some info on this device.
 	 */
 	log_debug("Getting device status percentage for %s", name);
-	if (!(_percent(dm, name, dlid, "snapshot", 0, lv, percent,
-		       percent_range, NULL)))
+	if (!(_percent(dm, name, dlid, "snapshot", 0, NULL, percent,
+		       percent_range, NULL, fail_if_percent_unsupported)))
 		return_0;
 
 	/* FIXME dm_pool_free ? */
@@ -657,7 +675,7 @@
 
 	log_debug("Getting device mirror status percentage for %s", name);
 	if (!(_percent(dm, name, dlid, "mirror", wait, lv, percent,
-		       percent_range, event_nr)))
+		       percent_range, event_nr, 0)))
 		return_0;
 
 	return 1;



             reply	other threads:[~2010-02-10 14:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 14:38 snitzer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-13 17:59 LVM2/lib/activate dev_manager.c jbrassow
2012-01-25 11:10 agk
2012-01-19 15:19 zkabelac
2011-12-21 12:55 zkabelac
2011-11-15 17:25 zkabelac
2011-11-15 17:21 zkabelac
2011-11-15 17:15 zkabelac
2011-10-28 20:34 zkabelac
2011-10-11 10:02 zkabelac
2011-10-11  9:03 zkabelac
2011-10-11  9:02 zkabelac
2011-10-11  9:01 zkabelac
2011-10-11  8:54 zkabelac
2011-10-03 18:24 zkabelac
2011-07-05  1:01 agk
2011-07-04 14:56 agk
2010-12-22 15:32 zkabelac
2010-12-20 14:04 zkabelac
2010-05-14 12:39 mbroz
2010-05-14 12:30 mbroz
2010-05-14 12:03 mbroz
2010-02-23 15:49 mornfall
2010-01-22 13:28 snitzer
2010-01-13  1:44 snitzer
2009-12-03 10:01 zkabelac
2009-12-03  9:59 zkabelac
2009-11-04 14:56 mbroz
2009-05-07 12:01 mbroz
2008-09-19  7:05 agk
2008-01-08 16:47 zkabelac
2007-12-03 18:00 agk
2007-11-29 15:04 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100210143825.9535.qmail@sourceware.org \
    --to=snitzer@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.