Accepting request 236951 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/236951
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lvm2?expand=0&rev=70
This commit is contained in:
Stephan Kulow 2014-06-16 19:43:05 +00:00 committed by Git OBS Bridge
commit 992373a053
11 changed files with 382 additions and 3 deletions

View File

@ -0,0 +1,65 @@
Index: LVM2.2.02.98/lib/commands/toolcontext.c
===================================================================
--- LVM2.2.02.98.orig/lib/commands/toolcontext.c 2014-04-14 14:06:23.245391597 +0800
+++ LVM2.2.02.98/lib/commands/toolcontext.c 2014-04-14 14:06:47.761421565 +0800
@@ -1315,6 +1315,7 @@ struct cmd_context *create_toolcontext(u
{
struct cmd_context *cmd;
FILE *new_stream;
+ int flags;
#ifdef M_MMAP_MAX
mallopt(M_MMAP_MAX, 0);
@@ -1358,7 +1359,10 @@ struct cmd_context *create_toolcontext(u
goto out;
}
- if (is_valid_fd(STDIN_FILENO)) {
+ /* nohup might set stdin O_WRONLY ! */
+ if (is_valid_fd(STDIN_FILENO) &&
+ ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
+ (flags & O_ACCMODE) != O_WRONLY) {
if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
goto_out;
stdin = new_stream;
@@ -1368,7 +1372,9 @@ struct cmd_context *create_toolcontext(u
}
}
- if (is_valid_fd(STDOUT_FILENO)) {
+ if (is_valid_fd(STDOUT_FILENO) &&
+ ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
+ (flags & O_ACCMODE) != O_RDONLY) {
if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream))
goto_out;
stdout = new_stream;
@@ -1629,6 +1635,7 @@ void destroy_toolcontext(struct cmd_cont
{
struct dm_config_tree *cft_cmdline;
FILE *new_stream;
+ int flags;
if (cmd->dump_filter)
persistent_filter_dump(cmd->filter, 1);
@@ -1654,7 +1661,9 @@ void destroy_toolcontext(struct cmd_cont
#ifndef VALGRIND_POOL
if (cmd->linebuffer) {
/* Reset stream buffering to defaults */
- if (is_valid_fd(STDIN_FILENO)) {
+ if (is_valid_fd(STDIN_FILENO) &&
+ ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
+ (flags & O_ACCMODE) != O_WRONLY) {
if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) {
stdin = new_stream;
setlinebuf(stdin);
@@ -1662,7 +1671,9 @@ void destroy_toolcontext(struct cmd_cont
cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
}
- if (is_valid_fd(STDOUT_FILENO)) {
+ if (is_valid_fd(STDOUT_FILENO) &&
+ ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
+ (flags & O_ACCMODE) != O_RDONLY) {
if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) {
stdout = new_stream;
setlinebuf(stdout);

View File

@ -0,0 +1,22 @@
Index: LVM2.2.02.98/daemons/clvmd/clvmd.c
===================================================================
--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c
+++ LVM2.2.02.98/daemons/clvmd/clvmd.c
@@ -364,7 +364,7 @@ int main(int argc, char *argv[])
/* Deal with command-line arguments */
opterr = 0;
optind = 0;
- while ((opt = getopt_long(argc, argv, "vVhfd::t:RST:CI:E:",
+ while ((opt = getopt_long(argc, argv, "vVhfd:t:RST:CI:E:",
longopts, NULL)) != -1) {
switch (opt) {
case 'h':
@@ -451,7 +451,7 @@ int main(int argc, char *argv[])
return debug_clvmd(debug_arg, clusterwide_opt)==1?0:1;
}
- clvmd_set_debug(debug_opt);
+ clvmd_set_debug(debug_arg);
/* Fork into the background (unless requested not to) */
if (!foreground_mode)

View File

@ -29,7 +29,7 @@
# Parameter defaults # Parameter defaults
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"} : ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
: ${OCF_RESKEY_daemon_timeout:="80"} : ${OCF_RESKEY_daemon_timeout:="80"}
: ${OCF_RESKEY_daemon_options:="-d2"} : ${OCF_RESKEY_daemon_options:="-d0"}
# Common variables # Common variables
DAEMON="/usr/sbin/clvmd" DAEMON="/usr/sbin/clvmd"

View File

@ -0,0 +1,101 @@
Index: LVM2.2.02.98/daemons/clvmd/clvmd-corosync.c
===================================================================
--- LVM2.2.02.98.orig/daemons/clvmd/clvmd-corosync.c 2014-04-14 14:08:40.547558968 +0800
+++ LVM2.2.02.98/daemons/clvmd/clvmd-corosync.c 2014-04-14 14:09:30.440619510 +0800
@@ -251,8 +251,12 @@ static void corosync_cpg_confchg_callbac
ninfo = dm_hash_lookup_binary(node_hash,
(char *)&left_list[i].nodeid,
COROSYNC_CSID_LEN);
- if (ninfo)
+ if (ninfo) {
ninfo->state = NODE_DOWN;
+ char name[MAX_CLUSTER_MEMBER_NAME_LEN];
+ sprintf(name, "%x", ninfo->nodeid);
+ decrease_inflight_expected_reply(name);
+ }
}
num_nodes = member_list_entries;
Index: LVM2.2.02.98/daemons/clvmd/clvmd.c
===================================================================
--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c 2014-04-14 14:08:40.582559010 +0800
+++ LVM2.2.02.98/daemons/clvmd/clvmd.c 2014-04-14 14:09:59.751655009 +0800
@@ -1602,6 +1602,56 @@ static void process_remote_command(struc
free(replyargs);
}
+void decrease_inflight_expected_reply(char *nodename)
+{
+ struct local_client * thisfd;
+ struct node_reply *reply;
+
+ DEBUGLOG("remote node %s down", nodename);
+
+ for (thisfd = &local_client_head; thisfd != NULL;
+ thisfd = thisfd->next) {
+ /* in-flight request */
+ if (thisfd->type == LOCAL_SOCK
+ && thisfd->bits.localsock.sent_out
+ && thisfd->bits.localsock.in_progress
+ && ! thisfd->bits.localsock.finished
+ && thisfd->bits.localsock.expected_replies >
+ thisfd->bits.localsock.num_replies) {
+
+ pthread_mutex_lock(&thisfd->bits.localsock.reply_mutex);
+
+ reply = thisfd->bits.localsock.replies;
+ while (reply && strcmp(reply->node, nodename) != 0) {
+ reply = reply->next;
+ }
+ /* if the remote down server has replies,do not decrease the expected_replies */
+ if (reply)
+ continue;
+
+ thisfd->bits.localsock.expected_replies--;
+ DEBUGLOG
+ ("remote node down, decrement the expected replies to (%ld),num_replies(%ld)",
+ thisfd->bits.localsock.expected_replies,
+ thisfd->bits.localsock.num_replies)
+
+ if (thisfd->bits.localsock.expected_replies <= thisfd->bits.localsock.num_replies) {
+ /* tell pre_and_post thread to finish */
+ if (thisfd->bits.localsock.threadid) {
+ thisfd->bits.localsock.all_success = 0;
+ pthread_mutex_lock(&thisfd->bits.localsock.mutex);
+ thisfd->bits.localsock.state = POST_COMMAND;
+ pthread_cond_signal(&thisfd->bits.localsock.cond);
+ pthread_mutex_unlock(&thisfd->bits.localsock.mutex);
+ }
+ }
+ pthread_mutex_unlock(&thisfd->bits.localsock.reply_mutex);
+
+ }
+ }
+
+}
+
/* Add a reply to a command to the list of replies for this client.
If we have got a full set then send them to the waiting client down the local
socket */
@@ -1643,7 +1693,7 @@ static void add_reply_to_list(struct loc
client->bits.localsock.expected_replies);
/* If we have the whole lot then do the post-process */
- if (++client->bits.localsock.num_replies ==
+ if (++client->bits.localsock.num_replies >=
client->bits.localsock.expected_replies) {
/* Post-process the command */
if (client->bits.localsock.threadid) {
Index: LVM2.2.02.98/daemons/clvmd/clvmd.h
===================================================================
--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.h 2014-04-14 14:08:40.564558988 +0800
+++ LVM2.2.02.98/daemons/clvmd/clvmd.h 2014-04-14 14:09:30.442619512 +0800
@@ -112,6 +112,8 @@ extern int do_post_command(struct local_
extern void cmd_client_cleanup(struct local_client *client);
extern int add_client(struct local_client *new_client);
+
+extern void decrease_inflight_expected_reply();
extern void clvmd_cluster_init_completed(void);
extern void process_message(struct local_client *client, char *buf,
int len, const char *csid);

View File

@ -441,7 +441,7 @@ global {
# Local non-LV directory that holds file-based locks while commands are # Local non-LV directory that holds file-based locks while commands are
# in progress. A directory like /tmp that may get wiped on reboot is OK. # in progress. A directory like /tmp that may get wiped on reboot is OK.
locking_dir = "/run/lock/lvm" locking_dir = "/run/lvm/lock"
# Whenever there are competing read-only and read-write access requests for # Whenever there are competing read-only and read-write access requests for
# a volume group's metadata, instead of always granting the read-only # a volume group's metadata, instead of always granting the read-only
@ -541,7 +541,8 @@ global {
# #
# If lvmetad has been running while use_lvmetad was 0, it MUST be stopped # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped
# before changing use_lvmetad to 1 and started again afterwards. # before changing use_lvmetad to 1 and started again afterwards.
use_lvmetad = 1 # If use_lvmetad set to 1, please make sure lvm2-lvmetad.socket is started
use_lvmetad = 0
# Full path of the utility called to check that a thin metadata device # Full path of the utility called to check that a thin metadata device
# is in a state that allows it to be used. # is in a state that allows it to be used.

View File

@ -1,4 +1,52 @@
------------------------------------------------------------------- -------------------------------------------------------------------
Tue May 30 09:01:08 UTC 2014 - lmb@suse.com
- Versioning for the lvm2-cmirrord dependencies
-------------------------------------------------------------------
Thu May 29 10:01:35 UTC 2014 - dmzhang@suse.com
- bnc#878930, systemd is putting out an erroneous message about lvm2-monitor.service
patch: remove-quote-in-lvm2-monitor.patch
-------------------------------------------------------------------
Wed May 28 16:45:45 UTC 2014 - lwang@suse.com
- fix lvm2-activation{,-early}.service is marked world-inaccessible (bnc#878481)
add systemd-use-umask-022-for-generated-systemd-units-by.patch
- add comment to lvm.conf to inform user to start lvm2-lvmetad.socket
if it is not started in case of use_lvmetad = 1 (bnc#878473)
- disable lvmetad in lvm.conf to fix it (bnc#862076)
-------------------------------------------------------------------
Wed May 28 15:46:58 UTC 2014 - lwang@suse.com
- bnc#878121, modify clvmd.ocf start debug level -d2 to d0
-------------------------------------------------------------------
Wed May 28 14:57:23 UTC 2014 - lwang@suse.com
- bnc#870598, change lockdir to /run/lvm/lock
modify lvm.conf
bnc#854092, backport patches to fix 'nohup lvm' crash
patch:0001-toolcontext-Only-reopen-stdin-if-readable.patch
bnc#870824, defaut the mirrortype to mirror when clvmd is running
patch:use-mirrortype-asdefault-whenclvmdrunning.patch
bnc#859824, get rid of the annoying message 'LVM activation generator successfully completed'
patch:systemd-lvm2-activation-generator-report-only-error.patch
bnc#837538, fix closedown of clvmd
patch:fix-closedown-before-thread-finish.patch
-------------------------------------------------------------------
Wed May 28 14:50:13 UTC 2014 - lwang@suse.com
- Added: clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch
This patch is missed in sle12, added from sle11sp3
Fix debugging level set in clvmd_set_debug by using the correct
variable (bnc#785467),change default -d0 to -d2
-------------------------------------------------------------------
Wed May 28 14:34:04 UTC 2014 - meissner@suse.com Wed May 28 14:34:04 UTC 2014 - meissner@suse.com
- add missing %pre section, specify all sockets and services in - add missing %pre section, specify all sockets and services in

View File

@ -103,6 +103,20 @@ Patch90: cmirrord_remove_date_time_from_compilation.patch
#upstream, bnc#871176 #upstream, bnc#871176
Patch91: 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch Patch91: 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch
#fixed in upstream,bnc#785467
Patch92: clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch
#upstream
Patch93: 0001-toolcontext-Only-reopen-stdin-if-readable.patch
#suse, bnc873538
Patch94: fix-closedown-before-thread-finish.patch
#upstream
Patch95: systemd-lvm2-activation-generator-report-only-error.patch
#suse, bnc#870824
Patch96: use-mirrortype-asdefault-whenclvmdrunning.patch
# bnc#878481
Patch97: systemd-use-umask-022-for-generated-systemd-units-by.patch
# bnc#878930
Patch98: remove-quote-in-lvm2-monitor.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# Not a real replacement but we drop evms # Not a real replacement but we drop evms
@ -159,6 +173,13 @@ Volume Manager.
%patch89 -p1 %patch89 -p1
%patch90 -p1 %patch90 -p1
%patch91 -p1 %patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%build %build
#set path so that thin_check can be found #set path so that thin_check can be found
@ -405,6 +426,8 @@ Requires: corosync
Requires: device-mapper >= 1.02.25 Requires: device-mapper >= 1.02.25
Requires: lvm2 = %{version} Requires: lvm2 = %{version}
Requires: lvm2-cmirrord Requires: lvm2-cmirrord
Obsoletes: cmirrord < %{version}
Provides: cmirrord = %{version}
Summary: Clustered LVM2 Summary: Clustered LVM2
Group: Productivity/Clustering/HA Group: Productivity/Clustering/HA

View File

@ -0,0 +1,13 @@
Index: LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in
===================================================================
--- LVM2.2.02.98.orig/scripts/lvm2_monitoring_systemd_red_hat.service.in 2014-05-29 17:57:49.651975608 +0800
+++ LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in 2014-05-29 17:59:51.691134245 +0800
@@ -12,7 +12,7 @@ Type=oneshot
Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
ExecStart=@sbindir@/lvm vgchange --monitor y
# The lvmetad must be disabled here, it needs https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first.
-ExecStop="@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'"
+ExecStop=@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'
RemainAfterExit=yes
[Install]

View File

@ -0,0 +1,25 @@
Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
===================================================================
--- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c 2014-04-14 14:25:29.280756835 +0800
+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c 2014-04-14 14:27:19.894797719 +0800
@@ -154,17 +154,16 @@ int main(int argc, char *argv[])
}
/* If lvmetad used, rely on autoactivation instead of direct activation. */
- if (lvm_uses_lvmetad()) {
- kmsg("LVM: Logical Volume autoactivation enabled.\n");
+ if (lvm_uses_lvmetad())
goto out;
- }
dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
r = EXIT_FAILURE;
out:
- kmsg("LVM: Activation generator %s.\n", r ? "failed" : "successfully completed");
+ if (r)
+ kmsg("LVM: Activation generator failed.\n");
if (kmsg_fd != -1)
(void) close(kmsg_fd);
return r;

View File

@ -0,0 +1,27 @@
Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
===================================================================
--- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -145,6 +145,7 @@ int main(int argc, char *argv[])
{
const char *dir;
int r = EXIT_SUCCESS;
+ mode_t old_mask;
kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY|O_NOCTTY);
@@ -158,9 +159,13 @@ int main(int argc, char *argv[])
goto out;
dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
-
+
+ /* mark lvm2-activation.*.service as world-accessible */
+ old_mask = umask(0022);
if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
r = EXIT_FAILURE;
+ umask(old_mask);
+
out:
if (r)
kmsg("LVM: Activation generator failed.\n");

View File

@ -0,0 +1,54 @@
Index: LVM2.2.02.98/tools/lvcreate.c
===================================================================
--- LVM2.2.02.98.orig/tools/lvcreate.c 2014-04-14 14:25:22.291748711 +0800
+++ LVM2.2.02.98/tools/lvcreate.c 2014-04-24 15:40:49.104019108 +0800
@@ -670,6 +670,28 @@ static int _read_activation_params(struc
return 1;
}
+static int clvmd_daemon_is_running()
+{
+ int fd;
+ struct flock lock;
+
+ if((fd = open(CLVMD_PIDFILE, O_RDONLY)) < 0)
+ return 0;
+
+ lock.l_type = F_WRLCK;
+ lock.l_start = 0;
+ lock.l_whence = SEEK_SET;
+ lock.l_len = 0;
+ if (fcntl(fd, F_GETLK, &lock) < 0) {
+ /* errors with fcntl */
+ close(fd);
+ return 0;
+ }
+
+ close(fd);
+ return (lock.l_type == F_UNLCK) ? 0 : 1;
+}
+
static int _lvcreate_params(struct lvcreate_params *lp,
struct lvcreate_cmdline_params *lcp,
struct cmd_context *cmd,
@@ -696,15 +718,16 @@ static int _lvcreate_params(struct lvcre
}
// FIXME -m0 implies *striped*
-
- /* Set default segtype */
- if (arg_count(cmd, mirrors_ARG))
+ /* Set default segtype */
+ if (arg_count(cmd, mirrors_ARG)) {
/*
* FIXME: Add default setting for when -i and -m arguments
* are both given. We should default to "raid10".
*/
segtype_str = find_config_tree_str(cmd, "global/mirror_segtype_default", DEFAULT_MIRROR_SEGTYPE);
- else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG))
+ if(clvmd_daemon_is_running())
+ segtype_str = "mirror";
+ } else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG))
segtype_str = "thin";
else
segtype_str = "striped";