Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
ocfs2-tools.2690
0002-Remove-controld-dependency-in-group_join-l...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Remove-controld-dependency-in-group_join-leave.patch of Package ocfs2-tools.2690
From c8c1247f768241ad50ad9b0b6704b35697e0e051 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues <rgoldwyn@suse.com> Date: Fri, 27 Dec 2013 09:20:52 -0600 Subject: [PATCH] Remove controld dependency in group_join/leave --- libo2cb/o2cb_abi.c | 241 ++--------------------------------------------------- 1 file changed, 8 insertions(+), 233 deletions(-) diff --git a/libo2cb/o2cb_abi.c b/libo2cb/o2cb_abi.c index 6c3ad73..acebf4f 100644 --- a/libo2cb/o2cb_abi.c +++ b/libo2cb/o2cb_abi.c @@ -1373,253 +1373,28 @@ static errcode_t user_parse_status(char **args, int *error, char **error_msg) } static errcode_t user_begin_group_join(struct o2cb_cluster_desc *cluster, - struct o2cb_region_desc *region) + struct o2cb_region_desc *region) { - errcode_t err; - int rc; - int error; - char *error_msg; - client_message message; - char *argv[OCFS2_CONTROLD_MAXARGS + 1]; - char buf[OCFS2_CONTROLD_MAXLINE]; - - if (control_daemon_fd != -1) { - /* fprintf(stderr, "Join already in progress!\n"); */ - err = O2CB_ET_INTERNAL_FAILURE; - goto out; - } - - rc = ocfs2_client_connect(); - if (rc < 0) { - /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", - strerror(-rc)); */ - switch (rc) { - case -EACCES: - case -EPERM: - err = O2CB_ET_PERMISSION_DENIED; - break; - - default: - err = O2CB_ET_SERVICE_UNAVAILABLE; - break; - } - goto out; - } - control_daemon_fd = rc; - - rc = send_message(control_daemon_fd, CM_MOUNT, OCFS2_FS_NAME, - region->r_name, cluster->c_cluster, - region->r_device_name, region->r_service); - if (rc) { - /* fprintf(stderr, "Unable to send MOUNT message: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - rc = receive_message(control_daemon_fd, buf, &message, argv); - if (rc < 0) { - /* fprintf(stderr, "Error reading from daemon: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - switch (message) { - case CM_STATUS: - err = user_parse_status(argv, &error, &error_msg); - if (err) { - /* fprintf(stderr, "Bad status message: %s\n", - strerror(-rc)); */ - goto out; - } - if (error && (error != EALREADY)) { - /* fprintf(stderr, - "Error %d from daemon: %s\n", - error, error_msg); */ - err = O2CB_ET_CONFIGURATION_ERROR; - goto out; - } - break; - - default: - /* fprintf(stderr, - "Unexpected message %s from daemon\n", - message_to_string(message)); */ - err = O2CB_ET_INTERNAL_FAILURE; - goto out; - break; - } - - err = 0; + errcode_t ret = 0; -out: - if (err && (control_daemon_fd != -1)) { - close(control_daemon_fd); - control_daemon_fd = -1; - } + ret = o2cb_validate_cluster_name(cluster); + if (ret) + return ret; - return err; + return ret; } static errcode_t user_complete_group_join(struct o2cb_cluster_desc *cluster, struct o2cb_region_desc *region, int result) { - errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; - int rc; - int error; - char *error_msg; - client_message message; - char *argv[OCFS2_CONTROLD_MAXARGS + 1]; - char buf[OCFS2_CONTROLD_MAXLINE]; - - if (control_daemon_fd == -1) { - /* fprintf(stderr, "Join not started!\n"); */ - err = O2CB_ET_SERVICE_UNAVAILABLE; - goto out; - } - - rc = send_message(control_daemon_fd, CM_MRESULT, OCFS2_FS_NAME, - region->r_name, result, region->r_service); - if (rc) { - /* fprintf(stderr, "Unable to send MRESULT message: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - rc = receive_message(control_daemon_fd, buf, &message, argv); - if (rc < 0) { - /* fprintf(stderr, "Error reading from daemon: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - switch (message) { - case CM_STATUS: - err = user_parse_status(argv, &error, &error_msg); - if (err) { - /* fprintf(stderr, "Bad status message: %s\n", - strerror(-rc)); */ - goto out; - } - if (error) { - /* fprintf(stderr, - "Error %d from daemon: %s\n", - error, error_msg); */ - err = O2CB_ET_CONFIGURATION_ERROR; - } - break; - - default: - /* fprintf(stderr, - "Unexpected message %s from daemon\n", - message_to_string(message)); */ - err = O2CB_ET_INTERNAL_FAILURE; - goto out; - break; - } - - err = 0; - -out: - if (control_daemon_fd != -1) { - close(control_daemon_fd); - control_daemon_fd = -1; - } - - return err; + return 0; } static errcode_t user_group_leave(struct o2cb_cluster_desc *cluster, struct o2cb_region_desc *region) { - errcode_t err = O2CB_ET_SERVICE_UNAVAILABLE; - int rc; - int error; - char *error_msg; - client_message message; - char *argv[OCFS2_CONTROLD_MAXARGS + 1]; - char buf[OCFS2_CONTROLD_MAXLINE]; - - if (control_daemon_fd != -1) { - /* fprintf(stderr, "Join in progress!\n"); */ - err = O2CB_ET_INTERNAL_FAILURE; - goto out; - } - - rc = ocfs2_client_connect(); - if (rc < 0) { - /* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n", - strerror(-rc)); */ - switch (rc) { - case -EACCES: - case -EPERM: - err = O2CB_ET_PERMISSION_DENIED; - break; - - default: - err = O2CB_ET_SERVICE_UNAVAILABLE; - break; - } - goto out; - } - control_daemon_fd = rc; - - rc = send_message(control_daemon_fd, CM_UNMOUNT, OCFS2_FS_NAME, - region->r_name, region->r_service); - if (rc) { - /* fprintf(stderr, "Unable to send UNMOUNT message: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - rc = receive_message(control_daemon_fd, buf, &message, argv); - if (rc < 0) { - /* fprintf(stderr, "Error reading from daemon: %s\n", - strerror(-rc)); */ - err = O2CB_ET_IO; - goto out; - } - - switch (message) { - case CM_STATUS: - err = user_parse_status(argv, &error, &error_msg); - if (err) { - /* fprintf(stderr, "Bad status message: %s\n", - strerror(-rc)); */ - goto out; - } - if (error) { - /* fprintf(stderr, - "Error %d from daemon: %s\n", - error, error_msg); */ - err = O2CB_ET_CONFIGURATION_ERROR; - goto out; - } - break; - - default: - /* fprintf(stderr, - "Unexpected message %s from daemon\n", - message_to_string(message)); */ - err = O2CB_ET_INTERNAL_FAILURE; - goto out; - break; - } - - err = 0; - -out: - if (control_daemon_fd != -1) { - close(control_daemon_fd); - control_daemon_fd = -1; - } - - return err; + return 0; } static errcode_t o2cb_validate_cluster_flags(struct o2cb_cluster_desc *desc, -- 1.8.4.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor