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.
argv[1] = module;
argv[2] = NULL;
- ret = exec_cmd(cmd, argv, NULL);
+ ret = exec_cmd(cmd, argv, NULL, 0);
#endif
return ret;
}
/*
* 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.
*
/*
* 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;
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));
_exit(errno);
}
- if (rstatus)
- *rstatus = -1;
-
/* Parent */
if (wait4(pid, &status, 0, NULL) != pid) {
log_error("wait4 child process %u failed: %s", pid,
/*
* 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.
*
#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
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,