[Ocfs2-tools-devel] [PATCH 6/6] Auto setup o2cb stack as default if no stack is setup

Goldwyn Rodrigues rgoldwyn at suse.de
Tue Feb 25 07:41:15 PST 2014


Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.com>
---
 libo2cb/o2cb_abi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c
index 4c3ef8c..0250c97 100644
--- a/libo2cb/o2cb_abi.c
+++ b/libo2cb/o2cb_abi.c
@@ -177,7 +177,9 @@ static errcode_t determine_stack(void)
 	ssize_t len;
 	char line[100];
 	errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE;
+	int setup_performed = 0;
 
+redo:
 	len = read_stack_file(line, sizeof(line));
 	if (len > 0) {
 		if (line[len - 1] == '\n') {
@@ -197,8 +199,11 @@ static errcode_t determine_stack(void)
 			err = 0;
 		}
 	} else if (len == -ENOENT) {
-		current_stack = &classic_stack;
-		err = 0;
+		if (!setup_performed) {
+			o2cb_setup_stack(OCFS2_CLASSIC_CLUSTER_STACK);
+			setup_performed = 1;
+			goto redo;
+		}
 	}
 
 	return err;
-- 
1.8.4


-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list