public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/m ...
Date: Thu, 13 Jan 2011 14:51:00 -0000	[thread overview]
Message-ID: <20110113145139.10590.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-01-13 14:51:35

Modified files:
	.              : WHATS_NEW 
	lib/activate   : activate.c 
	lib/misc       : lvm-exec.c lvm-exec.h 
	tools          : lvresize.c 

Log message:
	Add exec_cmd paramater  sync_needed
	
	As sync_local_dev_names() cannot be called within activation context,
	add new parametr which allows to select if the sync call is needed
	before executing new command.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1878&r2=1.1879
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-exec.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-exec.h.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128

--- LVM2/WHATS_NEW	2011/01/12 20:42:50	1.1878
+++ LVM2/WHATS_NEW	2011/01/13 14:51:32	1.1879
@@ -1,5 +1,6 @@
 Version 2.02.81 -
 ===================================
+  Extend exec_cmd params to specify, when device sync is needed.
   Replace fs_unlock by sync_local_dev_names to notify local clvmd. (2.02.80)
   Introduce sync_local_dev_names and CLVMD_CMD_SYNC_NAMES to issue fs_unlock.
   Accept fusion fio in device type filter.
--- LVM2/lib/activate/activate.c	2011/01/10 14:02:31	1.185
+++ LVM2/lib/activate/activate.c	2011/01/13 14:51:33	1.186
@@ -424,7 +424,7 @@
 	argv[1] = module;
 	argv[2] = NULL;
 
-	ret = exec_cmd(cmd, argv, NULL);
+	ret = exec_cmd(cmd, argv, NULL, 0);
 #endif
 	return ret;
 }
--- LVM2/lib/misc/lvm-exec.c	2011/01/12 20:42:51	1.11
+++ LVM2/lib/misc/lvm-exec.c	2011/01/13 14:51:33	1.12
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -47,7 +47,8 @@
 /*
  * Execute and wait for external command
  */
-int exec_cmd(struct cmd_context *cmd, const char *const argv[], int *rstatus)
+int exec_cmd(struct cmd_context *cmd, const char *const argv[],
+	     int *rstatus, int sync_needed)
 {
 	pid_t pid;
 	int status;
@@ -55,7 +56,12 @@
 
 	log_verbose("Executing: %s", _verbose_args(argv, buf, sizeof(buf)));
 
-	sync_local_dev_names(cmd); /* Flush ops and reset dm cookie */
+	if (rstatus)
+		*rstatus = -1;
+
+	if (sync_needed)
+		if (!sync_local_dev_names(cmd)) /* Flush ops and reset dm cookie */
+			return_0;
 
 	if ((pid = fork()) == -1) {
 		log_error("fork failed: %s", strerror(errno));
@@ -74,9 +80,6 @@
 		_exit(errno);
 	}
 
-	if (rstatus)
-		*rstatus = -1;
-
 	/* Parent */
 	if (wait4(pid, &status, 0, NULL) != pid) {
 		log_error("wait4 child process %u failed: %s", pid,
--- LVM2/lib/misc/lvm-exec.h	2010/11/01 14:17:36	1.6
+++ LVM2/lib/misc/lvm-exec.h	2011/01/13 14:51:33	1.7
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
- * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -19,6 +19,22 @@
 #include "lib.h"
 
 struct cmd_context;
-int exec_cmd(struct cmd_context *cmd, const char *const argv[], int *rstatus);
+
+/**
+ * Execute command with paramaters and return status
+ *
+ * \param rstatus
+ * Returns command's exit status code.
+ *
+ * \param sync_needed
+ * Bool specifying whether local devices needs to be synchronized
+ * before executing command.
+ * Note: You cannot synchronize devices within activation context.
+ *
+ * \return
+ * 0 (success) or -1 (failure).
+ */
+int exec_cmd(struct cmd_context *cmd, const char *const argv[],
+	     int *rstatus, int sync_needed);
 
 #endif
--- LVM2/tools/lvresize.c	2010/12/08 20:50:51	1.127
+++ LVM2/tools/lvresize.c	2011/01/13 14:51:34	1.128
@@ -179,7 +179,7 @@
 
 	argv[i] = NULL;
 
-	return exec_cmd(cmd, argv, status);
+	return exec_cmd(cmd, argv, status, 1);
 }
 
 static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,


             reply	other threads:[~2011-01-13 14:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 14:51 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-13 22:28 agk
2011-02-18 14:29 zkabelac
2010-11-05 18:18 prajnoha
2010-11-01 14:17 zkabelac
2009-05-13 21:26 mbroz
2008-01-17 17:17 agk
2007-01-24 16:51 agk
2006-05-25 13:32 agk
2005-12-08 17:49 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=20110113145139.10590.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /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 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).