forked from pool/ocfs2-tools
c9f09b5361
Upgrade ocfs2-tools to v1.8.5 OBS-URL: https://build.opensuse.org/request/show/478914 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=94
87 lines
2.8 KiB
Diff
87 lines
2.8 KiB
Diff
From f7ea242d2bf76c71cfe7fd9555d44c2486610486 Mon Sep 17 00:00:00 2001
|
|
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
|
|
Date: Fri, 27 Dec 2013 10:01:33 -0600
|
|
Subject: [PATCH] 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.4
|
|
|