Accepting request 197501 from home:goldwynr:branches:network:ha-clustering:Factory

mkfs aborts if cluster information not found

OBS-URL: https://build.opensuse.org/request/show/197501
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=67
This commit is contained in:
Goldwyn Rodrigues 2013-09-05 13:39:21 +00:00 committed by Git OBS Bridge
parent 3e4aa7393f
commit a29982a563
3 changed files with 95 additions and 1 deletions

View File

@ -0,0 +1,86 @@
From 14c5f3788b047024390c1a1ae40a0585417ed0d9 Mon Sep 17 00:00:00 2001
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
Date: Wed, 4 Sep 2013 23:56:39 -0500
Subject: [PATCH 9/9] mkfs.ocfs2: Abort if cluster information is not detected
---
mkfs.ocfs2/check.c | 19 +++++++++++++++----
mkfs.ocfs2/mkfs.h | 2 +-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
index f05dc72..75f0e7b 100644
--- a/mkfs.ocfs2/check.c
+++ b/mkfs.ocfs2/check.c
@@ -33,7 +33,7 @@ int is_classic_stack(char *stack_name)
}
/* For ocfs2_fill_cluster_information(). Errors are to be ignored */
-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
+errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
{
errcode_t err;
struct o2cb_cluster_desc cluster;
@@ -44,11 +44,11 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
err = o2cb_init();
if (err)
- return;
+ goto out;
err = o2cb_running_cluster_desc(&cluster);
if (err)
- return;
+ goto out;
if (cluster.c_stack) {
/*
@@ -59,6 +59,8 @@ void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags)
*cluster_name = cluster.c_cluster;
*stack_flags = cluster.c_flags;
}
+out:
+ return err;
}
/* For ocfs2_fill_cluster_information(). Errors are to be ignored */
@@ -132,6 +134,7 @@ int ocfs2_fill_cluster_information(State *s)
uint8_t user_stack_flags, o2cb_stack_flags, disk_stack_flags;
int clusterinfo = 0, userspace = 0;
int ret = -1;
+ errcode_t err;
if (s->mount == MOUNT_LOCAL)
return 0;
@@ -139,7 +142,15 @@ int ocfs2_fill_cluster_information(State *s)
*user_value = *o2cb_value = *disk_value = '\0';
/* get currently active cluster stack */
- cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags);
+ err = cluster_fill(&o2cb_stack_name, &o2cb_cluster_name, &o2cb_stack_flags);
+ if (err && !s->cluster_stack) {
+ com_err(s->progname, 0, "Could not determine cluster "
+ "information.\nEither load the correct kernel module"
+ ", set the cluster_stack and start cluster "
+ "services, or provide --cluster-stack and "
+ "--cluster-name command line arguments.\n");
+ return -1;
+ }
/* get cluster stack configured on disk */
disk_fill(s->device_name, &disk_stack_name, &disk_cluster_name,
diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h
index 13b4fb5..ca2004c 100644
--- a/mkfs.ocfs2/mkfs.h
+++ b/mkfs.ocfs2/mkfs.h
@@ -243,6 +243,6 @@ struct _State {
};
int is_classic_stack(char *stack_name);
-void cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags);
+errcode_t cluster_fill(char **stack_name, char **cluster_name, uint8_t *stack_flags);
int ocfs2_fill_cluster_information(State *s);
int ocfs2_check_volume(State *s);
--
1.8.1.4

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 5 07:24:42 CDT 2013 - rgoldwyn@suse.com
- mkfs.ocfs2 aborts if cluster information is not found/supplied
+ 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
-------------------------------------------------------------------
Tue Sep 3 09:14:16 CDT 2013 - rgoldwyn@suse.com

View File

@ -53,7 +53,8 @@ Patch224: 0003-Get-cluster-name-from-corosync-cmap.patch
Patch225: 0004-Remove-controld-structures-from-debugfs.ocfs2.patch
Patch226: 0005-Check-for-DLM-kernel-version-in-user_begin_group_joi.patch
Patch227: 0006-Add-cmap-and-dlm-libraries-in-the-tools.patch
Patch229: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch
Patch228: 0008-mount.ocfs2-Read-stack-from-device-and-setup-stack-i.patch
Patch229: 0009-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch
BuildRequires: autoconf
BuildRequires: e2fsprogs-devel
@ -158,6 +159,7 @@ managing the file system.
%patch225 -p1
%patch226 -p1
%patch227 -p1
%patch228 -p1
%patch229 -p1
%build