Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=757f93baff…
Commit: 757f93baff9f8a611b8efe5e1b0d11e42c63d128
Parent: a556f2806c78035bd17f325c0f89a244b65cee81
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jun 10 11:44:10 2016 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jun 10 11:44:10 2016 +0100
mkfs.gfs2: Tidy up are_you_sure()
Coverity pointed out that the 'line' pointer was dereferenced before it
was NULL-checked and although that wasn't a bug it highlighted this
function's strange structure. This patch tidies it up somewhat, keeping
in mind that the memory allocated by getline() always has to be freed
whether it succeeds or not.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 4436f93..7ede5ad 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -422,34 +422,29 @@ static void test_locking(struct mkfs_opts *opts)
static void are_you_sure(void)
{
- char *line = NULL;
- size_t len = 0;
- int ret = -1;
- int res = 0;
+ while (1) {
+ char *line = NULL;
+ size_t len = 0;
+ int ret;
+ int res;
- do{
/* Translators: We use rpmatch(3) to match the answers to y/n
questions in the user's own language, so the [y/n] here must also be
translated to match one of the letters in the pattern printed by
`locale -k yesexpr` and one of the letters in the pattern printed by
`locale -k noexpr` */
- printf( _("Are you sure you want to proceed? [y/n]"));
+ printf( _("Are you sure you want to proceed? [y/n] "));
ret = getline(&line, &len, stdin);
res = rpmatch(line);
-
- if (res > 0){
- free(line);
- return;
- }
- if (!res){
- printf("\n");
- die( _("Aborted.\n"));
- }
-
- }while(ret >= 0);
-
- if(line)
free(line);
+ if (ret <= 0)
+ continue;
+ if (res == 1) /* Yes */
+ return;
+ if (res == 0) /* No */
+ exit(1);
+ /* Unrecognized input; go again. */
+ };
}
static unsigned choose_blocksize(struct mkfs_opts *opts)
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=80b9ae57170c1…
Commit: 80b9ae57170c1c6042375ea5119aea1ec79e3ab4
Parent: 3ad66bb1d801147eee80f68afc543429b3a2f0d2
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Jun 9 11:29:24 2016 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Jun 9 11:29:24 2016 -0400
rgmanager: Fix missing function prototype
Add a function prototype for lock_commit_cb so that we can properly
re-init the vf lock callbacks if we have lost and regained quorum.
Resolves: rhbz#1084053
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/main.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 4831104..edd3d40 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -31,6 +31,9 @@
void dump_thread_states(FILE *);
#endif
static int configure_rgmanager(int ccsfd, int debug, int *cluster_timeout);
+static int lock_commit_cb(char __attribute__ ((unused)) *key,
+ uint64_t __attribute__ ((unused)) viewno,
+ void *data, uint32_t datalen);
void flag_shutdown(int sig);
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=df390e7b2acc9…
Commit: df390e7b2acc983658b0c30cdf0a6394ceb9a173
Parent: 441bff8b11c094f5a005a6202b2bf9e7e39946a5
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Jun 9 10:58:54 2016 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Jun 9 10:58:54 2016 -0400
rgmanager: Re-init the vf key callbacks after losing and regaining quorum
When central processing is enabled, and we have recovered from quorum
having been dissolved, reinitialize the vf key callbacks.
Original patch from John Ruemker <jruemker(a)redhat.com>
Resolves: rhbz#1084053
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/main.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 6f0b39f..9d5aa9a 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -153,6 +153,11 @@ membership_update(void)
rg_lockall(L_SYS);
exit(1);
}
+
+#ifndef USE_OPENAIS
+ vf_key_init("rg_lockdown", 10, NULL, lock_commit_cb);
+ vf_key_init("Transition-Master", 10, NULL, master_event_callback);
+#endif
}
}
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=441bff8b11c09…
Commit: 441bff8b11c094f5a005a6202b2bf9e7e39946a5
Parent: 52816e6e75e47f23414afde26bdce2f0d6f21feb
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Jun 9 10:53:29 2016 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Jun 9 10:53:29 2016 -0400
rgmanager: Forgot that we were transition master on quorum loss
Clear the _master flag if we lose quorum, so that in the event quorum is
regained and we lose the race for the transition-master lock, we do not
wrongly think we're still master.
Resolves: rhbz#1084053
---
rgmanager/include/event.h | 1 +
rgmanager/src/daemons/main.c | 1 +
rgmanager/src/daemons/rg_event.c | 3 +++
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h
index 9fc9521..1442a64 100644
--- a/rgmanager/include/event.h
+++ b/rgmanager/include/event.h
@@ -120,6 +120,7 @@ int slang_process_event(event_table_t *event_table, event_t *ev);
/* For distributed events. */
void set_transition_throttling(int nsecs);
int get_transition_throttling(void);
+void drop_event_master(void);
/* Simplified service start. */
int service_op_start(char *svcName, int *target_list, int target_list_len,
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 127015b..6f0b39f 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -136,6 +136,7 @@ membership_update(void)
logt_print(LOG_DEBUG, "Flushing resource group cache\n");
kill_resource_groups();
rg_clear_initialized(0);
+ drop_event_master();
return -1;
} else if (!rg_quorate()) {
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
index 4a747e0..1814c60 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -46,6 +46,9 @@ void flag_reconfigure(int sig);
event_table_t *master_event_table = NULL;
+void drop_event_master(void) {
+ _master = 0;
+}
void
set_transition_throttling(int nsecs)
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=52816e6e75e47…
Commit: 52816e6e75e47f23414afde26bdce2f0d6f21feb
Parent: abd0d212698ca681e42d3d2869fc728d1908f346
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Mon Jun 6 11:26:53 2016 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Mon Jun 6 11:26:53 2016 -0400
rgmanager: Check for NULL when attempting to access the member list
Check that the membership list is not NULL before accessing it while sending
state information. This can happen during very shortly after startup if
modclusterd is running and sends a clustat command before initialization is
complete.
Resolves: rhbz#1228170
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/main.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 3679d57..127015b 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -77,6 +77,9 @@ send_node_states(msgctx_t *ctx)
generic_msg_hdr hdr;
cluster_member_list_t *ml = member_list();
+ if (!ml)
+ return;
+
master.m_nodeid = 0;
event_master_info_cached(&master);