summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/auth/addr/src/addr.c520
-rw-r--r--xlators/protocol/auth/login/src/login.c351
-rw-r--r--xlators/protocol/client/src/client-callback.c447
-rw-r--r--xlators/protocol/client/src/client-common.c4530
-rw-r--r--xlators/protocol/client/src/client-handshake.c2809
-rw-r--r--xlators/protocol/client/src/client-helpers.c5463
-rw-r--r--xlators/protocol/client/src/client-lk.c701
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c10503
-rw-r--r--xlators/protocol/client/src/client-rpc-fops_v2.c10469
-rw-r--r--xlators/protocol/client/src/client.c4377
-rw-r--r--xlators/protocol/server/src/authenticate.c327
-rw-r--r--xlators/protocol/server/src/server-common.c1166
-rw-r--r--xlators/protocol/server/src/server-handshake.c1730
-rw-r--r--xlators/protocol/server/src/server-helpers.c9811
-rw-r--r--xlators/protocol/server/src/server-resolve.c955
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c8890
-rw-r--r--xlators/protocol/server/src/server-rpc-fops_v2.c8434
-rw-r--r--xlators/protocol/server/src/server.c3086
18 files changed, 37033 insertions, 37536 deletions
diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c
index 88deb49a822..f64259e3c11 100644
--- a/xlators/protocol/auth/addr/src/addr.c
+++ b/xlators/protocol/auth/addr/src/addr.c
@@ -8,7 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
#include <fnmatch.h>
#include <sys/socket.h>
#include <netdb.h>
@@ -16,8 +15,8 @@
#include "dict.h"
#include "rpc-transport.h"
-#define ENTRY_DELIMITER ","
-#define ADDR_DELIMITER "|"
+#define ENTRY_DELIMITER ","
+#define ADDR_DELIMITER "|"
#define PRIVILEGED_PORT_CEILING 1024
#ifndef AF_INET_SDP
@@ -29,303 +28,306 @@
/* 1. '*'
2. '192.168.*'
3. '
- 4. '!10.10.1*' (Today as per the code, if negate is set on one entry, its never reset)
+ 4. '!10.10.1*' (Today as per the code, if negate is set on one entry, its
+ never reset)
5. '192.168.1.*, 10.1.10.*';168.168.2.* =/dir;* =/another-dir'
*/
int
-compare_addr_and_update (char *option_str, char *peer_addr, char *subvol,
- char *delimiter,
- auth_result_t *result, auth_result_t status)
+compare_addr_and_update(char *option_str, char *peer_addr, char *subvol,
+ char *delimiter, auth_result_t *result,
+ auth_result_t status)
{
- char *addr_str = NULL;
- char *tmp = NULL;
- char negate = 0;
- char match = 0;
- int length = 0;
- int ret = 0;
-
- addr_str = strtok_r (option_str, delimiter, &tmp);
-
- while (addr_str) {
- gf_log (subvol, GF_LOG_INFO,
- "%s = \"%s\", received addr = \"%s\"",
- (status == AUTH_ACCEPT) ? "allowed" : "rejected",
- addr_str, peer_addr);
- if (addr_str[0] == '!') {
- negate = 1;
- addr_str++;
- }
-
- length = strlen(addr_str);
- if ((addr_str[0] != '*') &&
- valid_host_name (addr_str, length)) {
- match = gf_is_same_address(addr_str, peer_addr);
- if (match) {
- *result = status;
- goto out;
- }
- } else {
- match = fnmatch (addr_str, peer_addr, 0);
- if (negate ? match : !match) {
- *result = status;
- goto out;
- }
- }
+ char *addr_str = NULL;
+ char *tmp = NULL;
+ char negate = 0;
+ char match = 0;
+ int length = 0;
+ int ret = 0;
+
+ addr_str = strtok_r(option_str, delimiter, &tmp);
+
+ while (addr_str) {
+ gf_log(subvol, GF_LOG_INFO, "%s = \"%s\", received addr = \"%s\"",
+ (status == AUTH_ACCEPT) ? "allowed" : "rejected", addr_str,
+ peer_addr);
+ if (addr_str[0] == '!') {
+ negate = 1;
+ addr_str++;
+ }
- addr_str = strtok_r (NULL, delimiter, &tmp);
+ length = strlen(addr_str);
+ if ((addr_str[0] != '*') && valid_host_name(addr_str, length)) {
+ match = gf_is_same_address(addr_str, peer_addr);
+ if (match) {
+ *result = status;
+ goto out;
+ }
+ } else {
+ match = fnmatch(addr_str, peer_addr, 0);
+ if (negate ? match : !match) {
+ *result = status;
+ goto out;
+ }
}
- ret = -1;
+ addr_str = strtok_r(NULL, delimiter, &tmp);
+ }
+
+ ret = -1;
out:
- return ret;
+ return ret;
}
-
void
-parse_entries_and_compare (char *option_str, char *peer_addr, char *subvol,
- char *subdir, auth_result_t *result, auth_result_t status)
+parse_entries_and_compare(char *option_str, char *peer_addr, char *subvol,
+ char *subdir, auth_result_t *result,
+ auth_result_t status)
{
- char *entry = NULL;
- char *entry_cpy = NULL;
- char *directory = NULL;
- char *entries = NULL;
- char *addr_str = NULL;
- char *addr = NULL;
- char *tmp = NULL;
- char *tmpdir = NULL;
- int ret = 0;
-
- if (!subdir) {
- gf_log (subvol, GF_LOG_WARNING,
- "subdir entry not present, not performing any operation.");
- goto out;
- }
-
- entries = gf_strdup (option_str);
- if (!entries)
- goto out;
-
- if (entries[0] != '/' && !strchr (entries, '(')) {
- /* Backward compatible option */
- ret = compare_addr_and_update (entries, peer_addr, subvol,
- ",", result, status);
- goto out;
+ char *entry = NULL;
+ char *entry_cpy = NULL;
+ char *directory = NULL;
+ char *entries = NULL;
+ char *addr_str = NULL;
+ char *addr = NULL;
+ char *tmp = NULL;
+ char *tmpdir = NULL;
+ int ret = 0;
+
+ if (!subdir) {
+ gf_log(subvol, GF_LOG_WARNING,
+ "subdir entry not present, not performing any operation.");
+ goto out;
+ }
+
+ entries = gf_strdup(option_str);
+ if (!entries)
+ goto out;
+
+ if (entries[0] != '/' && !strchr(entries, '(')) {
+ /* Backward compatible option */
+ ret = compare_addr_and_update(entries, peer_addr, subvol, ",", result,
+ status);
+ goto out;
+ }
+
+ entry = strtok_r(entries, ENTRY_DELIMITER, &tmp);
+ while (entry) {
+ entry_cpy = gf_strdup(entry);
+ if (!entry_cpy) {
+ goto out;
}
- entry = strtok_r (entries, ENTRY_DELIMITER, &tmp);
- while (entry) {
- entry_cpy = gf_strdup (entry);
- if (!entry_cpy) {
- goto out;
- }
-
- directory = strtok_r (entry_cpy, "(", &tmpdir);
- if (directory[0] != '/')
- goto out;
+ directory = strtok_r(entry_cpy, "(", &tmpdir);
+ if (directory[0] != '/')
+ goto out;
- /* send second portion, after ' =' if directory matches */
- if (strcmp (subdir, directory))
- goto next_entry;
+ /* send second portion, after ' =' if directory matches */
+ if (strcmp(subdir, directory))
+ goto next_entry;
- addr_str = strtok_r (NULL, ")", &tmpdir);
- if (!addr_str)
- goto out;
+ addr_str = strtok_r(NULL, ")", &tmpdir);
+ if (!addr_str)
+ goto out;
- addr = gf_strdup (addr_str);
- if (!addr)
- goto out;
+ addr = gf_strdup(addr_str);
+ if (!addr)
+ goto out;
- gf_log (subvol, GF_LOG_INFO, "Found an entry for dir %s (%s),"
- " performing validation", subdir, addr);
+ gf_log(subvol, GF_LOG_INFO,
+ "Found an entry for dir %s (%s),"
+ " performing validation",
+ subdir, addr);
- ret = compare_addr_and_update (addr, peer_addr, subvol,
- ADDR_DELIMITER, result, status);
- if (ret == 0) {
- break;
- }
+ ret = compare_addr_and_update(addr, peer_addr, subvol, ADDR_DELIMITER,
+ result, status);
+ if (ret == 0) {
+ break;
+ }
- GF_FREE (addr);
- addr = NULL;
+ GF_FREE(addr);
+ addr = NULL;
- next_entry:
- entry = strtok_r (NULL, ENTRY_DELIMITER, &tmp);
- GF_FREE (entry_cpy);
- entry_cpy = NULL;
- }
+ next_entry:
+ entry = strtok_r(NULL, ENTRY_DELIMITER, &tmp);
+ GF_FREE(entry_cpy);
+ entry_cpy = NULL;
+ }
out:
- GF_FREE (entries);
- GF_FREE (entry_cpy);
- GF_FREE (addr);
+ GF_FREE(entries);
+ GF_FREE(entry_cpy);
+ GF_FREE(addr);
}
auth_result_t
-gf_auth (dict_t *input_params, dict_t *config_params)
+gf_auth(dict_t *input_params, dict_t *config_params)
{
- auth_result_t result = AUTH_DONT_CARE;
- int ret = 0;
- char *name = NULL;
- char *searchstr = NULL;
- peer_info_t *peer_info = NULL;
- data_t *peer_info_data = NULL;
- data_t *allow_addr = NULL;
- data_t *reject_addr = NULL;
- char *service = NULL;
- uint16_t peer_port = 0;
- char peer_addr[UNIX_PATH_MAX] = {0,};
- char *type = NULL;
- gf_boolean_t allow_insecure = _gf_false;
- char *subdir = NULL;
-
- name = data_to_str (dict_get (input_params, "remote-subvolume"));
- if (!name) {
- gf_log ("authenticate/addr", GF_LOG_DEBUG,
- "remote-subvolume not specified");
- goto out;
- }
-
- ret = gf_asprintf (&searchstr, "auth.addr.%s.allow", name);
+ auth_result_t result = AUTH_DONT_CARE;
+ int ret = 0;
+ char *name = NULL;
+ char *searchstr = NULL;
+ peer_info_t *peer_info = NULL;
+ data_t *peer_info_data = NULL;
+ data_t *allow_addr = NULL;
+ data_t *reject_addr = NULL;
+ char *service = NULL;
+ uint16_t peer_port = 0;
+ char peer_addr[UNIX_PATH_MAX] = {
+ 0,
+ };
+ char *type = NULL;
+ gf_boolean_t allow_insecure = _gf_false;
+ char *subdir = NULL;
+
+ name = data_to_str(dict_get(input_params, "remote-subvolume"));
+ if (!name) {
+ gf_log("authenticate/addr", GF_LOG_DEBUG,
+ "remote-subvolume not specified");
+ goto out;
+ }
+
+ ret = gf_asprintf(&searchstr, "auth.addr.%s.allow", name);
+ if (-1 == ret) {
+ gf_log("auth/addr", GF_LOG_DEBUG,
+ "asprintf failed while setting search string");
+ goto out;
+ }
+
+ allow_addr = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ ret = gf_asprintf(&searchstr, "auth.addr.%s.reject", name);
+ if (-1 == ret) {
+ gf_log("auth/addr", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ goto out;
+ }
+ reject_addr = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ if (!allow_addr) {
+ /* TODO: backward compatibility */
+ ret = gf_asprintf(&searchstr, "auth.ip.%s.allow", name);
if (-1 == ret) {
- gf_log ("auth/addr", GF_LOG_DEBUG,
- "asprintf failed while setting search string");
- goto out;
+ gf_log("auth/addr", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ goto out;
}
-
- allow_addr = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
-
- ret = gf_asprintf (&searchstr, "auth.addr.%s.reject", name);
- if (-1 == ret) {
- gf_log ("auth/addr", GF_LOG_ERROR,
- "asprintf failed while setting search string");
- goto out;
- }
- reject_addr = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
-
- if (!allow_addr) {
- /* TODO: backward compatibility */
- ret = gf_asprintf (&searchstr, "auth.ip.%s.allow", name);
- if (-1 == ret) {
- gf_log ("auth/addr", GF_LOG_ERROR,
- "asprintf failed while setting search string");
- goto out;
- }
- allow_addr = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
- }
-
- if (!(allow_addr || reject_addr)) {
- gf_log ("auth/addr", GF_LOG_DEBUG,
- "none of the options auth.addr.%s.allow or "
- "auth.addr.%s.reject specified, returning auth_dont_care",
- name, name);
- goto out;
- }
-
- peer_info_data = dict_get (input_params, "peer-info");
- if (!peer_info_data) {
- gf_log ("auth/addr", GF_LOG_ERROR,
- "peer-info not present");
- goto out;
- }
-
-
- ret = dict_get_str (input_params, "subdir-mount", &subdir);
- if (ret) {
- subdir = "/";
- }
-
- peer_info = data_to_ptr (peer_info_data);
-
- switch (((struct sockaddr *) &peer_info->sockaddr)->sa_family) {
+ allow_addr = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+ }
+
+ if (!(allow_addr || reject_addr)) {
+ gf_log("auth/addr", GF_LOG_DEBUG,
+ "none of the options auth.addr.%s.allow or "
+ "auth.addr.%s.reject specified, returning auth_dont_care",
+ name, name);
+ goto out;
+ }
+
+ peer_info_data = dict_get(input_params, "peer-info");
+ if (!peer_info_data) {
+ gf_log("auth/addr", GF_LOG_ERROR, "peer-info not present");
+ goto out;
+ }
+
+ ret = dict_get_str(input_params, "subdir-mount", &subdir);
+ if (ret) {
+ subdir = "/";
+ }
+
+ peer_info = data_to_ptr(peer_info_data);
+
+ switch (((struct sockaddr *)&peer_info->sockaddr)->sa_family) {
case AF_INET_SDP:
case AF_INET:
case AF_INET6:
- strcpy (peer_addr, peer_info->identifier);
- service = strrchr (peer_addr, ':');
- *service = '\0';
- service++;
-
- ret = dict_get_str (config_params, "rpc-auth-allow-insecure",
- &type);
- if (ret == 0) {
- ret = gf_string2boolean (type, &allow_insecure);
- if (ret < 0) {
- gf_log ("auth/addr", GF_LOG_WARNING,
- "rpc-auth-allow-insecure option %s "
- "is not a valid bool option", type);
- goto out;
- }
+ strcpy(peer_addr, peer_info->identifier);
+ service = strrchr(peer_addr, ':');
+ *service = '\0';
+ service++;
+
+ ret = dict_get_str(config_params, "rpc-auth-allow-insecure", &type);
+ if (ret == 0) {
+ ret = gf_string2boolean(type, &allow_insecure);
+ if (ret < 0) {
+ gf_log("auth/addr", GF_LOG_WARNING,
+ "rpc-auth-allow-insecure option %s "
+ "is not a valid bool option",
+ type);
+ goto out;
}
-
- peer_port = atoi (service);
- if (peer_port >= PRIVILEGED_PORT_CEILING && !allow_insecure) {
- gf_log ("auth/addr", GF_LOG_ERROR,
- "client is bound to port %d which is not privileged",
- peer_port);
- result = AUTH_REJECT;
- goto out;
- }
- break;
+ }
+
+ peer_port = atoi(service);
+ if (peer_port >= PRIVILEGED_PORT_CEILING && !allow_insecure) {
+ gf_log("auth/addr", GF_LOG_ERROR,
+ "client is bound to port %d which is not privileged",
+ peer_port);
+ result = AUTH_REJECT;
+ goto out;
+ }
+ break;
case AF_UNIX:
- strcpy (peer_addr, peer_info->identifier);
- break;
+ strcpy(peer_addr, peer_info->identifier);
+ break;
default:
- gf_log ("authenticate/addr", GF_LOG_ERROR,
- "unknown address family %d",
- ((struct sockaddr *) &peer_info->sockaddr)->sa_family);
- goto out;
- }
-
- if (reject_addr) {
- parse_entries_and_compare (reject_addr->data, peer_addr, name,
- subdir, &result, AUTH_REJECT);
- if (result == AUTH_REJECT)
- goto out;
- }
-
- if (allow_addr) {
- parse_entries_and_compare (allow_addr->data, peer_addr, name,
- subdir, &result, AUTH_ACCEPT);
- }
+ gf_log("authenticate/addr", GF_LOG_ERROR,
+ "unknown address family %d",
+ ((struct sockaddr *)&peer_info->sockaddr)->sa_family);
+ goto out;
+ }
+
+ if (reject_addr) {
+ parse_entries_and_compare(reject_addr->data, peer_addr, name, subdir,
+ &result, AUTH_REJECT);
+ if (result == AUTH_REJECT)
+ goto out;
+ }
+
+ if (allow_addr) {
+ parse_entries_and_compare(allow_addr->data, peer_addr, name, subdir,
+ &result, AUTH_ACCEPT);
+ }
out:
- return result;
+ return result;
}
struct volume_options options[] = {
- { .key = {"auth.addr.*.allow"},
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .default_value = "*",
- .description = "List of addresses to be allowed to access volume",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .tags = {},
- /* option_validation_fn validate_fn; */
- },
- { .key = {"auth.addr.*.reject"},
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .default_value = "*",
- .description = "List of addresses to be rejected to access volume",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .tags = {},
- /* option_validation_fn validate_fn; */
- },
- /* Backward compatibility */
- { .key = {"auth.ip.*.allow"},
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .default_value = "*",
- .description = "List of addresses to be allowed to access volume",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .tags = {},
- /* option_validation_fn validate_fn; */
- },
- { .key = {NULL} }
-};
+ {
+ .key = {"auth.addr.*.allow"},
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .default_value = "*",
+ .description = "List of addresses to be allowed to access volume",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {},
+ /* option_validation_fn validate_fn; */
+ },
+ {
+ .key = {"auth.addr.*.reject"},
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .default_value = "*",
+ .description = "List of addresses to be rejected to access volume",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {},
+ /* option_validation_fn validate_fn; */
+ },
+ /* Backward compatibility */
+ {
+ .key = {"auth.ip.*.allow"},
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .default_value = "*",
+ .description = "List of addresses to be allowed to access volume",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {},
+ /* option_validation_fn validate_fn; */
+ },
+ {.key = {NULL}}};
diff --git a/xlators/protocol/auth/login/src/login.c b/xlators/protocol/auth/login/src/login.c
index 0403858d98f..64521267bfe 100644
--- a/xlators/protocol/auth/login/src/login.c
+++ b/xlators/protocol/auth/login/src/login.c
@@ -19,195 +19,192 @@
* - When using SSL names, this is automatically strict, and allows only those
* names that are present in the allow list, IOW strict auth checking has no
* implication when using SSL names
-*/
+ */
-auth_result_t gf_auth (dict_t *input_params, dict_t *config_params)
+auth_result_t
+gf_auth(dict_t *input_params, dict_t *config_params)
{
- auth_result_t result = AUTH_DONT_CARE;
- int ret = 0;
- data_t *allow_user = NULL;
- data_t *username_data = NULL;
- data_t *passwd_data = NULL;
- data_t *password_data = NULL;
- char *username = NULL;
- char *password = NULL;
- char *brick_name = NULL;
- char *searchstr = NULL;
- char *username_str = NULL;
- char *tmp = NULL;
- char *username_cpy = NULL;
- gf_boolean_t using_ssl = _gf_false;
- gf_boolean_t strict_auth = _gf_false;
-
- username_data = dict_get (input_params, "ssl-name");
- if (username_data) {
- gf_log ("auth/login", GF_LOG_INFO,
- "connecting user name: %s", username_data->data);
- using_ssl = _gf_true;
- }
- else {
- ret = dict_get_str_boolean (config_params, "strict-auth-accept",
- _gf_false);
- if (ret == -1)
- strict_auth = _gf_false;
- else
- strict_auth = ret;
-
- username_data = dict_get (input_params, "username");
- if (!username_data) {
- if (strict_auth) {
- gf_log ("auth/login", GF_LOG_DEBUG,
- "username not found, strict auth"
- " configured returning REJECT");
- result = AUTH_REJECT;
- } else {
- gf_log ("auth/login", GF_LOG_DEBUG,
- "username not found, returning"
- " DONT-CARE");
- }
- goto out;
- }
- password_data = dict_get (input_params, "password");
- if (!password_data) {
- if (strict_auth) {
- gf_log ("auth/login", GF_LOG_DEBUG,
- "password not found, strict auth"
- " configured returning REJECT");
- result = AUTH_REJECT;
- } else {
- gf_log ("auth/login", GF_LOG_WARNING,
- "password not found, returning"
- " DONT-CARE");
- }
- goto out;
- }
- password = data_to_str (password_data);
- }
- username = data_to_str (username_data);
-
- brick_name = data_to_str (dict_get (input_params, "remote-subvolume"));
- if (!brick_name) {
- gf_log ("auth/login", GF_LOG_ERROR,
- "remote-subvolume not specified");
+ auth_result_t result = AUTH_DONT_CARE;
+ int ret = 0;
+ data_t *allow_user = NULL;
+ data_t *username_data = NULL;
+ data_t *passwd_data = NULL;
+ data_t *password_data = NULL;
+ char *username = NULL;
+ char *password = NULL;
+ char *brick_name = NULL;
+ char *searchstr = NULL;
+ char *username_str = NULL;
+ char *tmp = NULL;
+ char *username_cpy = NULL;
+ gf_boolean_t using_ssl = _gf_false;
+ gf_boolean_t strict_auth = _gf_false;
+
+ username_data = dict_get(input_params, "ssl-name");
+ if (username_data) {
+ gf_log("auth/login", GF_LOG_INFO, "connecting user name: %s",
+ username_data->data);
+ using_ssl = _gf_true;
+ } else {
+ ret = dict_get_str_boolean(config_params, "strict-auth-accept",
+ _gf_false);
+ if (ret == -1)
+ strict_auth = _gf_false;
+ else
+ strict_auth = ret;
+
+ username_data = dict_get(input_params, "username");
+ if (!username_data) {
+ if (strict_auth) {
+ gf_log("auth/login", GF_LOG_DEBUG,
+ "username not found, strict auth"
+ " configured returning REJECT");
result = AUTH_REJECT;
- goto out;
+ } else {
+ gf_log("auth/login", GF_LOG_DEBUG,
+ "username not found, returning"
+ " DONT-CARE");
+ }
+ goto out;
}
-
- ret = gf_asprintf (&searchstr, "auth.login.%s.%s", brick_name,
- using_ssl ? "ssl-allow" : "allow");
- if (-1 == ret) {
- gf_log ("auth/login", GF_LOG_ERROR,
- "asprintf failed while setting search string, "
- "returning REJECT");
+ password_data = dict_get(input_params, "password");
+ if (!password_data) {
+ if (strict_auth) {
+ gf_log("auth/login", GF_LOG_DEBUG,
+ "password not found, strict auth"
+ " configured returning REJECT");
result = AUTH_REJECT;
- goto out;
+ } else {
+ gf_log("auth/login", GF_LOG_WARNING,
+ "password not found, returning"
+ " DONT-CARE");
+ }
+ goto out;
}
-
- allow_user = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
-
- if (allow_user) {
- gf_log ("auth/login", GF_LOG_INFO,
- "allowed user names: %s", allow_user->data);
- /*
- * There's a subtle difference between SSL and non-SSL behavior
- * if we can't match anything in the "while" loop below.
- * Intuitively, we should AUTH_REJECT if there's no match.
- * However, existing code depends on allowing untrusted users
- * to connect with *no credentials at all* by falling through
- * the loop. They're still distinguished from trusted users
- * who do provide a valid username and password (in fact that's
- * pretty much the only thing we use non-SSL login auth for),
- * but they are allowed to connect. It's wrong, but it's not
- * worth changing elsewhere. Therefore, we do the sane thing
- * only for SSL here.
- *
- * For SSL, if there's a list *you must be on it*. Note that
- * if there's no list we don't care. In that case (and the
- * ssl-allow=* case as well) authorization is effectively
- * disabled, though authentication and encryption are still
- * active.
- *
- * Read NOTE on strict_auth above.
- */
- if (using_ssl || strict_auth) {
- result = AUTH_REJECT;
+ password = data_to_str(password_data);
+ }
+ username = data_to_str(username_data);
+
+ brick_name = data_to_str(dict_get(input_params, "remote-subvolume"));
+ if (!brick_name) {
+ gf_log("auth/login", GF_LOG_ERROR, "remote-subvolume not specified");
+ result = AUTH_REJECT;
+ goto out;
+ }
+
+ ret = gf_asprintf(&searchstr, "auth.login.%s.%s", brick_name,
+ using_ssl ? "ssl-allow" : "allow");
+ if (-1 == ret) {
+ gf_log("auth/login", GF_LOG_ERROR,
+ "asprintf failed while setting search string, "
+ "returning REJECT");
+ result = AUTH_REJECT;
+ goto out;
+ }
+
+ allow_user = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ if (allow_user) {
+ gf_log("auth/login", GF_LOG_INFO, "allowed user names: %s",
+ allow_user->data);
+ /*
+ * There's a subtle difference between SSL and non-SSL behavior
+ * if we can't match anything in the "while" loop below.
+ * Intuitively, we should AUTH_REJECT if there's no match.
+ * However, existing code depends on allowing untrusted users
+ * to connect with *no credentials at all* by falling through
+ * the loop. They're still distinguished from trusted users
+ * who do provide a valid username and password (in fact that's
+ * pretty much the only thing we use non-SSL login auth for),
+ * but they are allowed to connect. It's wrong, but it's not
+ * worth changing elsewhere. Therefore, we do the sane thing
+ * only for SSL here.
+ *
+ * For SSL, if there's a list *you must be on it*. Note that
+ * if there's no list we don't care. In that case (and the
+ * ssl-allow=* case as well) authorization is effectively
+ * disabled, though authentication and encryption are still
+ * active.
+ *
+ * Read NOTE on strict_auth above.
+ */
+ if (using_ssl || strict_auth) {
+ result = AUTH_REJECT;
+ }
+ username_cpy = gf_strdup(allow_user->data);
+ if (!username_cpy)
+ goto out;
+
+ username_str = strtok_r(username_cpy, " ,", &tmp);
+
+ /*
+ * We have to match a user's *authenticated* name to one in the
+ * list. If we're using SSL, they're already authenticated.
+ * Otherwise, they need a matching password to complete the
+ * process.
+ */
+ while (username_str) {
+ if (!fnmatch(username_str, username, 0)) {
+ if (using_ssl) {
+ result = AUTH_ACCEPT;
+ break;
}
- username_cpy = gf_strdup (allow_user->data);
- if (!username_cpy)
- goto out;
-
- username_str = strtok_r (username_cpy, " ,", &tmp);
-
- /*
- * We have to match a user's *authenticated* name to one in the
- * list. If we're using SSL, they're already authenticated.
- * Otherwise, they need a matching password to complete the
- * process.
- */
- while (username_str) {
- if (!fnmatch (username_str, username, 0)) {
- if (using_ssl) {
- result = AUTH_ACCEPT;
- break;
- }
- ret = gf_asprintf (&searchstr,
- "auth.login.%s.password",
- username);
- if (-1 == ret) {
- gf_log ("auth/login", GF_LOG_WARNING,
- "asprintf failed while setting search string");
- goto out;
- }
- passwd_data = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
-
- if (!passwd_data) {
- gf_log ("auth/login", GF_LOG_ERROR,
- "wrong username/password combination");
- result = AUTH_REJECT;
- goto out;
- }
-
- result = !((strcmp (data_to_str (passwd_data),
- password)) ?
- AUTH_ACCEPT :
- AUTH_REJECT);
- if (result == AUTH_REJECT)
- gf_log ("auth/login", GF_LOG_ERROR,
- "wrong password for user %s",
- username);
-
- break;
- }
- username_str = strtok_r (NULL, " ,", &tmp);
+ ret = gf_asprintf(&searchstr, "auth.login.%s.password",
+ username);
+ if (-1 == ret) {
+ gf_log("auth/login", GF_LOG_WARNING,
+ "asprintf failed while setting search string");
+ goto out;
}
+ passwd_data = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ if (!passwd_data) {
+ gf_log("auth/login", GF_LOG_ERROR,
+ "wrong username/password combination");
+ result = AUTH_REJECT;
+ goto out;
+ }
+
+ result = !((strcmp(data_to_str(passwd_data), password))
+ ? AUTH_ACCEPT
+ : AUTH_REJECT);
+ if (result == AUTH_REJECT)
+ gf_log("auth/login", GF_LOG_ERROR,
+ "wrong password for user %s", username);
+
+ break;
+ }
+ username_str = strtok_r(NULL, " ,", &tmp);
}
+ }
out:
- GF_FREE (username_cpy);
+ GF_FREE(username_cpy);
- return result;
+ return result;
}
struct volume_options options[] = {
- { .key = {"auth.login.*.allow"},
- .type = GF_OPTION_TYPE_ANY,
- .default_value = "*",
- .description = "Username to be allowed access to the volume",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .tags = {},
- /* option_validation_fn validate_fn; */
- },
- { .key = {"auth.login.*.password"},
- .type = GF_OPTION_TYPE_ANY,
- .default_value = "*",
- .description = "Password for the allowed username",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .tags = {},
- /* option_validation_fn validate_fn; */
- },
- { .key = {NULL} }
-};
+ {
+ .key = {"auth.login.*.allow"},
+ .type = GF_OPTION_TYPE_ANY,
+ .default_value = "*",
+ .description = "Username to be allowed access to the volume",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {},
+ /* option_validation_fn validate_fn; */
+ },
+ {
+ .key = {"auth.login.*.password"},
+ .type = GF_OPTION_TYPE_ANY,
+ .default_value = "*",
+ .description = "Password for the allowed username",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {},
+ /* option_validation_fn validate_fn; */
+ },
+ {.key = {NULL}}};
diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c
index b2f9a225887..352a1130e14 100644
--- a/xlators/protocol/client/src/client-callback.c
+++ b/xlators/protocol/client/src/client-callback.c
@@ -14,277 +14,312 @@
#include "client-messages.h"
int
-client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_null(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_fetchspec(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_ino_flush(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_recall_lease (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_recall_lease(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_recall_lease rl_data = {0,};
- gfs3_recall_lease_req recall_lease = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &recall_lease,
- (xdrproc_t)xdr_gfs3_recall_lease_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_RECALL_LEASE_FAIL,
- "XDR decode of recall lease failed.");
- goto out;
- }
-
- upcall_data.data = &rl_data;
- ret = gf_proto_recall_lease_to_upcall (&recall_lease, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_RECALL_LEASE;
-
- gf_msg_trace (THIS->name, 0, "Upcall gfid = %s, ret = %d",
- recall_lease.gfid, ret);
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_recall_lease rl_data = {
+ 0,
+ };
+ gfs3_recall_lease_req recall_lease = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &recall_lease,
+ (xdrproc_t)xdr_gfs3_recall_lease_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_RECALL_LEASE_FAIL,
+ "XDR decode of recall lease failed.");
+ goto out;
+ }
+
+ upcall_data.data = &rl_data;
+ ret = gf_proto_recall_lease_to_upcall(&recall_lease, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_RECALL_LEASE;
+
+ gf_msg_trace(THIS->name, 0, "Upcall gfid = %s, ret = %d", recall_lease.gfid,
+ ret);
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (recall_lease.xdata.xdata_val)
- free (recall_lease.xdata.xdata_val);
+ if (recall_lease.xdata.xdata_val)
+ free(recall_lease.xdata.xdata_val);
- if (rl_data.dict)
- dict_unref (rl_data.dict);
+ if (rl_data.dict)
+ dict_unref(rl_data.dict);
- return ret;
+ return ret;
}
-
int
-client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_cache_invalidation(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_cache_invalidation ca_data = {0,};
- gfs3_cbk_cache_invalidation_req ca_req = {0,};
-
- gf_msg_trace (THIS->name, 0, "Upcall callback is called");
-
- if (!rpc || !mydata || !data)
- goto out;
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &ca_req,
- (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_CACHE_INVALIDATION_FAIL,
- "XDR decode of cache_invalidation failed.");
- goto out;
- }
-
- upcall_data.data = &ca_data;
- ret = gf_proto_cache_invalidation_to_upcall (THIS, &ca_req,
- &upcall_data);
- if (ret < 0)
- goto out;
-
- gf_msg_trace (THIS->name, 0, "Cache invalidation cbk received for gfid:"
- " %s, ret = %d", ca_req.gfid, ret);
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_cache_invalidation ca_data = {
+ 0,
+ };
+ gfs3_cbk_cache_invalidation_req ca_req = {
+ 0,
+ };
+
+ gf_msg_trace(THIS->name, 0, "Upcall callback is called");
+
+ if (!rpc || !mydata || !data)
+ goto out;
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &ca_req,
+ (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_CACHE_INVALIDATION_FAIL,
+ "XDR decode of cache_invalidation failed.");
+ goto out;
+ }
+
+ upcall_data.data = &ca_data;
+ ret = gf_proto_cache_invalidation_to_upcall(THIS, &ca_req, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ gf_msg_trace(THIS->name, 0,
+ "Cache invalidation cbk received for gfid:"
+ " %s, ret = %d",
+ ca_req.gfid, ret);
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (ca_req.gfid)
- free (ca_req.gfid);
+ if (ca_req.gfid)
+ free(ca_req.gfid);
- if (ca_req.xdata.xdata_val)
- free (ca_req.xdata.xdata_val);
+ if (ca_req.xdata.xdata_val)
+ free(ca_req.xdata.xdata_val);
- if (ca_data.dict)
- dict_unref (ca_data.dict);
+ if (ca_data.dict)
+ dict_unref(ca_data.dict);
- return 0;
+ return 0;
}
int
-client_cbk_child_up (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_child_up(struct rpc_clnt *rpc, void *mydata, void *data)
{
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, rpc, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, rpc, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- gf_msg_debug (this->name, 0, "Received CHILD_UP");
- conf->child_up = _gf_true;
+ gf_msg_debug(this->name, 0, "Received CHILD_UP");
+ conf->child_up = _gf_true;
- this->notify (this, GF_EVENT_CHILD_UP, NULL);
+ this->notify(this, GF_EVENT_CHILD_UP, NULL);
out:
- return 0;
+ return 0;
}
int
-client_cbk_child_down (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_child_down(struct rpc_clnt *rpc, void *mydata, void *data)
{
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, rpc, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, rpc, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- gf_msg_debug (this->name, 0, "Received CHILD_DOWN");
- conf->child_up = _gf_false;
+ gf_msg_debug(this->name, 0, "Received CHILD_DOWN");
+ conf->child_up = _gf_false;
- this->notify (this, GF_EVENT_CHILD_DOWN, NULL);
+ this->notify(this, GF_EVENT_CHILD_DOWN, NULL);
out:
- return 0;
+ return 0;
}
int
-client_cbk_inodelk_contention (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_inodelk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_inodelk_contention lc = {{0,},};
- gfs4_inodelk_contention_req proto_lc = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &proto_lc,
- (xdrproc_t)xdr_gfs4_inodelk_contention_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_INODELK_CONTENTION_FAIL,
- "XDR decode of inodelk contention failed.");
- goto out;
- }
-
- upcall_data.data = &lc;
- ret = gf_proto_inodelk_contention_to_upcall (&proto_lc, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_INODELK_CONTENTION;
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_inodelk_contention lc = {
+ {
+ 0,
+ },
+ };
+ gfs4_inodelk_contention_req proto_lc = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &proto_lc,
+ (xdrproc_t)xdr_gfs4_inodelk_contention_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_INODELK_CONTENTION_FAIL,
+ "XDR decode of inodelk contention failed.");
+ goto out;
+ }
+
+ upcall_data.data = &lc;
+ ret = gf_proto_inodelk_contention_to_upcall(&proto_lc, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_INODELK_CONTENTION;
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (proto_lc.domain)
- free (proto_lc.domain);
+ if (proto_lc.domain)
+ free(proto_lc.domain);
- if (proto_lc.xdata.xdata_val)
- free (proto_lc.xdata.xdata_val);
+ if (proto_lc.xdata.xdata_val)
+ free(proto_lc.xdata.xdata_val);
- if (lc.xdata)
- dict_unref (lc.xdata);
+ if (lc.xdata)
+ dict_unref(lc.xdata);
- return ret;
+ return ret;
}
int
-client_cbk_entrylk_contention (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_entrylk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_entrylk_contention lc = {0,};
- gfs4_entrylk_contention_req proto_lc = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &proto_lc,
- (xdrproc_t)xdr_gfs4_entrylk_contention_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_ENTRYLK_CONTENTION_FAIL,
- "XDR decode of entrylk contention failed.");
- goto out;
- }
-
- upcall_data.data = &lc;
- ret = gf_proto_entrylk_contention_to_upcall (&proto_lc, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_ENTRYLK_CONTENTION;
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_entrylk_contention lc = {
+ 0,
+ };
+ gfs4_entrylk_contention_req proto_lc = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &proto_lc,
+ (xdrproc_t)xdr_gfs4_entrylk_contention_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_ENTRYLK_CONTENTION_FAIL,
+ "XDR decode of entrylk contention failed.");
+ goto out;
+ }
+
+ upcall_data.data = &lc;
+ ret = gf_proto_entrylk_contention_to_upcall(&proto_lc, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_ENTRYLK_CONTENTION;
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (proto_lc.name)
- free (proto_lc.name);
+ if (proto_lc.name)
+ free(proto_lc.name);
- if (proto_lc.domain)
- free (proto_lc.domain);
+ if (proto_lc.domain)
+ free(proto_lc.domain);
- if (proto_lc.xdata.xdata_val)
- free (proto_lc.xdata.xdata_val);
+ if (proto_lc.xdata.xdata_val)
+ free(proto_lc.xdata.xdata_val);
- if (lc.xdata)
- dict_unref (lc.xdata);
+ if (lc.xdata)
+ dict_unref(lc.xdata);
- return ret;
+ return ret;
}
rpcclnt_cb_actor_t gluster_cbk_actors[GF_CBK_MAXVALUE] = {
- [GF_CBK_NULL] = {"NULL", GF_CBK_NULL, client_cbk_null },
- [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec },
- [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush },
- [GF_CBK_CACHE_INVALIDATION] = {"CACHE_INVALIDATION", GF_CBK_CACHE_INVALIDATION, client_cbk_cache_invalidation },
- [GF_CBK_CHILD_UP] = {"CHILD_UP", GF_CBK_CHILD_UP, client_cbk_child_up },
- [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", GF_CBK_CHILD_DOWN, client_cbk_child_down },
- [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", GF_CBK_RECALL_LEASE, client_cbk_recall_lease },
- [GF_CBK_INODELK_CONTENTION] = {"INODELK_CONTENTION", GF_CBK_INODELK_CONTENTION, client_cbk_inodelk_contention },
- [GF_CBK_ENTRYLK_CONTENTION] = {"ENTRYLK_CONTENTION", GF_CBK_ENTRYLK_CONTENTION, client_cbk_entrylk_contention },
+ [GF_CBK_NULL] = {"NULL", GF_CBK_NULL, client_cbk_null},
+ [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec},
+ [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush},
+ [GF_CBK_CACHE_INVALIDATION] = {"CACHE_INVALIDATION",
+ GF_CBK_CACHE_INVALIDATION,
+ client_cbk_cache_invalidation},
+ [GF_CBK_CHILD_UP] = {"CHILD_UP", GF_CBK_CHILD_UP, client_cbk_child_up},
+ [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", GF_CBK_CHILD_DOWN,
+ client_cbk_child_down},
+ [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", GF_CBK_RECALL_LEASE,
+ client_cbk_recall_lease},
+ [GF_CBK_INODELK_CONTENTION] = {"INODELK_CONTENTION",
+ GF_CBK_INODELK_CONTENTION,
+ client_cbk_inodelk_contention},
+ [GF_CBK_ENTRYLK_CONTENTION] = {"ENTRYLK_CONTENTION",
+ GF_CBK_ENTRYLK_CONTENTION,
+ client_cbk_entrylk_contention},
};
-
struct rpcclnt_cb_program gluster_cbk_prog = {
- .progname = "GlusterFS Callback",
- .prognum = GLUSTER_CBK_PROGRAM,
- .progver = GLUSTER_CBK_VERSION,
- .actors = gluster_cbk_actors,
- .numactors = GF_CBK_MAXVALUE,
+ .progname = "GlusterFS Callback",
+ .prognum = GLUSTER_CBK_PROGRAM,
+ .progver = GLUSTER_CBK_VERSION,
+ .actors = gluster_cbk_actors,
+ .numactors = GF_CBK_MAXVALUE,
};
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c
index c5b0322334b..31615516fcf 100644
--- a/xlators/protocol/client/src/client-common.c
+++ b/xlators/protocol/client/src/client-common.c
@@ -18,3630 +18,3538 @@
/* processing to be done before fops are woudn down */
int
-client_pre_stat (xlator_t *this, gfs3_stat_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_stat(xlator_t *this, gfs3_stat_req *req, loc_t *loc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readlink (xlator_t *this, gfs3_readlink_req *req, loc_t *loc,
- size_t size, dict_t *xdata)
+client_pre_readlink(xlator_t *this, gfs3_readlink_req *req, loc_t *loc,
+ size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->size = size;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->size = size;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mknod (xlator_t *this, gfs3_mknod_req *req, loc_t *loc,
- mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
+client_pre_mknod(xlator_t *this, gfs3_mknod_req *req, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->dev = rdev;
- req->umask = umask;
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->dev = rdev;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mkdir (xlator_t *this, gfs3_mkdir_req *req, loc_t *loc,
- mode_t mode, mode_t umask, dict_t *xdata)
+client_pre_mkdir(xlator_t *this, gfs3_mkdir_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_unlink (xlator_t *this, gfs3_unlink_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_unlink(xlator_t *this, gfs3_unlink_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rmdir (xlator_t *this, gfs3_rmdir_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_rmdir(xlator_t *this, gfs3_rmdir_req *req, loc_t *loc, int32_t flags,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_symlink (xlator_t *this, gfs3_symlink_req *req, loc_t *loc,
- const char *linkname, mode_t umask, dict_t *xdata)
+client_pre_symlink(xlator_t *this, gfs3_symlink_req *req, loc_t *loc,
+ const char *linkname, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->linkname = (char *)linkname;
- req->bname = (char *)loc->name;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->linkname = (char *)linkname;
+ req->bname = (char *)loc->name;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rename (xlator_t *this, gfs3_rename_req *req, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_pre_rename(xlator_t *this, gfs3_rename_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && newloc && oldloc->parent &&
- newloc->parent))
- goto out;
+ if (!(oldloc && newloc && oldloc->parent && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->parent->gfid))
- memcpy (req->oldgfid, oldloc->parent->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->pargfid, 16);
+ if (!gf_uuid_is_null(oldloc->parent->gfid))
+ memcpy(req->oldgfid, oldloc->parent->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->pargfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->oldbname = (char *)oldloc->name;
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->oldbname = (char *)oldloc->name;
+ req->newbname = (char *)newloc->name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_link (xlator_t *this,
- gfs3_link_req *req, loc_t *oldloc, loc_t *newloc,
- dict_t *xdata)
+client_pre_link(xlator_t *this, gfs3_link_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && oldloc->inode && newloc &&
- newloc->parent))
- goto out;
+ if (!(oldloc && oldloc->inode && newloc && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->inode->gfid))
- memcpy (req->oldgfid, oldloc->inode->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->gfid, 16);
+ if (!gf_uuid_is_null(oldloc->inode->gfid))
+ memcpy(req->oldgfid, oldloc->inode->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->gfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->newbname = (char *)newloc->name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_truncate (xlator_t *this, gfs3_truncate_req *req,
- loc_t *loc, off_t offset, dict_t *xdata)
+client_pre_truncate(xlator_t *this, gfs3_truncate_req *req, loc_t *loc,
+ off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->offset = offset;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_open (xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_open(xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->flags = gf_flags_from_flags (flags);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->flags = gf_flags_from_flags(flags);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readv (xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size,
- off_t offset, int32_t flags, dict_t *xdata)
+client_pre_readv(xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_writev (xlator_t *this, gfs3_write_req *req,
- fd_t *fd, size_t size, off_t offset, int32_t flags,
- dict_t **xdata)
+client_pre_writev(xlator_t *this, gfs3_write_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t **xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
#ifdef GF_TESTING_IO_XDATA
- if (!*xdata)
- *xdata = dict_new ();
+ if (!*xdata)
+ *xdata = dict_new();
- ret = dict_set_str (*xdata, "testing-the-xdata-key",
- "testing-the-xdata-value");
+ ret = dict_set_str(*xdata, "testing-the-xdata-key",
+ "testing-the-xdata-value");
#endif
- GF_PROTOCOL_DICT_SERIALIZE (this, *xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, *xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_statfs (xlator_t *this, gfs3_statfs_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_statfs(xlator_t *this, gfs3_statfs_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc)
- goto out;
+ if (!loc)
+ goto out;
- if (loc->inode) {
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
- } else {
- req->gfid[15] = 1;
- }
+ if (loc->inode) {
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
+ } else {
+ req->gfid[15] = 1;
+ }
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_flush (xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata)
+client_pre_flush(xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsync (xlator_t *this, gfs3_fsync_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsync(xlator_t *this, gfs3_fsync_req *req, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = 0;
+ int64_t remote_fd = -1;
+ int op_errno = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setxattr (xlator_t *this, gfs3_setxattr_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_setxattr(xlator_t *this, gfs3_setxattr_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- req->flags = flags;
+ req->flags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_getxattr (xlator_t *this, gfs3_getxattr_req *req, loc_t *loc,
- const char *name, dict_t *xdata)
+client_pre_getxattr(xlator_t *this, gfs3_getxattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc) {
- op_errno = EINVAL;
- goto out;
- }
+ if (!loc) {
+ op_errno = EINVAL;
+ goto out;
+ }
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->namelen = 1; /* Use it as a flag */
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->namelen = 1; /* Use it as a flag */
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_removexattr (xlator_t *this, gfs3_removexattr_req *req,
- loc_t *loc, const char *name, dict_t *xdata)
+client_pre_removexattr(xlator_t *this, gfs3_removexattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->name = (char *)name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->name = (char *)name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_opendir (xlator_t *this,
- gfs3_opendir_req *req, loc_t *loc,
- fd_t *fd, dict_t *xdata)
+client_pre_opendir(xlator_t *this, gfs3_opendir_req *req, loc_t *loc, fd_t *fd,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsyncdir (xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsyncdir(xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int32_t op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int32_t op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_access (xlator_t *this, gfs3_access_req *req, loc_t *loc,
- int32_t mask, dict_t *xdata)
+client_pre_access(xlator_t *this, gfs3_access_req *req, loc_t *loc,
+ int32_t mask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->mask = mask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->mask = mask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_create (xlator_t *this, gfs3_create_req *req,
- loc_t *loc, fd_t *fd, mode_t mode,
- int32_t flags, mode_t umask, dict_t *xdata)
+client_pre_create(xlator_t *this, gfs3_create_req *req, loc_t *loc, fd_t *fd,
+ mode_t mode, int32_t flags, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->flags = gf_flags_from_flags (flags);
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->flags = gf_flags_from_flags(flags);
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ftruncate (xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd,
- off_t offset, dict_t *xdata)
+client_pre_ftruncate(xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = EINVAL;
+ int64_t remote_fd = -1;
+ int op_errno = EINVAL;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fstat (xlator_t *this, gfs3_fstat_req *req, fd_t *fd,
- dict_t *xdata)
+client_pre_fstat(xlator_t *this, gfs3_fstat_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lk (xlator_t *this, gfs3_lk_req *req,
- int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata)
+client_pre_lk(xlator_t *this, gfs3_lk_req *req, int32_t cmd,
+ struct gf_flock *flock, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
- int ret = 0;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
+ int ret = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- ret = client_cmd_to_gf_cmd (cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
+ ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
- switch (flock->l_type) {
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lookup (xlator_t *this, gfs3_lookup_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_lookup(xlator_t *this, gfs3_lookup_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if ((loc->parent) && (!gf_uuid_is_null (loc->parent->gfid)))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- if ((loc->inode) && (!gf_uuid_is_null (loc->inode->gfid)))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if ((loc->parent) && (!gf_uuid_is_null(loc->parent->gfid)))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ if ((loc->inode) && (!gf_uuid_is_null(loc->inode->gfid)))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- if (loc->name)
- req->bname = (char *)loc->name;
- else
- req->bname = "";
+ if (loc->name)
+ req->bname = (char *)loc->name;
+ else
+ req->bname = "";
- if (xdata) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata,
- (&req->xdata.xdata_val),
- req->xdata.xdata_len,
- op_errno, out);
- }
- return 0;
+ if (xdata) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ }
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdir (xlator_t *this, gfs3_readdir_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdir(xlator_t *this, gfs3_readdir_req *req, fd_t *fd, size_t size,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_inodelk (xlator_t *this, gfs3_inodelk_req *req, loc_t *loc,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_inodelk(xlator_t *this, gfs3_inodelk_req *req, loc_t *loc, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- op_errno = EINVAL;
- goto out;
- }
-
- switch (flock->l_type) {
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->volume = (char *)volume;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_finodelk (xlator_t *this, gfs3_finodelk_req *req, fd_t *fd,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_finodelk(xlator_t *this, gfs3_finodelk_req *req, fd_t *fd, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
- int32_t gf_type = 0;
- int32_t gf_cmd = 0;
-
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
-
- switch (flock->l_type) {
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int32_t gf_type = 0;
+ int32_t gf_cmd = 0;
+
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->volume = (char *)volume;
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_entrylk (xlator_t *this, gfs3_entrylk_req *req, loc_t *loc,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_entrylk(xlator_t *this, gfs3_entrylk_req *req, loc_t *loc,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fentrylk (xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_fentrylk(xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_xattrop (xlator_t *this, gfs3_xattrop_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_xattrop(xlator_t *this, gfs3_xattrop_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- req->flags = flags;
+ req->flags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fxattrop (xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd,
+client_pre_fxattrop(xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd,
dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fgetxattr (xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fgetxattr(xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->namelen = 1; /* Use it as a flag */
- req->fd = remote_fd;
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->namelen = 1; /* Use it as a flag */
+ req->fd = remote_fd;
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetxattr (xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd,
- int32_t flags, dict_t *xattr, dict_t *xdata)
+client_pre_fsetxattr(xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd,
+ int32_t flags, dict_t *xattr, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rchecksum (xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd,
- int32_t len, off_t offset, dict_t *xdata)
+client_pre_rchecksum(xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd,
+ int32_t len, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->len = len;
- req->offset = offset;
- req->fd = remote_fd;
+ req->len = len;
+ req->offset = offset;
+ req->fd = remote_fd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setattr (xlator_t *this, gfs3_setattr_req *req, loc_t *loc,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_setattr(xlator_t *this, gfs3_setattr_req *req, loc_t *loc,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- return -op_errno;
+ if (!(loc && loc->inode))
+ return -op_errno;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- req->valid = valid;
- gf_stat_from_iatt (&req->stbuf, stbuf);
+ req->valid = valid;
+ gf_stat_from_iatt(&req->stbuf, stbuf);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetattr (xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_fsetattr(xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->valid = valid;
- gf_stat_from_iatt (&req->stbuf, stbuf);
+ req->fd = remote_fd;
+ req->valid = valid;
+ gf_stat_from_iatt(&req->stbuf, stbuf);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdirp (xlator_t *this, gfs3_readdirp_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdirp(xlator_t *this, gfs3_readdirp_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- /* dict itself is 'xdata' here */
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->dict.dict_val),
- req->dict.dict_len, op_errno, out);
+ /* dict itself is 'xdata' here */
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fremovexattr (xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fremovexattr(xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- if (!(fd && fd->inode))
- goto out;
+ if (!(fd && fd->inode))
+ goto out;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->name = (char *)name;
- req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->name = (char *)name;
+ req->fd = remote_fd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fallocate (xlator_t *this, gfs3_fallocate_req *req, fd_t *fd,
- int32_t flags, off_t offset, size_t size, dict_t *xdata)
+client_pre_fallocate(xlator_t *this, gfs3_fallocate_req *req, fd_t *fd,
+ int32_t flags, off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_discard (xlator_t *this, gfs3_discard_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_discard(xlator_t *this, gfs3_discard_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_zerofill (xlator_t *this, gfs3_zerofill_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_zerofill(xlator_t *this, gfs3_zerofill_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ipc (xlator_t *this, gfs3_ipc_req *req, int32_t cmd,
- dict_t *xdata)
+client_pre_ipc(xlator_t *this, gfs3_ipc_req *req, int32_t cmd, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- req->op = cmd;
+ req->op = cmd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_seek (xlator_t *this, gfs3_seek_req *req, fd_t *fd,
- off_t offset, gf_seek_what_t what, dict_t *xdata)
+client_pre_seek(xlator_t *this, gfs3_seek_req *req, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->offset = offset;
- req->what = what;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->what = what;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lease (xlator_t *this, gfs3_lease_req *req, loc_t *loc,
- struct gf_lease *lease, dict_t *xdata)
+client_pre_lease(xlator_t *this, gfs3_lease_req *req, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- gf_proto_lease_from_lease (&req->lease, lease);
+ gf_proto_lease_from_lease(&req->lease, lease);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
/* processing done after fop responses are obtained */
int
-client_post_stat (xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt,
- dict_t **xdata)
+client_post_stat(xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, iatt);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readlink (xlator_t *this, gfs3_readlink_rsp *rsp,
- struct iatt *iatt, dict_t **xdata)
+client_post_readlink(xlator_t *this, gfs3_readlink_rsp *rsp, struct iatt *iatt,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->buf, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->buf, iatt);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_mknod (xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_mknod(xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_mkdir (xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_mkdir(xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_unlink (xlator_t *this, gfs3_unlink_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_unlink(xlator_t *this, gfs3_unlink_rsp *rsp, struct iatt *preparent,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_rmdir (xlator_t *this, gfs3_rmdir_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_rmdir(xlator_t *this, gfs3_rmdir_rsp *rsp, struct iatt *preparent,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_symlink (xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_symlink(xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_rename (xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf,
+client_post_rename(xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf,
struct iatt *preoldparent, struct iatt *postoldparent,
struct iatt *prenewparent, struct iatt *postnewparent,
dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preoldparent, preoldparent);
- gf_stat_to_iatt (&rsp->postoldparent, postoldparent);
+ gf_stat_to_iatt(&rsp->preoldparent, preoldparent);
+ gf_stat_to_iatt(&rsp->postoldparent, postoldparent);
- gf_stat_to_iatt (&rsp->prenewparent, prenewparent);
- gf_stat_to_iatt (&rsp->postnewparent, postnewparent);
- }
+ gf_stat_to_iatt(&rsp->prenewparent, prenewparent);
+ gf_stat_to_iatt(&rsp->postnewparent, postnewparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_link (xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_link(xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_truncate (xlator_t *this, gfs3_truncate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_truncate(xlator_t *this, gfs3_truncate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_open (xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata)
+client_post_open(xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readv (xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref,
- struct iobref *rsp_iobref, struct iatt *stat,
- struct iovec *vector, struct iovec *rsp_vector,
- int *rspcount, dict_t **xdata)
+client_post_readv(xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref,
+ struct iobref *rsp_iobref, struct iatt *stat,
+ struct iovec *vector, struct iovec *rsp_vector, int *rspcount,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret != -1) {
- *iobref = rsp_iobref;
- gf_stat_to_iatt (&rsp->stat, stat);
+ if (rsp->op_ret != -1) {
+ *iobref = rsp_iobref;
+ gf_stat_to_iatt(&rsp->stat, stat);
- vector[0].iov_len = rsp->op_ret;
- if (rsp->op_ret > 0)
- vector[0].iov_base = rsp_vector->iov_base;
- *rspcount = 1;
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ vector[0].iov_len = rsp->op_ret;
+ if (rsp->op_ret > 0)
+ vector[0].iov_base = rsp_vector->iov_base;
+ *rspcount = 1;
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (xdata);
+ dict_dump_to_log(xdata);
#endif
out:
- return ret;
+ return ret;
}
int
-client_post_writev (xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat,
- struct iatt *poststat, dict_t **xdata)
+client_post_writev(xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_statfs (xlator_t *this, gfs3_statfs_rsp *rsp,
- struct statvfs *statfs, dict_t **xdata)
+client_post_statfs(xlator_t *this, gfs3_statfs_rsp *rsp, struct statvfs *statfs,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_statfs_to_statfs (&rsp->statfs, statfs);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_statfs_to_statfs(&rsp->statfs, statfs);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_flush (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_flush(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsync (xlator_t *this, gfs3_fsync_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fsync(xlator_t *this, gfs3_fsync_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_setxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_setxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_getxattr (xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_getxattr(xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_removexattr (xlator_t *this, gf_common_rsp *rsp,
- dict_t **xdata)
+client_post_removexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_opendir (xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata)
+client_post_opendir(xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsyncdir (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fsyncdir(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_access (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_access(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_create (xlator_t *this, gfs3_create_rsp *rsp,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent,
- clnt_local_t *local, dict_t **xdata)
+client_post_create(xlator_t *this, gfs3_create_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ clnt_local_t *local, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ gf_uuid_copy(local->loc.gfid, stbuf->ia_gfid);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_ftruncate (xlator_t *this, gfs3_ftruncate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_ftruncate(xlator_t *this, gfs3_ftruncate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fstat (xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat,
- dict_t **xdata)
+client_post_fstat(xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return -ret;
+ return -ret;
}
int
-client_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock,
- dict_t **xdata)
+client_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret >= 0) {
- gf_proto_flock_to_flock (&rsp->flock, lock);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (rsp->op_ret >= 0) {
+ gf_proto_flock_to_flock(&rsp->flock, lock);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_lookup (xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
- struct iatt *postparent, dict_t **xdata)
+client_post_lookup(xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->postparent, postparent);
- gf_stat_to_iatt (&rsp->stat, stbuf);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readdir (xlator_t *this, gfs3_readdir_rsp *rsp,
- gf_dirent_t *entries, dict_t **xdata)
+client_post_readdir(xlator_t *this, gfs3_readdir_rsp *rsp, gf_dirent_t *entries,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret > 0) {
- unserialize_rsp_dirent (this, rsp, entries);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_dirent(this, rsp, entries);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_inodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_inodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_finodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_finodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_entrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_entrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fentrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fentrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_xattrop (xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_xattrop(xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fxattrop (xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_fxattrop(xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fgetxattr (xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict,
+client_post_fgetxattr(xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict,
dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fsetxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fsetxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_rchecksum (xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata)
+client_post_rchecksum(xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_setattr (xlator_t *this, gfs3_setattr_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_setattr(xlator_t *this, gfs3_setattr_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsetattr (xlator_t *this, gfs3_fsetattr_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fsetattr(xlator_t *this, gfs3_fsetattr_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readdirp (xlator_t *this, gfs3_readdirp_rsp *rsp,
- fd_t *fd, gf_dirent_t *entries,
- dict_t **xdata)
+client_post_readdirp(xlator_t *this, gfs3_readdirp_rsp *rsp, fd_t *fd,
+ gf_dirent_t *entries, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret > 0) {
- unserialize_rsp_direntp (this, fd, rsp, entries);
- }
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_direntp(this, fd, rsp, entries);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fremovexattr (xlator_t *this, gf_common_rsp *rsp,
- dict_t **xdata)
+client_post_fremovexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_fallocate (xlator_t *this, gfs3_fallocate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fallocate(xlator_t *this, gfs3_fallocate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_discard (xlator_t *this, gfs3_discard_rsp *rsp,
- struct iatt *prestat,
- struct iatt *poststat, dict_t **xdata)
+client_post_discard(xlator_t *this, gfs3_discard_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_zerofill (xlator_t *this, gfs3_zerofill_rsp *rsp,
+client_post_zerofill(xlator_t *this, gfs3_zerofill_rsp *rsp,
struct iatt *prestat, struct iatt *poststat,
dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_ipc (xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata)
+client_post_ipc(xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_seek (xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata)
+client_post_seek(xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_lease (xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease,
- dict_t **xdata)
+client_post_lease(xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret >= 0) {
- gf_proto_lease_to_lease (&rsp->lease, lease);
- }
+ if (rsp->op_ret >= 0) {
+ gf_proto_lease_to_lease(&rsp->lease, lease);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
-
/* New PRE and POST functions */
int
-client_post_common_iatt (xlator_t *this, gfx_common_iatt_rsp *rsp, struct iatt *iatt,
- dict_t **xdata)
+client_post_common_iatt(xlator_t *this, gfx_common_iatt_rsp *rsp,
+ struct iatt *iatt, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, iatt);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_2iatt (xlator_t *this, gfx_common_2iatt_rsp *rsp, struct iatt *iatt,
- struct iatt *iatt2, dict_t **xdata)
+client_post_common_2iatt(xlator_t *this, gfx_common_2iatt_rsp *rsp,
+ struct iatt *iatt, struct iatt *iatt2, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->prestat, iatt);
- gfx_stat_to_iattx (&rsp->poststat, iatt2);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->prestat, iatt);
+ gfx_stat_to_iattx(&rsp->poststat, iatt2);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_3iatt (xlator_t *this, gfx_common_3iatt_rsp *rsp, struct iatt *iatt,
- struct iatt *iatt2, struct iatt *iatt3, dict_t **xdata)
+client_post_common_3iatt(xlator_t *this, gfx_common_3iatt_rsp *rsp,
+ struct iatt *iatt, struct iatt *iatt2,
+ struct iatt *iatt3, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, iatt);
- gfx_stat_to_iattx (&rsp->preparent, iatt2);
- gfx_stat_to_iattx (&rsp->postparent, iatt3);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, iatt);
+ gfx_stat_to_iattx(&rsp->preparent, iatt2);
+ gfx_stat_to_iattx(&rsp->postparent, iatt3);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_dict (xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_common_dict(xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int ret = 0;
- ret = xdr_to_dict (&rsp->dict, dict);
- if (ret)
- gf_msg_debug (this->name, EINVAL,
- "while decoding found empty dictionary");
- xdr_to_dict (&rsp->xdata, xdata);
+ int ret = 0;
+ ret = xdr_to_dict(&rsp->dict, dict);
+ if (ret)
+ gf_msg_debug(this->name, EINVAL,
+ "while decoding found empty dictionary");
+ xdr_to_dict(&rsp->xdata, xdata);
- return ret;
+ return ret;
}
int
-client_post_readv_v2 (xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref,
- struct iobref *rsp_iobref, struct iatt *stat,
- struct iovec *vector, struct iovec *rsp_vector,
- int *rspcount, dict_t **xdata)
+client_post_readv_v2(xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref,
+ struct iobref *rsp_iobref, struct iatt *stat,
+ struct iovec *vector, struct iovec *rsp_vector,
+ int *rspcount, dict_t **xdata)
{
- int ret = -1;
+ int ret = -1;
- if (rsp->op_ret != -1) {
- *iobref = rsp_iobref;
- gfx_stat_to_iattx (&rsp->stat, stat);
+ if (rsp->op_ret != -1) {
+ *iobref = rsp_iobref;
+ gfx_stat_to_iattx(&rsp->stat, stat);
- vector[0].iov_len = rsp->op_ret;
- if (rsp->op_ret > 0)
- vector[0].iov_base = rsp_vector->iov_base;
- *rspcount = 1;
- }
+ vector[0].iov_len = rsp->op_ret;
+ if (rsp->op_ret > 0)
+ vector[0].iov_base = rsp_vector->iov_base;
+ *rspcount = 1;
+ }
- ret = xdr_to_dict (&rsp->xdata, xdata);
+ ret = xdr_to_dict(&rsp->xdata, xdata);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (xdata);
+ dict_dump_to_log(xdata);
#endif
- return ret;
+ return ret;
}
int
-client_pre_stat_v2 (xlator_t *this, gfx_stat_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_stat_v2(xlator_t *this, gfx_stat_req *req, loc_t *loc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readlink_v2 (xlator_t *this, gfx_readlink_req *req, loc_t *loc,
- size_t size, dict_t *xdata)
+client_pre_readlink_v2(xlator_t *this, gfx_readlink_req *req, loc_t *loc,
+ size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->size = size;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->size = size;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mknod_v2 (xlator_t *this, gfx_mknod_req *req, loc_t *loc,
- mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
+client_pre_mknod_v2(xlator_t *this, gfx_mknod_req *req, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->dev = rdev;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->dev = rdev;
+ req->umask = umask;
+ dict_to_xdr(xdata, &req->xdata);
- dict_to_xdr (xdata, &req->xdata);
-
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mkdir_v2 (xlator_t *this, gfx_mkdir_req *req, loc_t *loc,
- mode_t mode, mode_t umask, dict_t *xdata)
+client_pre_mkdir_v2(xlator_t *this, gfx_mkdir_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_unlink_v2 (xlator_t *this, gfx_unlink_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_unlink_v2(xlator_t *this, gfx_unlink_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rmdir_v2 (xlator_t *this, gfx_rmdir_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_rmdir_v2(xlator_t *this, gfx_rmdir_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_symlink_v2 (xlator_t *this, gfx_symlink_req *req, loc_t *loc,
- const char *linkname, mode_t umask, dict_t *xdata)
+client_pre_symlink_v2(xlator_t *this, gfx_symlink_req *req, loc_t *loc,
+ const char *linkname, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->linkname = (char *)linkname;
- req->bname = (char *)loc->name;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->linkname = (char *)linkname;
+ req->bname = (char *)loc->name;
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rename_v2 (xlator_t *this, gfx_rename_req *req, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_pre_rename_v2(xlator_t *this, gfx_rename_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && newloc && oldloc->parent &&
- newloc->parent))
- goto out;
+ if (!(oldloc && newloc && oldloc->parent && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->parent->gfid))
- memcpy (req->oldgfid, oldloc->parent->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->pargfid, 16);
+ if (!gf_uuid_is_null(oldloc->parent->gfid))
+ memcpy(req->oldgfid, oldloc->parent->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->pargfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->oldbname = (char *)oldloc->name;
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->oldbname = (char *)oldloc->name;
+ req->newbname = (char *)newloc->name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_link_v2 (xlator_t *this,
- gfx_link_req *req, loc_t *oldloc, loc_t *newloc,
- dict_t *xdata)
+client_pre_link_v2(xlator_t *this, gfx_link_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && oldloc->inode && newloc &&
- newloc->parent))
- goto out;
+ if (!(oldloc && oldloc->inode && newloc && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->inode->gfid))
- memcpy (req->oldgfid, oldloc->inode->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->gfid, 16);
+ if (!gf_uuid_is_null(oldloc->inode->gfid))
+ memcpy(req->oldgfid, oldloc->inode->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->gfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->newbname = (char *)newloc->name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_truncate_v2 (xlator_t *this, gfx_truncate_req *req,
- loc_t *loc, off_t offset, dict_t *xdata)
+client_pre_truncate_v2(xlator_t *this, gfx_truncate_req *req, loc_t *loc,
+ off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->offset = offset;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_open_v2 (xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_open_v2(xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->flags = gf_flags_from_flags (flags);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->flags = gf_flags_from_flags(flags);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readv_v2 (xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size,
- off_t offset, int32_t flags, dict_t *xdata)
+client_pre_readv_v2(xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_writev_v2 (xlator_t *this, gfx_write_req *req,
- fd_t *fd, size_t size, off_t offset, int32_t flags,
- dict_t **xdata)
+client_pre_writev_v2(xlator_t *this, gfx_write_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t **xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
#ifdef GF_TESTING_IO_XDATA
- if (!*xdata)
- *xdata = dict_new ();
+ if (!*xdata)
+ *xdata = dict_new();
- ret = dict_set_str (*xdata, "testing-the-xdata-key",
- "testing-the-xdata-value");
+ ret = dict_set_str(*xdata, "testing-the-xdata-key",
+ "testing-the-xdata-value");
#endif
- dict_to_xdr (*xdata, &req->xdata);
+ dict_to_xdr(*xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_statfs_v2 (xlator_t *this, gfx_statfs_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_statfs_v2(xlator_t *this, gfx_statfs_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc)
- goto out;
+ if (!loc)
+ goto out;
- if (loc->inode) {
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
- } else {
- req->gfid[15] = 1;
- }
+ if (loc->inode) {
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
+ } else {
+ req->gfid[15] = 1;
+ }
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_flush_v2 (xlator_t *this, gfx_flush_req *req, fd_t *fd, dict_t *xdata)
+client_pre_flush_v2(xlator_t *this, gfx_flush_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsync_v2 (xlator_t *this, gfx_fsync_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsync_v2(xlator_t *this, gfx_fsync_req *req, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = 0;
+ int64_t remote_fd = -1;
+ int op_errno = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setxattr_v2 (xlator_t *this, gfx_setxattr_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_setxattr_v2(xlator_t *this, gfx_setxattr_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- dict_to_xdr (xattr, &req->dict);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ dict_to_xdr(xattr, &req->dict);
+ }
- req->flags = flags;
+ req->flags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_getxattr_v2 (xlator_t *this, gfx_getxattr_req *req, loc_t *loc,
- const char *name, dict_t *xdata)
+client_pre_getxattr_v2(xlator_t *this, gfx_getxattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc) {
- op_errno = EINVAL;
- goto out;
- }
+ if (!loc) {
+ op_errno = EINVAL;
+ goto out;
+ }
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->namelen = 1; /* Use it as a flag */
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->namelen = 1; /* Use it as a flag */
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_removexattr_v2 (xlator_t *this, gfx_removexattr_req *req,
- loc_t *loc, const char *name, dict_t *xdata)
+client_pre_removexattr_v2(xlator_t *this, gfx_removexattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->name = (char *)name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->name = (char *)name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_opendir_v2 (xlator_t *this,
- gfx_opendir_req *req, loc_t *loc,
- fd_t *fd, dict_t *xdata)
+client_pre_opendir_v2(xlator_t *this, gfx_opendir_req *req, loc_t *loc,
+ fd_t *fd, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsyncdir_v2 (xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsyncdir_v2(xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int32_t op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int32_t op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_access_v2 (xlator_t *this, gfx_access_req *req, loc_t *loc,
- int32_t mask, dict_t *xdata)
+client_pre_access_v2(xlator_t *this, gfx_access_req *req, loc_t *loc,
+ int32_t mask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->mask = mask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->mask = mask;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_create_v2 (xlator_t *this, gfx_create_req *req,
- loc_t *loc, fd_t *fd, mode_t mode,
- int32_t flags, mode_t umask, dict_t *xdata)
+client_pre_create_v2(xlator_t *this, gfx_create_req *req, loc_t *loc, fd_t *fd,
+ mode_t mode, int32_t flags, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->flags = gf_flags_from_flags (flags);
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->flags = gf_flags_from_flags(flags);
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ftruncate_v2 (xlator_t *this, gfx_ftruncate_req *req, fd_t *fd,
- off_t offset, dict_t *xdata)
+client_pre_ftruncate_v2(xlator_t *this, gfx_ftruncate_req *req, fd_t *fd,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = EINVAL;
+ int64_t remote_fd = -1;
+ int op_errno = EINVAL;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fstat_v2 (xlator_t *this, gfx_fstat_req *req, fd_t *fd,
- dict_t *xdata)
+client_pre_fstat_v2(xlator_t *this, gfx_fstat_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lk_v2 (xlator_t *this, gfx_lk_req *req,
- int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata)
+client_pre_lk_v2(xlator_t *this, gfx_lk_req *req, int32_t cmd,
+ struct gf_flock *flock, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
- int ret = 0;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
+ int ret = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- ret = client_cmd_to_gf_cmd (cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
+ ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
- switch (flock->l_type) {
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lookup_v2 (xlator_t *this, gfx_lookup_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_lookup_v2(xlator_t *this, gfx_lookup_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if ((loc->parent) && (!gf_uuid_is_null (loc->parent->gfid)))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- if ((loc->inode) && (!gf_uuid_is_null (loc->inode->gfid)))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if ((loc->parent) && (!gf_uuid_is_null(loc->parent->gfid)))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ if ((loc->inode) && (!gf_uuid_is_null(loc->inode->gfid)))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- if (loc->name)
- req->bname = (char *)loc->name;
- else
- req->bname = "";
+ if (loc->name)
+ req->bname = (char *)loc->name;
+ else
+ req->bname = "";
- if (xdata) {
- dict_to_xdr (xdata, &req->xdata);
- }
- return 0;
+ if (xdata) {
+ dict_to_xdr(xdata, &req->xdata);
+ }
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdir_v2 (xlator_t *this, gfx_readdir_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdir_v2(xlator_t *this, gfx_readdir_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_inodelk_v2 (xlator_t *this, gfx_inodelk_req *req, loc_t *loc,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_inodelk_v2(xlator_t *this, gfx_inodelk_req *req, loc_t *loc, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- op_errno = EINVAL;
- goto out;
- }
-
- switch (flock->l_type) {
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->volume = (char *)volume;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_finodelk_v2 (xlator_t *this, gfx_finodelk_req *req, fd_t *fd,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_finodelk_v2(xlator_t *this, gfx_finodelk_req *req, fd_t *fd, int cmd,
+ struct gf_flock *flock, const char *volume,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
- int32_t gf_type = 0;
- int32_t gf_cmd = 0;
-
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
-
- switch (flock->l_type) {
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int32_t gf_type = 0;
+ int32_t gf_cmd = 0;
+
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->volume = (char *)volume;
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_entrylk_v2 (xlator_t *this, gfx_entrylk_req *req, loc_t *loc,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_entrylk_v2(xlator_t *this, gfx_entrylk_req *req, loc_t *loc,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fentrylk_v2 (xlator_t *this, gfx_fentrylk_req *req, fd_t *fd,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_fentrylk_v2(xlator_t *this, gfx_fentrylk_req *req, fd_t *fd,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_xattrop_v2 (xlator_t *this, gfx_xattrop_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_xattrop_v2(xlator_t *this, gfx_xattrop_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- dict_to_xdr (xattr, &req->dict);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ dict_to_xdr(xattr, &req->dict);
- req->flags = flags;
+ req->flags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fxattrop_v2 (xlator_t *this, gfx_fxattrop_req *req, fd_t *fd,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_fxattrop_v2(xlator_t *this, gfx_fxattrop_req *req, fd_t *fd,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xattr, &req->dict);
+ dict_to_xdr(xattr, &req->dict);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fgetxattr_v2 (xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fgetxattr_v2(xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->namelen = 1; /* Use it as a flag */
- req->fd = remote_fd;
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->namelen = 1; /* Use it as a flag */
+ req->fd = remote_fd;
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetxattr_v2 (xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd,
- int32_t flags, dict_t *xattr, dict_t *xdata)
+client_pre_fsetxattr_v2(xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd,
+ int32_t flags, dict_t *xattr, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- dict_to_xdr (xattr, &req->dict);
- }
+ if (xattr) {
+ dict_to_xdr(xattr, &req->dict);
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rchecksum_v2 (xlator_t *this, gfx_rchecksum_req *req, fd_t *fd,
- int32_t len, off_t offset, dict_t *xdata)
+client_pre_rchecksum_v2(xlator_t *this, gfx_rchecksum_req *req, fd_t *fd,
+ int32_t len, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->len = len;
- req->offset = offset;
- req->fd = remote_fd;
+ req->len = len;
+ req->offset = offset;
+ req->fd = remote_fd;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setattr_v2 (xlator_t *this, gfx_setattr_req *req, loc_t *loc,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_setattr_v2(xlator_t *this, gfx_setattr_req *req, loc_t *loc,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- return -op_errno;
+ if (!(loc && loc->inode))
+ return -op_errno;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- req->valid = valid;
- gfx_stat_from_iattx (&req->stbuf, stbuf);
+ req->valid = valid;
+ gfx_stat_from_iattx(&req->stbuf, stbuf);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetattr_v2 (xlator_t *this, gfx_fsetattr_req *req, fd_t *fd,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_fsetattr_v2(xlator_t *this, gfx_fsetattr_req *req, fd_t *fd,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->valid = valid;
- gfx_stat_from_iattx (&req->stbuf, stbuf);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->valid = valid;
+ gfx_stat_from_iattx(&req->stbuf, stbuf);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdirp_v2 (xlator_t *this, gfx_readdirp_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdirp_v2(xlator_t *this, gfx_readdirp_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- /* dict itself is 'xdata' here */
- dict_to_xdr (xdata, &req->xdata);
+ /* dict itself is 'xdata' here */
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fremovexattr_v2 (xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fremovexattr_v2(xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- if (!(fd && fd->inode))
- goto out;
+ if (!(fd && fd->inode))
+ goto out;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->name = (char *)name;
- req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->name = (char *)name;
+ req->fd = remote_fd;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fallocate_v2 (xlator_t *this, gfx_fallocate_req *req, fd_t *fd,
- int32_t flags, off_t offset, size_t size, dict_t *xdata)
+client_pre_fallocate_v2(xlator_t *this, gfx_fallocate_req *req, fd_t *fd,
+ int32_t flags, off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_discard_v2 (xlator_t *this, gfx_discard_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_discard_v2(xlator_t *this, gfx_discard_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_zerofill_v2 (xlator_t *this, gfx_zerofill_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_zerofill_v2(xlator_t *this, gfx_zerofill_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ipc_v2 (xlator_t *this, gfx_ipc_req *req, int32_t cmd,
- dict_t *xdata)
+client_pre_ipc_v2(xlator_t *this, gfx_ipc_req *req, int32_t cmd, dict_t *xdata)
{
- req->op = cmd;
+ req->op = cmd;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
}
int
-client_pre_seek_v2 (xlator_t *this, gfx_seek_req *req, fd_t *fd,
- off_t offset, gf_seek_what_t what, dict_t *xdata)
+client_pre_seek_v2(xlator_t *this, gfx_seek_req *req, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->offset = offset;
- req->what = what;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->what = what;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lease_v2 (xlator_t *this, gfx_lease_req *req, loc_t *loc,
- struct gf_lease *lease, dict_t *xdata)
+client_pre_lease_v2(xlator_t *this, gfx_lease_req *req, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- gf_proto_lease_from_lease (&req->lease, lease);
+ gf_proto_lease_from_lease(&req->lease, lease);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_put_v2 (xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode,
- mode_t umask, int32_t flags, size_t size, off_t offset,
- dict_t *xattr, dict_t *xdata)
+client_pre_put_v2(xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, int32_t flags, size_t size, off_t offset,
+ dict_t *xattr, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
- req->flag = gf_flags_from_flags (flags);
- req->size = size;
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
+ req->flag = gf_flags_from_flags(flags);
+ req->size = size;
+ req->offset = offset;
- if (xattr)
- dict_to_xdr (xattr, &req->xattr);
+ if (xattr)
+ dict_to_xdr(xattr, &req->xattr);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_create_v2 (xlator_t *this, gfx_create_rsp *rsp,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent,
- clnt_local_t *local, dict_t **xdata)
+client_post_create_v2(xlator_t *this, gfx_create_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ clnt_local_t *local, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, stbuf);
- gfx_stat_to_iattx (&rsp->preparent, preparent);
- gfx_stat_to_iattx (&rsp->postparent, postparent);
- gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ gfx_stat_to_iattx(&rsp->preparent, preparent);
+ gfx_stat_to_iattx(&rsp->postparent, postparent);
+ gf_uuid_copy(local->loc.gfid, stbuf->ia_gfid);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_lease_v2 (xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease,
- dict_t **xdata)
+client_post_lease_v2(xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease,
+ dict_t **xdata)
{
- if (rsp->op_ret >= 0) {
- gf_proto_lease_to_lease (&rsp->lease, lease);
- }
+ if (rsp->op_ret >= 0) {
+ gf_proto_lease_to_lease(&rsp->lease, lease);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_lk_v2 (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock,
- dict_t **xdata)
+client_post_lk_v2(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock,
+ dict_t **xdata)
{
- if (rsp->op_ret >= 0) {
- gf_proto_flock_to_flock (&rsp->flock, lock);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret >= 0) {
+ gf_proto_flock_to_flock(&rsp->flock, lock);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_readdir_v2 (xlator_t *this, gfx_readdir_rsp *rsp,
- gf_dirent_t *entries, dict_t **xdata)
+client_post_readdir_v2(xlator_t *this, gfx_readdir_rsp *rsp,
+ gf_dirent_t *entries, dict_t **xdata)
{
- if (rsp->op_ret > 0) {
- unserialize_rsp_dirent_v2 (this, rsp, entries);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_dirent_v2(this, rsp, entries);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_readdirp_v2 (xlator_t *this, gfx_readdirp_rsp *rsp,
- fd_t *fd, gf_dirent_t *entries,
- dict_t **xdata)
+client_post_readdirp_v2(xlator_t *this, gfx_readdirp_rsp *rsp, fd_t *fd,
+ gf_dirent_t *entries, dict_t **xdata)
{
- if (rsp->op_ret > 0) {
- unserialize_rsp_direntp_v2 (this, fd, rsp, entries);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_direntp_v2(this, fd, rsp, entries);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
-
-
int
-client_post_rename_v2 (xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf,
- struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent,
- dict_t **xdata)
+client_post_rename_v2(xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent,
+ dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, stbuf);
- gfx_stat_to_iattx (&rsp->preoldparent, preoldparent);
- gfx_stat_to_iattx (&rsp->postoldparent, postoldparent);
+ gfx_stat_to_iattx(&rsp->preoldparent, preoldparent);
+ gfx_stat_to_iattx(&rsp->postoldparent, postoldparent);
- gfx_stat_to_iattx (&rsp->prenewparent, prenewparent);
- gfx_stat_to_iattx (&rsp->postnewparent, postnewparent);
- }
+ gfx_stat_to_iattx(&rsp->prenewparent, prenewparent);
+ gfx_stat_to_iattx(&rsp->postnewparent, postnewparent);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 0025fb55697..5feeca5411d 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -28,1706 +28,1725 @@ extern rpc_clnt_prog_t clnt4_0_fop_prog;
extern rpc_clnt_prog_t clnt_pmap_prog;
typedef struct client_fd_lk_local {
- gf_atomic_t ref;
- gf_boolean_t error;
- gf_lock_t lock;
- clnt_fd_ctx_t *fdctx;
-}clnt_fd_lk_local_t;
+ gf_atomic_t ref;
+ gf_boolean_t error;
+ gf_lock_t lock;
+ clnt_fd_ctx_t *fdctx;
+} clnt_fd_lk_local_t;
int
-client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_getspec_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gf_getspec_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- int ret = 0;
-
- frame = myframe;
-
- if (!frame || !frame->this) {
- gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
- "frame not found with the request, returning EINVAL");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed, returning EINVAL");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_VOL_FILE_NOT_FOUND, "failed to get the 'volume "
- "file' from server");
- goto out;
- }
+ gf_getspec_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ int ret = 0;
+
+ frame = myframe;
+
+ if (!frame || !frame->this) {
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
+ "frame not found with the request, returning EINVAL");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed, returning EINVAL");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VOL_FILE_NOT_FOUND,
+ "failed to get the 'volume "
+ "file' from server");
+ goto out;
+ }
out:
- CLIENT_STACK_UNWIND (getspec, frame, rsp.op_ret, rsp.op_errno,
- rsp.spec);
+ CLIENT_STACK_UNWIND(getspec, frame, rsp.op_ret, rsp.op_errno, rsp.spec);
- /* Don't use 'GF_FREE', this is allocated by libc */
- free (rsp.spec);
- free (rsp.xdata.xdata_val);
+ /* Don't use 'GF_FREE', this is allocated by libc */
+ free(rsp.spec);
+ free(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data)
+int32_t
+client3_getspec(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gf_getspec_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
- req.flags = args->flags;
- req.key = (char *)args->name;
-
- ret = client_submit_request (this, &req, frame, conf->handshake,
- GF_HNDSK_GETSPEC, client3_getspec_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_getspec_req);
-
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL,
- "failed to send the request");
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gf_getspec_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+ req.flags = args->flags;
+ req.key = (char *)args->name;
+
+ ret = client_submit_request(this, &req, frame, conf->handshake,
+ GF_HNDSK_GETSPEC, client3_getspec_cbk, NULL,
+ NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_getspec_req);
+
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL,
+ "failed to send the request");
+ }
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (getspec, frame, -1, op_errno, NULL);
- return 0;
-
+ CLIENT_STACK_UNWIND(getspec, frame, -1, op_errno, NULL);
+ return 0;
}
int
-client_notify_parents_child_up (xlator_t *this)
+client_notify_parents_child_up(xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- int ret = 0;
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
-
- if (conf->child_up) {
- ret = client_notify_dispatch_uniq (this, GF_EVENT_CHILD_UP,
- NULL);
- if (ret) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_UP_NOTIFY_FAILED,
- "notify of CHILD_UP failed");
- goto out;
- }
- } else {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS,
- "Defering sending CHILD_UP message as the client "
- "translators are not yet ready to serve.");
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ if (conf->child_up) {
+ ret = client_notify_dispatch_uniq(this, GF_EVENT_CHILD_UP, NULL);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_FAILED,
+ "notify of CHILD_UP failed");
+ goto out;
}
+ } else {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS,
+ "Defering sending CHILD_UP message as the client "
+ "translators are not yet ready to serve.");
+ }
out:
- return 0;
+ return 0;
}
int
-clnt_fd_lk_reacquire_failed (xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
+clnt_fd_lk_reacquire_failed(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ clnt_conf_t *conf)
{
- int ret = -1;
+ int ret = -1;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx->remote_fd = -1;
- }
- pthread_spin_unlock (&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx->remote_fd = -1;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-client_fd_lk_count (fd_lk_ctx_t *lk_ctx)
+client_fd_lk_count(fd_lk_ctx_t *lk_ctx)
{
- int count = 0;
- fd_lk_ctx_node_t *fd_lk = NULL;
+ int count = 0;
+ fd_lk_ctx_node_t *fd_lk = NULL;
- GF_VALIDATE_OR_GOTO ("client", lk_ctx, err);
+ GF_VALIDATE_OR_GOTO("client", lk_ctx, err);
- LOCK (&lk_ctx->lock);
- {
- list_for_each_entry (fd_lk, &lk_ctx->lk_list, next)
- count++;
- }
- UNLOCK (&lk_ctx->lock);
+ LOCK(&lk_ctx->lock);
+ {
+ list_for_each_entry(fd_lk, &lk_ctx->lk_list, next) count++;
+ }
+ UNLOCK(&lk_ctx->lock);
- return count;
+ return count;
err:
- return -1;
+ return -1;
}
clnt_fd_lk_local_t *
-clnt_fd_lk_local_ref (xlator_t *this, clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_ref(xlator_t *this, clnt_fd_lk_local_t *local)
{
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- GF_ATOMIC_INC (local->ref);
+ GF_ATOMIC_INC(local->ref);
out:
- return local;
+ return local;
}
int
-clnt_fd_lk_local_unref (xlator_t *this, clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_unref(xlator_t *this, clnt_fd_lk_local_t *local)
{
- int ref = -1;
+ int ref = -1;
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- ref = GF_ATOMIC_DEC (local->ref);
+ ref = GF_ATOMIC_DEC(local->ref);
- if (ref == 0) {
- LOCK_DESTROY (&local->lock);
- GF_FREE (local);
- }
+ if (ref == 0) {
+ LOCK_DESTROY(&local->lock);
+ GF_FREE(local);
+ }
out:
- return ref;
+ return ref;
}
clnt_fd_lk_local_t *
-clnt_fd_lk_local_create (clnt_fd_ctx_t *fdctx)
+clnt_fd_lk_local_create(clnt_fd_ctx_t *fdctx)
{
- clnt_fd_lk_local_t *local = NULL;
+ clnt_fd_lk_local_t *local = NULL;
- local = GF_CALLOC (1, sizeof (clnt_fd_lk_local_t),
- gf_client_mt_clnt_fd_lk_local_t);
- if (!local)
- goto out;
+ local = GF_CALLOC(1, sizeof(clnt_fd_lk_local_t),
+ gf_client_mt_clnt_fd_lk_local_t);
+ if (!local)
+ goto out;
- GF_ATOMIC_INIT (local->ref, 1);
- local->error = _gf_false;
- local->fdctx = fdctx;
+ GF_ATOMIC_INIT(local->ref, 1);
+ local->error = _gf_false;
+ local->fdctx = fdctx;
- LOCK_INIT (&local->lock);
+ LOCK_INIT(&local->lock);
out:
- return local;
+ return local;
}
int
-clnt_release_reopen_fd_cbk (struct rpc_req *req, struct iovec *iov,
- int count, void *myframe)
+clnt_release_reopen_fd_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- xlator_t *this = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
+ xlator_t *this = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
- frame = myframe;
- this = frame->this;
- fdctx = (clnt_fd_ctx_t *) frame->local;
- conf = (clnt_conf_t *) this->private;
+ frame = myframe;
+ this = frame->this;
+ fdctx = (clnt_fd_ctx_t *)frame->local;
+ conf = (clnt_conf_t *)this->private;
- clnt_fd_lk_reacquire_failed (this, fdctx, conf);
+ clnt_fd_lk_reacquire_failed(this, fdctx, conf);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- return 0;
+ return 0;
}
int
-clnt_release_reopen_fd (xlator_t *this, clnt_fd_ctx_t *fdctx)
+clnt_release_reopen_fd(xlator_t *this, clnt_fd_ctx_t *fdctx)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- call_frame_t *frame = NULL;
- gfs3_release_req req = {{0,},};
-
- conf = (clnt_conf_t *) this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame)
- goto out;
-
- frame->local = (void *) fdctx;
- req.fd = fdctx->remote_fd;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RELEASE,
- clnt_release_reopen_fd_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
- out:
- if (ret) {
- clnt_fd_lk_reacquire_failed (this, fdctx, conf);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
- }
- return 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_release_req req = {
+ {
+ 0,
+ },
+ };
+
+ conf = (clnt_conf_t *)this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame)
+ goto out;
+
+ frame->local = (void *)fdctx;
+ req.fd = fdctx->remote_fd;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RELEASE,
+ clnt_release_reopen_fd_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfs3_releasedir_req);
+out:
+ if (ret) {
+ clnt_fd_lk_reacquire_failed(this, fdctx, conf);
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ }
+ return 0;
}
int
-clnt_reacquire_lock_error (xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
+clnt_reacquire_lock_error(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ clnt_conf_t *conf)
{
- int32_t ret = -1;
+ int32_t ret = -1;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- clnt_release_reopen_fd (this, fdctx);
+ clnt_release_reopen_fd(this, fdctx);
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
gf_boolean_t
-clnt_fd_lk_local_error_status (xlator_t *this,
- clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_error_status(xlator_t *this, clnt_fd_lk_local_t *local)
{
- gf_boolean_t error = _gf_false;
+ gf_boolean_t error = _gf_false;
- LOCK (&local->lock);
- {
- error = local->error;
- }
- UNLOCK (&local->lock);
+ LOCK(&local->lock);
+ {
+ error = local->error;
+ }
+ UNLOCK(&local->lock);
- return error;
+ return error;
}
int
-clnt_fd_lk_local_mark_error (xlator_t *this,
- clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_mark_error(xlator_t *this, clnt_fd_lk_local_t *local)
{
- int32_t ret = -1;
- clnt_conf_t *conf = NULL;
- gf_boolean_t error = _gf_false;
+ int32_t ret = -1;
+ clnt_conf_t *conf = NULL;
+ gf_boolean_t error = _gf_false;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- conf = (clnt_conf_t *) this->private;
+ conf = (clnt_conf_t *)this->private;
- LOCK (&local->lock);
- {
- error = local->error;
- local->error = _gf_true;
- }
- UNLOCK (&local->lock);
+ LOCK(&local->lock);
+ {
+ error = local->error;
+ local->error = _gf_true;
+ }
+ UNLOCK(&local->lock);
- if (!error)
- clnt_reacquire_lock_error (this, local->fdctx, conf);
- ret = 0;
+ if (!error)
+ clnt_reacquire_lock_error(this, local->fdctx, conf);
+ ret = 0;
out:
- return ret;
+ return ret;
}
void
-client_default_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_default_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- gf_log_callingfn (this->name, GF_LOG_WARNING,
- "This function should never be called");
+ gf_log_callingfn(this->name, GF_LOG_WARNING,
+ "This function should never be called");
}
void
-client_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- gf_boolean_t destroy = _gf_false;
-
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx->remote_fd = rfd;
- fdctx->reopen_attempts = 0;
- fdctx->reopen_done = client_default_reopen_done;
- if (!fdctx->released)
- list_add_tail (&fdctx->sfd_pos, &conf->saved_fds);
- else
- destroy = _gf_true;
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ clnt_conf_t *conf = NULL;
+ gf_boolean_t destroy = _gf_false;
+
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx->remote_fd = rfd;
+ fdctx->reopen_attempts = 0;
+ fdctx->reopen_done = client_default_reopen_done;
+ if (!fdctx->released)
+ list_add_tail(&fdctx->sfd_pos, &conf->saved_fds);
+ else
+ destroy = _gf_true;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
}
void
-client_child_up_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_child_up_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- uint64_t fd_count = 0;
-
- conf = this->private;
-
- LOCK (&conf->rec_lock);
- {
- fd_count = --(conf->reopen_fd_count);
- }
- UNLOCK (&conf->rec_lock);
-
- client_reopen_done (fdctx, rfd, this);
- if (fd_count == 0) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
- "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
- client_notify_parents_child_up (this);
- }
+ clnt_conf_t *conf = NULL;
+ uint64_t fd_count = 0;
+
+ conf = this->private;
+
+ LOCK(&conf->rec_lock);
+ {
+ fd_count = --(conf->reopen_fd_count);
+ }
+ UNLOCK(&conf->rec_lock);
+
+ client_reopen_done(fdctx, rfd, this);
+ if (fd_count == 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
+ "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
+ client_notify_parents_child_up(this);
+ }
}
int
-client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfs3_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.",
- local->loc.path);
- } else {
- gf_msg_debug (frame->this->name, 0,
- "reopen on %s succeeded (remote-fd = %"PRId64")",
- local->loc.path, rsp.fd);
- }
-
- if (rsp.op_ret == -1) {
- ret = -1;
- goto out;
- }
-
- ret = 0;
+ int32_t ret = -1;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ } else {
+ gf_msg_debug(frame->this->name, 0,
+ "reopen on %s succeeded (remote-fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (rsp.op_ret == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- client_local_wipe (local);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
int
-client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfs3_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
-
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed",
- local->loc.path);
- } else {
- gf_msg (frame->this->name, GF_LOG_INFO, 0,
- PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded "
- "(fd = %"PRId64")", local->loc.path, rsp.fd);
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- goto out;
- }
+ int32_t ret = -1;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+
+ frame = myframe;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ } else {
+ gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "reopendir on %s succeeded "
+ "(fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ goto out;
+ }
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- client_local_wipe (local);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
static int
-protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopendir(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfs3_opendir_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
- local->fdctx = fdctx;
-
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- memcpy (req.gfid, fdctx->gfid, 16);
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- frame->local = local;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR,
- client3_3_reopendir_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
- }
-
- return 0;
+ int ret = -1;
+ gfs3_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+ local->fdctx = fdctx;
+
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ frame->local = local;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client3_3_reopendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-opendir request");
+ }
+
+ return 0;
out:
- if (local)
- client_local_wipe (local);
+ if (local)
+ client_local_wipe(local);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
-
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static int
-protocol_client_reopenfile (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopenfile(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfs3_open_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
-
- local->fdctx = fdctx;
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame->local = local;
-
- memcpy (req.gfid, fdctx->gfid, 16);
- req.flags = gf_flags_from_flags (fdctx->flags);
- req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL));
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client3_3_reopen_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
- }
-
- return 0;
+ int ret = -1;
+ gfs3_open_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+
+ local->fdctx = fdctx;
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame->local = local;
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.flags = gf_flags_from_flags(fdctx->flags);
+ req.flags = req.flags & (~(O_TRUNC | O_CREAT | O_EXCL));
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client3_3_reopen_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-open request");
+ }
+
+ return 0;
out:
- if (frame) {
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- }
-
- if (local)
- client_local_wipe (local);
+ if (frame) {
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ }
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ if (local)
+ client_local_wipe(local);
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static void
-protocol_client_reopen (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopen(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- if (fdctx->is_dir)
- protocol_client_reopendir (fdctx, this);
- else
- protocol_client_reopenfile (fdctx, this);
+ if (fdctx->is_dir)
+ protocol_client_reopendir(fdctx, this);
+ else
+ protocol_client_reopenfile(fdctx, this);
}
/* v4.x + */
int
-client4_0_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfx_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.",
- local->loc.path);
- } else {
- gf_msg_debug (frame->this->name, 0,
- "reopen on %s succeeded (remote-fd = %"PRId64")",
- local->loc.path, rsp.fd);
- }
-
- if (rsp.op_ret == -1) {
- ret = -1;
- goto out;
- }
-
- ret = 0;
+ int32_t ret = -1;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ } else {
+ gf_msg_debug(frame->this->name, 0,
+ "reopen on %s succeeded (remote-fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (rsp.op_ret == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- client_local_wipe (local);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
int
-client4_0_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfx_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed",
- local->loc.path);
- } else {
- gf_msg (frame->this->name, GF_LOG_INFO, 0,
- PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded "
- "(fd = %"PRId64")", local->loc.path, rsp.fd);
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- goto out;
- }
+ int32_t ret = -1;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+
+ frame = myframe;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ } else {
+ gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "reopendir on %s succeeded "
+ "(fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ goto out;
+ }
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- client_local_wipe (local);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
static int
-protocol_client_reopendir_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopendir_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfx_opendir_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
- local->fdctx = fdctx;
-
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- memcpy (req.gfid, fdctx->gfid, 16);
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- frame->local = local;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR,
- client4_0_reopendir_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
- }
-
- return 0;
+ int ret = -1;
+ gfx_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+ local->fdctx = fdctx;
+
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ frame->local = local;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client4_0_reopendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-opendir request");
+ }
+
+ return 0;
out:
- if (local)
- client_local_wipe (local);
+ if (local)
+ client_local_wipe(local);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
-
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static int
-protocol_client_reopenfile_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopenfile_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfx_open_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
-
- local->fdctx = fdctx;
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame->local = local;
-
- memcpy (req.gfid, fdctx->gfid, 16);
- req.flags = gf_flags_from_flags (fdctx->flags);
- req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL));
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client4_0_reopen_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
- }
-
- return 0;
+ int ret = -1;
+ gfx_open_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+
+ local->fdctx = fdctx;
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame->local = local;
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.flags = gf_flags_from_flags(fdctx->flags);
+ req.flags = req.flags & (~(O_TRUNC | O_CREAT | O_EXCL));
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client4_0_reopen_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-open request");
+ }
+
+ return 0;
out:
- if (frame) {
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- }
-
- if (local)
- client_local_wipe (local);
+ if (frame) {
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ }
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ if (local)
+ client_local_wipe(local);
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static void
-protocol_client_reopen_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopen_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- if (fdctx->is_dir)
- protocol_client_reopendir_v2 (fdctx, this);
- else
- protocol_client_reopenfile_v2 (fdctx, this);
+ if (fdctx->is_dir)
+ protocol_client_reopendir_v2(fdctx, this);
+ else
+ protocol_client_reopenfile_v2(fdctx, this);
}
gf_boolean_t
-__is_fd_reopen_in_progress (clnt_fd_ctx_t *fdctx)
+__is_fd_reopen_in_progress(clnt_fd_ctx_t *fdctx)
{
- if (fdctx->reopen_done == client_default_reopen_done)
- return _gf_false;
- return _gf_true;
+ if (fdctx->reopen_done == client_default_reopen_done)
+ return _gf_false;
+ return _gf_true;
}
void
-client_attempt_reopen (fd_t *fd, xlator_t *this)
+client_attempt_reopen(fd_t *fd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- gf_boolean_t reopen = _gf_false;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ gf_boolean_t reopen = _gf_false;
- if (!fd || !this)
- goto out;
+ if (!fd || !this)
+ goto out;
- conf = this->private;
+ conf = this->private;
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
- goto out;
- }
-
- if (__is_fd_reopen_in_progress (fdctx))
- goto unlock;
- if (fdctx->remote_fd != -1)
- goto unlock;
-
- if (fdctx->reopen_attempts == CLIENT_REOPEN_MAX_ATTEMPTS) {
- reopen = _gf_true;
- fdctx->reopen_done = client_reopen_done;
- list_del_init (&fdctx->sfd_pos);
- } else {
- fdctx->reopen_attempts++;
- }
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ pthread_spin_unlock(&conf->fd_lock);
+ goto out;
}
-unlock:
- pthread_spin_unlock (&conf->fd_lock);
- if (reopen) {
- if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
- protocol_client_reopen_v2 (fdctx, this);
- else
- protocol_client_reopen (fdctx, this);
+
+ if (__is_fd_reopen_in_progress(fdctx))
+ goto unlock;
+ if (fdctx->remote_fd != -1)
+ goto unlock;
+
+ if (fdctx->reopen_attempts == CLIENT_REOPEN_MAX_ATTEMPTS) {
+ reopen = _gf_true;
+ fdctx->reopen_done = client_reopen_done;
+ list_del_init(&fdctx->sfd_pos);
+ } else {
+ fdctx->reopen_attempts++;
}
+ }
+unlock:
+ pthread_spin_unlock(&conf->fd_lock);
+ if (reopen) {
+ if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
+ protocol_client_reopen_v2(fdctx, this);
+ else
+ protocol_client_reopen(fdctx, this);
+ }
out:
- return;
+ return;
}
int
-client_post_handshake (call_frame_t *frame, xlator_t *this)
+client_post_handshake(call_frame_t *frame, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *tmp = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- struct list_head reopen_head;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *tmp = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ struct list_head reopen_head;
- int count = 0;
+ int count = 0;
- if (!this || !this->private)
- goto out;
+ if (!this || !this->private)
+ goto out;
- conf = this->private;
- INIT_LIST_HEAD (&reopen_head);
+ conf = this->private;
+ INIT_LIST_HEAD(&reopen_head);
- pthread_spin_lock (&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos)
{
- list_for_each_entry_safe (fdctx, tmp, &conf->saved_fds,
- sfd_pos) {
- if (fdctx->remote_fd != -1)
- continue;
-
- fdctx->reopen_done = client_child_up_reopen_done;
- list_del_init (&fdctx->sfd_pos);
- list_add_tail (&fdctx->sfd_pos, &reopen_head);
- count++;
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- /* Delay notifying CHILD_UP to parents
- until all locks are recovered */
- if (count > 0) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_UP_NOTIFY_DELAY, "%d fds open - Delaying "
- "child_up until they are re-opened", count);
- client_save_number_fds (conf, count);
-
- list_for_each_entry_safe (fdctx, tmp, &reopen_head, sfd_pos) {
- list_del_init (&fdctx->sfd_pos);
-
- if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
- protocol_client_reopen_v2 (fdctx, this);
- else
- protocol_client_reopen (fdctx, this);
- }
- } else {
- gf_msg_debug (this->name, 0,
- "No fds to open - notifying all parents child "
- "up");
- client_notify_parents_child_up (this);
- }
+ if (fdctx->remote_fd != -1)
+ continue;
+
+ fdctx->reopen_done = client_child_up_reopen_done;
+ list_del_init(&fdctx->sfd_pos);
+ list_add_tail(&fdctx->sfd_pos, &reopen_head);
+ count++;
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ /* Delay notifying CHILD_UP to parents
+ until all locks are recovered */
+ if (count > 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_DELAY,
+ "%d fds open - Delaying "
+ "child_up until they are re-opened",
+ count);
+ client_save_number_fds(conf, count);
+
+ list_for_each_entry_safe(fdctx, tmp, &reopen_head, sfd_pos)
+ {
+ list_del_init(&fdctx->sfd_pos);
+
+ if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
+ protocol_client_reopen_v2(fdctx, this);
+ else
+ protocol_client_reopen(fdctx, this);
+ }
+ } else {
+ gf_msg_debug(this->name, 0,
+ "No fds to open - notifying all parents child "
+ "up");
+ client_notify_parents_child_up(this);
+ }
out:
- return 0;
+ return 0;
}
int
-client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
+client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
- dict_t *reply = NULL;
- char *process_uuid = NULL;
- char *remote_error = NULL;
- char *remote_subvol = NULL;
- gf_setvolume_rsp rsp = {0,};
- int ret = 0;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
- gf_boolean_t auth_fail = _gf_false;
- glusterfs_ctx_t *ctx = NULL;
-
- frame = myframe;
- this = frame->this;
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
- ctx = this->ctx;
- GF_VALIDATE_OR_GOTO (this->name, ctx, out);
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
- op_ret = -1;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- op_ret = -1;
- goto out;
- }
- op_ret = rsp.op_ret;
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_VOL_SET_FAIL, "failed to set the volume");
- }
-
- reply = dict_new ();
- if (!reply)
- goto out;
-
- if (rsp.dict.dict_len) {
- ret = dict_unserialize (rsp.dict.dict_val,
- rsp.dict.dict_len, &reply);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
- "unserialize buffer to dict");
- goto out;
- }
- }
-
- ret = dict_get_str (reply, "ERROR", &remote_error);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_GET_FAILED, "failed to get ERROR "
- "string from reply dict");
- }
-
- ret = dict_get_str (reply, "process-uuid", &process_uuid);
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ dict_t *reply = NULL;
+ char *process_uuid = NULL;
+ char *remote_error = NULL;
+ char *remote_subvol = NULL;
+ gf_setvolume_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+ gf_boolean_t auth_fail = _gf_false;
+ glusterfs_ctx_t *ctx = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ ctx = this->ctx;
+ GF_VALIDATE_OR_GOTO(this->name, ctx, out);
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ op_ret = -1;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ op_ret = -1;
+ goto out;
+ }
+ op_ret = rsp.op_ret;
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, op_errno, PC_MSG_VOL_SET_FAIL,
+ "failed to set the volume");
+ }
+
+ reply = dict_new();
+ if (!reply)
+ goto out;
+
+ if (rsp.dict.dict_len) {
+ ret = dict_unserialize(rsp.dict.dict_val, rsp.dict.dict_len, &reply);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_GET_FAILED, "failed to get "
- "'process-uuid' from reply dict");
- }
-
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, op_errno,
- PC_MSG_SETVOLUME_FAIL,
- "SETVOLUME on remote-host failed: %s", remote_error);
-
- errno = op_errno;
- if (remote_error &&
- (strcmp ("Authentication failed", remote_error) == 0)) {
- auth_fail = _gf_true;
- op_ret = 0;
- }
- if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
- (ctx->graph_id <= 1)) {
- /* A case of subdir not being present at the moment,
- ride on auth_fail framework to notify the error */
- /* Make sure this case is handled only in the new
- graph, so mount may fail in this case. In case
- of 'add-brick' etc, we need to continue retry */
- auth_fail = _gf_true;
- op_ret = 0;
- }
- if (op_errno == ESTALE) {
- ret = client_notify_dispatch (this,
- GF_EVENT_VOLFILE_MODIFIED,
- NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_VOLFILE_NOTIFY_FAILED,
- "notify of VOLFILE_MODIFIED failed");
- }
- goto out;
- }
-
- ret = dict_get_str (this->options, "remote-subvolume",
- &remote_subvol);
- if (ret || !remote_subvol) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'remote-subvolume' in the options");
- goto out;
- }
-
- uint32_t child_up_int;
- ret = dict_get_uint32 (reply, "child_up", &child_up_int);
- if (ret) {
- /*
- * This would happen in cases where the server trying to *
- * connect to this client is running an older version. Hence *
- * setting the child_up to _gf_true in this case. *
- */
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'child_up' in the options");
- conf->child_up = _gf_true;
- } else {
- conf->child_up = (child_up_int != 0);
- }
-
- /* TODO: currently setpeer path is broken */
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0,
+ PC_MSG_DICT_UNSERIALIZE_FAIL,
+ "failed to "
+ "unserialize buffer to dict");
+ goto out;
+ }
+ }
+
+ ret = dict_get_str(reply, "ERROR", &remote_error);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "failed to get ERROR "
+ "string from reply dict");
+ }
+
+ ret = dict_get_str(reply, "process-uuid", &process_uuid);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "failed to get "
+ "'process-uuid' from reply dict");
+ }
+
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, PC_MSG_SETVOLUME_FAIL,
+ "SETVOLUME on remote-host failed: %s", remote_error);
+
+ errno = op_errno;
+ if (remote_error &&
+ (strcmp("Authentication failed", remote_error) == 0)) {
+ auth_fail = _gf_true;
+ op_ret = 0;
+ }
+ if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
+ (ctx->graph_id <= 1)) {
+ /* A case of subdir not being present at the moment,
+ ride on auth_fail framework to notify the error */
+ /* Make sure this case is handled only in the new
+ graph, so mount may fail in this case. In case
+ of 'add-brick' etc, we need to continue retry */
+ auth_fail = _gf_true;
+ op_ret = 0;
+ }
+ if (op_errno == ESTALE) {
+ ret = client_notify_dispatch(this, GF_EVENT_VOLFILE_MODIFIED, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VOLFILE_NOTIFY_FAILED,
+ "notify of VOLFILE_MODIFIED failed");
+ }
+ goto out;
+ }
+
+ ret = dict_get_str(this->options, "remote-subvolume", &remote_subvol);
+ if (ret || !remote_subvol) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
+ "failed to find key 'remote-subvolume' in the options");
+ goto out;
+ }
+
+ uint32_t child_up_int;
+ ret = dict_get_uint32(reply, "child_up", &child_up_int);
+ if (ret) {
/*
- if (process_uuid && req->conn &&
- !strcmp (this->ctx->process_uuid, process_uuid)) {
- rpc_transport_t *peer_trans = NULL;
- uint64_t peertrans_int = 0;
+ * This would happen in cases where the server trying to *
+ * connect to this client is running an older version. Hence *
+ * setting the child_up to _gf_true in this case. *
+ */
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
+ "failed to find key 'child_up' in the options");
+ conf->child_up = _gf_true;
+ } else {
+ conf->child_up = (child_up_int != 0);
+ }
- ret = dict_get_uint64 (reply, "transport-ptr",
- &peertrans_int);
- if (ret)
- goto out;
+ /* TODO: currently setpeer path is broken */
+ /*
+ if (process_uuid && req->conn &&
+ !strcmp (this->ctx->process_uuid, process_uuid)) {
+ rpc_transport_t *peer_trans = NULL;
+ uint64_t peertrans_int = 0;
- gf_log (this->name, GF_LOG_WARNING,
- "attaching to the local volume '%s'",
- remote_subvol);
+ ret = dict_get_uint64 (reply, "transport-ptr",
+ &peertrans_int);
+ if (ret)
+ goto out;
- peer_trans = (void *) (long) (peertrans_int);
+ gf_log (this->name, GF_LOG_WARNING,
+ "attaching to the local volume '%s'",
+ remote_subvol);
- rpc_transport_setpeer (req->conn->trans, peer_trans);
- }
- */
+ peer_trans = (void *) (long) (peertrans_int);
+
+ rpc_transport_setpeer (req->conn->trans, peer_trans);
+ }
+ */
- conf->client_id = glusterfs_leaf_position(this);
+ conf->client_id = glusterfs_leaf_position(this);
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
- "Connected to %s, attached to remote volume '%s'.",
- conf->rpc->conn.name,
- remote_subvol);
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
+ "Connected to %s, attached to remote volume '%s'.",
+ conf->rpc->conn.name, remote_subvol);
- op_ret = 0;
- conf->connected = 1;
+ op_ret = 0;
+ conf->connected = 1;
- client_post_handshake (frame, frame->this);
+ client_post_handshake(frame, frame->this);
out:
- if (auth_fail) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
- "sending AUTH_FAILED event");
- ret = client_notify_dispatch (this, GF_EVENT_AUTH_FAILED, NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_AUTH_FAILED_NOTIFY_FAILED, "notify of "
- "AUTH_FAILED failed");
- conf->connected = 0;
- ret = -1;
- }
- if (-1 == op_ret) {
- /* Let the connection/re-connection happen in
- * background, for now, don't hang here,
- * tell the parents that i am all ok..
- */
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_CONNECTING_EVENT, "sending "
- "CHILD_CONNECTING event");
- ret = client_notify_dispatch (this, GF_EVENT_CHILD_CONNECTING,
- NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
- "notify of CHILD_CONNECTING failed");
- /*
- * The reconnection *won't* happen in the background (see
- * previous comment) unless we kill the current connection.
- */
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
- ret = 0;
- }
+ if (auth_fail) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
+ "sending AUTH_FAILED event");
+ ret = client_notify_dispatch(this, GF_EVENT_AUTH_FAILED, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED_NOTIFY_FAILED,
+ "notify of "
+ "AUTH_FAILED failed");
+ conf->connected = 0;
+ ret = -1;
+ }
+ if (-1 == op_ret) {
+ /* Let the connection/re-connection happen in
+ * background, for now, don't hang here,
+ * tell the parents that i am all ok..
+ */
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_CONNECTING_EVENT,
+ "sending "
+ "CHILD_CONNECTING event");
+ ret = client_notify_dispatch(this, GF_EVENT_CHILD_CONNECTING, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
+ "notify of CHILD_CONNECTING failed");
+ /*
+ * The reconnection *won't* happen in the background (see
+ * previous comment) unless we kill the current connection.
+ */
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
+ ret = 0;
+ }
- free (rsp.dict.dict_val);
+ free(rsp.dict.dict_val);
- STACK_DESTROY (frame->root);
+ STACK_DESTROY(frame->root);
- if (reply)
- dict_unref (reply);
+ if (reply)
+ dict_unref(reply);
- return ret;
+ return ret;
}
int
-client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
+client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
{
- int ret = 0;
- gf_setvolume_req req = {{0,},};
- call_frame_t *fr = NULL;
- char *process_uuid_xl = NULL;
- clnt_conf_t *conf = NULL;
- dict_t *options = NULL;
- char counter_str[32] = {0};
- char hostname[256] = {0,};
-
- options = this->options;
- conf = this->private;
-
- if (conf->fops) {
- ret = dict_set_int32 (options, "fops-version",
- conf->fops->prognum);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "version-fops(%d) in handshake msg",
- conf->fops->prognum);
- goto fail;
- }
- }
-
- if (conf->mgmt) {
- ret = dict_set_int32 (options, "mgmt-version", conf->mgmt->prognum);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "version-mgmt(%d) in handshake msg",
- conf->mgmt->prognum);
- goto fail;
- }
- }
-
- /*
- * Connection-id should always be unique so that server never gets to
- * reuse the previous connection resources so it cleans up the resources
- * on every disconnect. Otherwise it may lead to stale resources, i.e.
- * leaked file descriptors, inode/entry locks
- */
-
- snprintf (counter_str, sizeof (counter_str),
- "-%"PRIu64, conf->setvol_count);
- conf->setvol_count++;
-
- if (gethostname (hostname, 256) == -1) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed");
-
- goto fail;
- }
-
- ret = gf_asprintf (&process_uuid_xl, GLUSTER_PROCESS_UUID_FMT,
- this->ctx->process_uuid, this->graph->id, getpid(),
- hostname, this->name, counter_str);
- if (-1 == ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_PROCESS_UUID_SET_FAIL, "asprintf failed while "
- "setting process_uuid");
- goto fail;
- }
-
- ret = dict_set_dynstr (options, "process-uuid", process_uuid_xl);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-uuid(%s) in handshake msg",
- process_uuid_xl);
- goto fail;
- }
-
- ret = dict_set_str (options, "process-name", this->ctx->cmd_args.process_name);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-name in handshake msg");
- }
-
- ret = dict_set_str (options, "client-version", PACKAGE_VERSION);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set client-version(%s) in handshake msg",
- PACKAGE_VERSION);
- }
-
- if (this->ctx->cmd_args.volfile_server) {
- if (this->ctx->cmd_args.volfile_id) {
- ret = dict_set_str (options, "volfile-key",
- this->ctx->cmd_args.volfile_id);
- if (ret)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to "
- "set 'volfile-key'");
- }
- ret = dict_set_uint32 (options, "volfile-checksum",
- this->graph->volfile_checksum);
- if (ret)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "'volfile-checksum'");
- }
-
- if (this->ctx->cmd_args.subdir_mount) {
- ret = dict_set_str (options, "subdir-mount",
- this->ctx->cmd_args.subdir_mount);
- if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
- "Failed to set subdir_mount");
- /* It makes sense to fail, as per the CLI, we
- should be doing a subdir_mount */
- goto fail;
- }
- }
-
- /* Insert a dummy key value pair to avoid failure at server side for
- * clnt-lk-version with new clients.
- */
- ret = dict_set_uint32 (options, "clnt-lk-version", 1);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set clnt-lk-version(1) in handshake msg");
- }
-
- ret = dict_set_int32 (options, "opversion", GD_OP_VERSION_MAX);
+ int ret = 0;
+ gf_setvolume_req req = {
+ {
+ 0,
+ },
+ };
+ call_frame_t *fr = NULL;
+ char *process_uuid_xl = NULL;
+ clnt_conf_t *conf = NULL;
+ dict_t *options = NULL;
+ char counter_str[32] = {0};
+ char hostname[256] = {
+ 0,
+ };
+
+ options = this->options;
+ conf = this->private;
+
+ if (conf->fops) {
+ ret = dict_set_int32(options, "fops-version", conf->fops->prognum);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "Failed to set client opversion in handshake message");
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "version-fops(%d) in handshake msg",
+ conf->fops->prognum);
+ goto fail;
}
+ }
- ret = dict_serialized_length (options);
+ if (conf->mgmt) {
+ ret = dict_set_int32(options, "mgmt-version", conf->mgmt->prognum);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
- "failed to get serialized length of dict");
- ret = -1;
- goto fail;
- }
- req.dict.dict_len = ret;
- req.dict.dict_val = GF_CALLOC (1, req.dict.dict_len,
- gf_client_mt_clnt_req_buf_t);
- ret = dict_serialize (options, req.dict.dict_val);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SERIALIZE_FAIL, "failed to serialize "
- "dictionary");
- goto fail;
- }
-
- fr = create_frame (this, this->ctx->pool);
- if (!fr)
- goto fail;
-
- ret = client_submit_request (this, &req, fr, conf->handshake,
- GF_HNDSK_SETVOLUME, client_setvolume_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_setvolume_req);
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "version-mgmt(%d) in handshake msg",
+ conf->mgmt->prognum);
+ goto fail;
+ }
+ }
+
+ /*
+ * Connection-id should always be unique so that server never gets to
+ * reuse the previous connection resources so it cleans up the resources
+ * on every disconnect. Otherwise it may lead to stale resources, i.e.
+ * leaked file descriptors, inode/entry locks
+ */
+
+ snprintf(counter_str, sizeof(counter_str), "-%" PRIu64, conf->setvol_count);
+ conf->setvol_count++;
+
+ if (gethostname(hostname, 256) == -1) {
+ gf_msg(this->name, GF_LOG_ERROR, errno, LG_MSG_GETHOSTNAME_FAILED,
+ "gethostname: failed");
+
+ goto fail;
+ }
+
+ ret = gf_asprintf(&process_uuid_xl, GLUSTER_PROCESS_UUID_FMT,
+ this->ctx->process_uuid, this->graph->id, getpid(),
+ hostname, this->name, counter_str);
+ if (-1 == ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PROCESS_UUID_SET_FAIL,
+ "asprintf failed while "
+ "setting process_uuid");
+ goto fail;
+ }
+
+ ret = dict_set_dynstr(options, "process-uuid", process_uuid_xl);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set process-uuid(%s) in handshake msg",
+ process_uuid_xl);
+ goto fail;
+ }
+
+ ret = dict_set_str(options, "process-name",
+ this->ctx->cmd_args.process_name);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set process-name in handshake msg");
+ }
+
+ ret = dict_set_str(options, "client-version", PACKAGE_VERSION);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set client-version(%s) in handshake msg",
+ PACKAGE_VERSION);
+ }
+
+ if (this->ctx->cmd_args.volfile_server) {
+ if (this->ctx->cmd_args.volfile_id) {
+ ret = dict_set_str(options, "volfile-key",
+ this->ctx->cmd_args.volfile_id);
+ if (ret)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to "
+ "set 'volfile-key'");
+ }
+ ret = dict_set_uint32(options, "volfile-checksum",
+ this->graph->volfile_checksum);
+ if (ret)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "'volfile-checksum'");
+ }
+
+ if (this->ctx->cmd_args.subdir_mount) {
+ ret = dict_set_str(options, "subdir-mount",
+ this->ctx->cmd_args.subdir_mount);
+ if (ret) {
+ gf_log(THIS->name, GF_LOG_ERROR, "Failed to set subdir_mount");
+ /* It makes sense to fail, as per the CLI, we
+ should be doing a subdir_mount */
+ goto fail;
+ }
+ }
+
+ /* Insert a dummy key value pair to avoid failure at server side for
+ * clnt-lk-version with new clients.
+ */
+ ret = dict_set_uint32(options, "clnt-lk-version", 1);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set clnt-lk-version(1) in handshake msg");
+ }
+
+ ret = dict_set_int32(options, "opversion", GD_OP_VERSION_MAX);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "Failed to set client opversion in handshake message");
+ }
+
+ ret = dict_serialized_length(options);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
+ "failed to get serialized length of dict");
+ ret = -1;
+ goto fail;
+ }
+ req.dict.dict_len = ret;
+ req.dict.dict_val = GF_CALLOC(1, req.dict.dict_len,
+ gf_client_mt_clnt_req_buf_t);
+ ret = dict_serialize(options, req.dict.dict_val);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SERIALIZE_FAIL,
+ "failed to serialize "
+ "dictionary");
+ goto fail;
+ }
+
+ fr = create_frame(this, this->ctx->pool);
+ if (!fr)
+ goto fail;
+
+ ret = client_submit_request(this, &req, fr, conf->handshake,
+ GF_HNDSK_SETVOLUME, client_setvolume_cbk, NULL,
+ NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_setvolume_req);
fail:
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- return ret;
+ return ret;
}
int
-select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)
+select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
{
- gf_prog_detail *trav = NULL;
- clnt_conf_t *conf = NULL;
- int ret = -1;
-
- if (!this || !prog) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
- goto out;
+ gf_prog_detail *trav = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+
+ if (!this || !prog) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "xlator not found OR RPC program not found");
+ goto out;
+ }
+
+ conf = this->private;
+ trav = prog;
+
+ while (trav) {
+ /* Select 'programs' */
+ if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
+ (clnt3_3_fop_prog.progver == trav->progver) && !conf->fops) {
+ conf->fops = &clnt3_3_fop_prog;
+ if (conf->rpc)
+ conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
+ ret = 0;
+ }
+
+ if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
+ (clnt4_0_fop_prog.progver == trav->progver)) {
+ conf->fops = &clnt4_0_fop_prog;
+ if (conf->rpc)
+ conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
+ ret = 0;
+ /* this is latest program, lets use it */
+ goto out;
}
- conf = this->private;
- trav = prog;
-
- while (trav) {
- /* Select 'programs' */
- if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
- (clnt3_3_fop_prog.progver == trav->progver) &&
- !conf->fops) {
- conf->fops = &clnt3_3_fop_prog;
- if (conf->rpc)
- conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
- ret = 0;
- }
-
- if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
- (clnt4_0_fop_prog.progver == trav->progver)) {
- conf->fops = &clnt4_0_fop_prog;
- if (conf->rpc)
- conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
- ret = 0;
- /* this is latest program, lets use it */
- goto out;
- }
-
- if (ret) {
- gf_msg_debug (this->name, 0,
- "%s (%"PRId64") not supported",
- trav->progname, trav->progver);
- }
- trav = trav->next;
+ if (ret) {
+ gf_msg_debug(this->name, 0, "%s (%" PRId64 ") not supported",
+ trav->progname, trav->progver);
}
+ trav = trav->next;
+ }
- if (!ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_VERSION_INFO, "Using Program %s,"
- " Num (%d), Version (%d)",
- conf->fops->progname, conf->fops->prognum,
- conf->fops->progver);
+ if (!ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VERSION_INFO,
+ "Using Program %s,"
+ " Num (%d), Version (%d)",
+ conf->fops->progname, conf->fops->prognum, conf->fops->progver);
out:
- return ret;
+ return ret;
}
-
int
-server_has_portmap (xlator_t *this, gf_prog_detail *prog)
+server_has_portmap(xlator_t *this, gf_prog_detail *prog)
{
- gf_prog_detail *trav = NULL;
- int ret = -1;
+ gf_prog_detail *trav = NULL;
+ int ret = -1;
- if (!this || !prog) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
- goto out;
- }
+ if (!this || !prog) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "xlator not found OR RPC program not found");
+ goto out;
+ }
- trav = prog;
+ trav = prog;
- while (trav) {
- if ((trav->prognum == GLUSTER_PMAP_PROGRAM) &&
- (trav->progver == GLUSTER_PMAP_VERSION)) {
- gf_msg_debug (this->name, 0,
- "detected portmapper on server");
- ret = 0;
- break;
- }
- trav = trav->next;
+ while (trav) {
+ if ((trav->prognum == GLUSTER_PMAP_PROGRAM) &&
+ (trav->progver == GLUSTER_PMAP_VERSION)) {
+ gf_msg_debug(this->name, 0, "detected portmapper on server");
+ ret = 0;
+ break;
}
+ trav = trav->next;
+ }
out:
- return ret;
+ return ret;
}
-
int
-client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
+client_query_portmap_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- struct pmap_port_by_brick_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- int ret = -1;
- struct rpc_clnt_config config = {0, };
- xlator_t *this = NULL;
-
- frame = myframe;
- if (!frame || !frame->this || !frame->this->private) {
- gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "frame not found with rpc "
- "request");
- goto out;
- }
- this = frame->this;
- conf = frame->this->private;
-
- if (-1 == req->rpc_status) {
- gf_msg (this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "try again later");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- if (!conf->portmap_err_logged) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_PORT_NUM_ERROR, "failed to get the "
- "port number for remote subvolume. Please run "
- "'gluster volume status' on server to see if "
- "brick process is running.");
- } else {
- gf_msg_debug (this->name, 0,
- "failed to get the port number for "
- "remote subvolume. Please run 'gluster "
- "volume status' on server to see "
- "if brick process is running.");
- }
- conf->portmap_err_logged = 1;
- goto out;
+ struct pmap_port_by_brick_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+ struct rpc_clnt_config config = {
+ 0,
+ };
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ if (!frame || !frame->this || !frame->this->private) {
+ gf_msg(THIS->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "frame not found with rpc "
+ "request");
+ goto out;
+ }
+ this = frame->this;
+ conf = frame->this->private;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOTCONN, PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "try again later");
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ goto out;
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ if (!conf->portmap_err_logged) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PORT_NUM_ERROR,
+ "failed to get the "
+ "port number for remote subvolume. Please run "
+ "'gluster volume status' on server to see if "
+ "brick process is running.");
+ } else {
+ gf_msg_debug(this->name, 0,
+ "failed to get the port number for "
+ "remote subvolume. Please run 'gluster "
+ "volume status' on server to see "
+ "if brick process is running.");
}
+ conf->portmap_err_logged = 1;
+ goto out;
+ }
- conf->portmap_err_logged = 0;
- conf->disconnect_err_logged = 0;
- config.remote_port = rsp.port;
- rpc_clnt_reconfig (conf->rpc, &config);
+ conf->portmap_err_logged = 0;
+ conf->disconnect_err_logged = 0;
+ config.remote_port = rsp.port;
+ rpc_clnt_reconfig(conf->rpc, &config);
- conf->skip_notify = 1;
- conf->quick_reconnect = 1;
+ conf->skip_notify = 1;
+ conf->quick_reconnect = 1;
out:
- if (frame)
- STACK_DESTROY (frame->root);
+ if (frame)
+ STACK_DESTROY(frame->root);
- if (conf) {
- /* Need this to connect the same transport on different port */
- /* ie, glusterd to glusterfsd */
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
- }
+ if (conf) {
+ /* Need this to connect the same transport on different port */
+ /* ie, glusterd to glusterfsd */
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
+ }
- return ret;
+ return ret;
}
-
int
-client_query_portmap (xlator_t *this, struct rpc_clnt *rpc)
+client_query_portmap(xlator_t *this, struct rpc_clnt *rpc)
{
- int ret = -1;
- pmap_port_by_brick_req req = {0,};
- call_frame_t *fr = NULL;
- dict_t *options = NULL;
- char *remote_subvol = NULL;
- char *xprt = NULL;
- char brick_name[PATH_MAX] = {0,};
-
- options = this->options;
-
- ret = dict_get_str (options, "remote-subvolume", &remote_subvol);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
- "remote-subvolume not set in volfile");
- goto fail;
- }
-
- req.brick = remote_subvol;
-
- if (!dict_get_str (options, "transport-type", &xprt)) {
- if (!strcmp (xprt, "rdma")) {
- snprintf (brick_name, sizeof(brick_name), "%s.rdma",
- remote_subvol);
- req.brick = brick_name;
- }
- }
-
- fr = create_frame (this, this->ctx->pool);
- if (!fr) {
- ret = -1;
- goto fail;
- }
-
- ret = client_submit_request (this, &req, fr, &clnt_pmap_prog,
- GF_PMAP_PORTBYBRICK,
- client_query_portmap_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_pmap_port_by_brick_req);
+ int ret = -1;
+ pmap_port_by_brick_req req = {
+ 0,
+ };
+ call_frame_t *fr = NULL;
+ dict_t *options = NULL;
+ char *remote_subvol = NULL;
+ char *xprt = NULL;
+ char brick_name[PATH_MAX] = {
+ 0,
+ };
+
+ options = this->options;
+
+ ret = dict_get_str(options, "remote-subvolume", &remote_subvol);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
+ "remote-subvolume not set in volfile");
+ goto fail;
+ }
+
+ req.brick = remote_subvol;
+
+ if (!dict_get_str(options, "transport-type", &xprt)) {
+ if (!strcmp(xprt, "rdma")) {
+ snprintf(brick_name, sizeof(brick_name), "%s.rdma", remote_subvol);
+ req.brick = brick_name;
+ }
+ }
+
+ fr = create_frame(this, this->ctx->pool);
+ if (!fr) {
+ ret = -1;
+ goto fail;
+ }
+
+ ret = client_submit_request(this, &req, fr, &clnt_pmap_prog,
+ GF_PMAP_PORTBYBRICK, client_query_portmap_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_pmap_port_by_brick_req);
fail:
- return ret;
+ return ret;
}
-
int
-client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client_dump_version_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gf_dump_rsp rsp = {0,};
- gf_prog_detail *trav = NULL;
- gf_prog_detail *next = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- int ret = 0;
-
- frame = myframe;
- conf = frame->this->private;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_VERSION_ERROR, "failed to get the 'versions' "
- "from server");
- goto out;
- }
-
- if (server_has_portmap (frame->this, rsp.prog) == 0) {
- ret = client_query_portmap (frame->this, conf->rpc);
- goto out;
- }
-
- /* Check for the proper version string */
- /* Reply in "Name:Program-Number:Program-Version,..." format */
- ret = select_server_supported_programs (frame->this, rsp.prog);
- if (ret) {
- gf_msg (frame->this->name, GF_LOG_ERROR, 0,
- PC_MSG_VERSION_ERROR, "server doesn't support the "
- "version");
- goto out;
- }
-
- client_setvolume (frame->this, conf->rpc);
+ gf_dump_rsp rsp = {
+ 0,
+ };
+ gf_prog_detail *trav = NULL;
+ gf_prog_detail *next = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ frame = myframe;
+ conf = frame->this->private;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ goto out;
+ }
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VERSION_ERROR,
+ "failed to get the 'versions' "
+ "from server");
+ goto out;
+ }
+
+ if (server_has_portmap(frame->this, rsp.prog) == 0) {
+ ret = client_query_portmap(frame->this, conf->rpc);
+ goto out;
+ }
+
+ /* Check for the proper version string */
+ /* Reply in "Name:Program-Number:Program-Version,..." format */
+ ret = select_server_supported_programs(frame->this, rsp.prog);
+ if (ret) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, 0, PC_MSG_VERSION_ERROR,
+ "server doesn't support the "
+ "version");
+ goto out;
+ }
+
+ client_setvolume(frame->this, conf->rpc);
out:
- /* don't use GF_FREE, buffer was allocated by libc */
- if (rsp.prog) {
- trav = rsp.prog;
- while (trav) {
- next = trav->next;
- free (trav->progname);
- free (trav);
- trav = next;
- }
+ /* don't use GF_FREE, buffer was allocated by libc */
+ if (rsp.prog) {
+ trav = rsp.prog;
+ while (trav) {
+ next = trav->next;
+ free(trav->progname);
+ free(trav);
+ trav = next;
}
+ }
- STACK_DESTROY (frame->root);
+ STACK_DESTROY(frame->root);
- if (ret != 0)
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
+ if (ret != 0)
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
- return ret;
+ return ret;
}
int
-client_handshake (xlator_t *this, struct rpc_clnt *rpc)
+client_handshake(xlator_t *this, struct rpc_clnt *rpc)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- gf_dump_req req = {0,};
- int ret = 0;
-
- conf = this->private;
- if (!conf->handshake) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "handshake program not found");
- goto out;
- }
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame)
- goto out;
-
- req.gfs_id = 0xbabe;
- ret = client_submit_request (this, &req, frame, conf->dump,
- GF_DUMP_DUMP, client_dump_version_cbk,
- NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gf_dump_req);
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ gf_dump_req req = {
+ 0,
+ };
+ int ret = 0;
+
+ conf = this->private;
+ if (!conf->handshake) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "handshake program not found");
+ goto out;
+ }
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame)
+ goto out;
+
+ req.gfs_id = 0xbabe;
+ ret = client_submit_request(this, &req, frame, conf->dump, GF_DUMP_DUMP,
+ client_dump_version_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gf_dump_req);
out:
- return ret;
+ return ret;
}
char *clnt_handshake_procs[GF_HNDSK_MAXVALUE] = {
- [GF_HNDSK_NULL] = "NULL",
- [GF_HNDSK_SETVOLUME] = "SETVOLUME",
- [GF_HNDSK_GETSPEC] = "GETSPEC",
- [GF_HNDSK_PING] = "PING",
+ [GF_HNDSK_NULL] = "NULL",
+ [GF_HNDSK_SETVOLUME] = "SETVOLUME",
+ [GF_HNDSK_GETSPEC] = "GETSPEC",
+ [GF_HNDSK_PING] = "PING",
};
rpc_clnt_prog_t clnt_handshake_prog = {
- .progname = "GlusterFS Handshake",
- .prognum = GLUSTER_HNDSK_PROGRAM,
- .progver = GLUSTER_HNDSK_VERSION,
- .procnames = clnt_handshake_procs,
+ .progname = "GlusterFS Handshake",
+ .prognum = GLUSTER_HNDSK_PROGRAM,
+ .progver = GLUSTER_HNDSK_VERSION,
+ .procnames = clnt_handshake_procs,
};
char *clnt_dump_proc[GF_DUMP_MAXVALUE] = {
- [GF_DUMP_NULL] = "NULL",
- [GF_DUMP_DUMP] = "DUMP",
+ [GF_DUMP_NULL] = "NULL",
+ [GF_DUMP_DUMP] = "DUMP",
};
rpc_clnt_prog_t clnt_dump_prog = {
- .progname = "GF-DUMP",
- .prognum = GLUSTER_DUMP_PROGRAM,
- .progver = GLUSTER_DUMP_VERSION,
- .procnames = clnt_dump_proc,
+ .progname = "GF-DUMP",
+ .prognum = GLUSTER_DUMP_PROGRAM,
+ .progver = GLUSTER_DUMP_VERSION,
+ .procnames = clnt_dump_proc,
};
char *clnt_pmap_procs[GF_PMAP_MAXVALUE] = {
- [GF_PMAP_PORTBYBRICK] = "PORTBYBRICK",
+ [GF_PMAP_PORTBYBRICK] = "PORTBYBRICK",
};
rpc_clnt_prog_t clnt_pmap_prog = {
- .progname = "PORTMAP",
- .prognum = GLUSTER_PMAP_PROGRAM,
- .progver = GLUSTER_PMAP_VERSION,
- .procnames = clnt_pmap_procs,
+ .progname = "PORTMAP",
+ .prognum = GLUSTER_PMAP_PROGRAM,
+ .progver = GLUSTER_PMAP_VERSION,
+ .procnames = clnt_pmap_procs,
};
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index f077fc2a73c..e81f166ba46 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -16,3007 +16,2761 @@
#include "common-utils.h"
int
-client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
+client_fd_lk_list_empty(fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
{
- int ret = 1;
+ int ret = 1;
- if (!lk_ctx) {
- ret = -1;
- goto out;
- }
+ if (!lk_ctx) {
+ ret = -1;
+ goto out;
+ }
- if (try_lock) {
- ret = TRY_LOCK (&lk_ctx->lock);
- if (ret != 0) {
- ret = -1;
- goto out;
- }
- } else {
- LOCK (&lk_ctx->lock);
+ if (try_lock) {
+ ret = TRY_LOCK(&lk_ctx->lock);
+ if (ret != 0) {
+ ret = -1;
+ goto out;
}
+ } else {
+ LOCK(&lk_ctx->lock);
+ }
- ret = list_empty (&lk_ctx->lk_list);
- UNLOCK (&lk_ctx->lock);
+ ret = list_empty(&lk_ctx->lk_list);
+ UNLOCK(&lk_ctx->lock);
out:
- return ret;
+ return ret;
}
clnt_fd_ctx_t *
-this_fd_del_ctx (fd_t *file, xlator_t *this)
+this_fd_del_ctx(fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
- dict_ret = fd_ctx_del (file, this, &ctxaddr);
+ dict_ret = fd_ctx_del(file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
}
-
clnt_fd_ctx_t *
-this_fd_get_ctx (fd_t *file, xlator_t *this)
+this_fd_get_ctx(fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
- dict_ret = fd_ctx_get (file, this, &ctxaddr);
+ dict_ret = fd_ctx_get(file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
}
-
void
-this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
+this_fd_set_ctx(fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
{
- uint64_t oldaddr = 0;
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
-
- ret = fd_ctx_get (file, this, &oldaddr);
- if (ret >= 0) {
- if (loc)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_FD_DUPLICATE_TRY,
- "%s (%s): trying duplicate remote fd set. ",
- loc->path, uuid_utoa (loc->inode->gfid));
- else
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_FD_DUPLICATE_TRY,
- "%p: trying duplicate remote fd set. ", file);
- }
-
- ret = fd_ctx_set (file, this, (uint64_t)(unsigned long)ctx);
- if (ret < 0) {
- if (loc)
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_FD_SET_FAIL,
- "%s (%s): failed to set remote fd",
- loc->path, uuid_utoa (loc->inode->gfid));
- else
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_FD_SET_FAIL,
- "%p: failed to set remote fd", file);
- }
+ uint64_t oldaddr = 0;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
+
+ ret = fd_ctx_get(file, this, &oldaddr);
+ if (ret >= 0) {
+ if (loc)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "%s (%s): trying duplicate remote fd set. ", loc->path,
+ uuid_utoa(loc->inode->gfid));
+ else
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "%p: trying duplicate remote fd set. ", file);
+ }
+
+ ret = fd_ctx_set(file, this, (uint64_t)(unsigned long)ctx);
+ if (ret < 0) {
+ if (loc)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "%s (%s): failed to set remote fd", loc->path,
+ uuid_utoa(loc->inode->gfid));
+ else
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "%p: failed to set remote fd", file);
+ }
out:
- return;
+ return;
}
-
int
-client_local_wipe (clnt_local_t *local)
+client_local_wipe(clnt_local_t *local)
{
- if (local) {
- loc_wipe (&local->loc);
- loc_wipe (&local->loc2);
-
- if (local->fd) {
- fd_unref (local->fd);
- }
+ if (local) {
+ loc_wipe(&local->loc);
+ loc_wipe(&local->loc2);
- if (local->iobref) {
- iobref_unref (local->iobref);
- }
+ if (local->fd) {
+ fd_unref(local->fd);
+ }
- GF_FREE (local->name);
- local->compound_args = NULL;
- mem_put (local);
+ if (local->iobref) {
+ iobref_unref(local->iobref);
}
- return 0;
+ GF_FREE(local->name);
+ local->compound_args = NULL;
+ mem_put(local);
+ }
+
+ return 0;
}
int
-unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp,
- gf_dirent_t *entries)
+unserialize_rsp_dirent(xlator_t *this, struct gfs3_readdir_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfs3_dirlist *trav = NULL;
- gf_dirent_t *entry = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_dirlist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
+ conf = this->private;
- trav = rsp->reply;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ trav = rsp->reply;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-unserialize_rsp_direntp (xlator_t *this, fd_t *fd,
- struct gfs3_readdirp_rsp *rsp, gf_dirent_t *entries)
+unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfs3_dirplist *trav = NULL;
- char *buf = NULL;
- gf_dirent_t *entry = NULL;
- inode_table_t *itable = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
-
- trav = rsp->reply;
+ struct gfs3_dirplist *trav = NULL;
+ char *buf = NULL;
+ gf_dirent_t *entry = NULL;
+ inode_table_t *itable = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+
+ trav = rsp->reply;
+
+ if (fd)
+ itable = fd->inode->table;
+
+ conf = this->private;
+ if (!conf)
+ goto out;
+
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
+
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
+
+ gf_stat_to_iatt(&trav->stat, &entry->d_stat);
+
+ strcpy(entry->d_name, trav->name);
+
+ if (trav->dict.dict_val) {
+ /* Dictionary is sent along with response */
+ buf = memdup(trav->dict.dict_val, trav->dict.dict_len);
+ if (!buf)
+ goto out;
- if (fd)
- itable = fd->inode->table;
+ entry->dict = dict_new();
- conf = this->private;
- if (!conf)
+ ret = dict_unserialize(buf, trav->dict.dict_len, &entry->dict);
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_DICT_UNSERIALIZE_FAIL,
+ "failed to unserialize xattr dict");
goto out;
+ }
+ GF_FREE(buf);
+ buf = NULL;
+ }
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
-
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
-
- gf_stat_to_iatt (&trav->stat, &entry->d_stat);
-
- strcpy (entry->d_name, trav->name);
-
- if (trav->dict.dict_val) {
- /* Dictionary is sent along with response */
- buf = memdup (trav->dict.dict_val, trav->dict.dict_len);
- if (!buf)
- goto out;
-
- entry->dict = dict_new ();
-
- ret = dict_unserialize (buf, trav->dict.dict_len,
- &entry->dict);
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_UNSERIALIZE_FAIL,
- "failed to unserialize xattr dict");
- goto out;
- }
- GF_FREE (buf);
- buf = NULL;
- }
-
- entry->inode = inode_find (itable, entry->d_stat.ia_gfid);
- if (!entry->inode)
- entry->inode = inode_new (itable);
+ entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
+ if (!entry->inode)
+ entry->inode = inode_new(itable);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- if (buf)
- GF_FREE (buf);
- return ret;
+ if (buf)
+ GF_FREE(buf);
+ return ret;
}
int
-clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp)
+clnt_readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp)
{
- gfs3_dirplist *prev = NULL;
- gfs3_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirplist *prev = NULL;
+ gfs3_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->dict.dict_val);
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->dict.dict_val);
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-unserialize_rsp_dirent_v2 (xlator_t *this, struct gfx_readdir_rsp *rsp,
- gf_dirent_t *entries)
+unserialize_rsp_dirent_v2(xlator_t *this, struct gfx_readdir_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfx_dirlist *trav = NULL;
- gf_dirent_t *entry = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfx_dirlist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
+ conf = this->private;
- trav = rsp->reply;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ trav = rsp->reply;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-unserialize_rsp_direntp_v2 (xlator_t *this, fd_t *fd,
- struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
+unserialize_rsp_direntp_v2(xlator_t *this, fd_t *fd,
+ struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
{
- struct gfx_dirplist *trav = NULL;
- gf_dirent_t *entry = NULL;
- inode_table_t *itable = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfx_dirplist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ inode_table_t *itable = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- if (fd)
- itable = fd->inode->table;
+ if (fd)
+ itable = fd->inode->table;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- gfx_stat_to_iattx (&trav->stat, &entry->d_stat);
+ gfx_stat_to_iattx(&trav->stat, &entry->d_stat);
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- xdr_to_dict (&trav->dict, &entry->dict);
+ xdr_to_dict(&trav->dict, &entry->dict);
- entry->inode = inode_find (itable, entry->d_stat.ia_gfid);
- if (!entry->inode)
- entry->inode = inode_new (itable);
+ entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
+ if (!entry->inode)
+ entry->inode = inode_new(itable);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-clnt_readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp)
+clnt_readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp)
{
- gfx_dirplist *prev = NULL;
- gfx_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirplist *prev = NULL;
+ gfx_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp)
+clnt_readdir_rsp_cleanup(gfs3_readdir_rsp *rsp)
{
- gfs3_dirlist *prev = NULL;
- gfs3_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirlist *prev = NULL;
+ gfs3_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-clnt_readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp)
+clnt_readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp)
{
- gfx_dirlist *prev = NULL;
- gfx_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirlist *prev = NULL;
+ gfx_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-client_get_remote_fd (xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
+client_get_remote_fd(xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
{
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_conf_t *conf = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, fd, out);
- GF_VALIDATE_OR_GOTO (this->name, remote_fd, out);
-
- conf = this->private;
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- *remote_fd = GF_ANON_FD_NO;
- } else {
- if (__is_fd_reopen_in_progress (fdctx))
- *remote_fd = -1;
- else
- *remote_fd = fdctx->remote_fd;
- }
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_conf_t *conf = NULL;
+
+ GF_VALIDATE_OR_GOTO(this->name, fd, out);
+ GF_VALIDATE_OR_GOTO(this->name, remote_fd, out);
+
+ conf = this->private;
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ *remote_fd = GF_ANON_FD_NO;
+ } else {
+ if (__is_fd_reopen_in_progress(fdctx))
+ *remote_fd = -1;
+ else
+ *remote_fd = fdctx->remote_fd;
}
- pthread_spin_unlock (&conf->fd_lock);
+ }
+ pthread_spin_unlock(&conf->fd_lock);
- if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1))
- *remote_fd = GF_ANON_FD_NO;
+ if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1))
+ *remote_fd = GF_ANON_FD_NO;
- return 0;
+ return 0;
out:
- return -1;
+ return -1;
}
gf_boolean_t
-client_is_reopen_needed (fd_t *fd, xlator_t *this, int64_t remote_fd)
+client_is_reopen_needed(fd_t *fd, xlator_t *this, int64_t remote_fd)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- gf_boolean_t res = _gf_false;
-
- conf = this->private;
- pthread_spin_lock(&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (fdctx && (fdctx->remote_fd == -1) &&
- (remote_fd == GF_ANON_FD_NO))
- res = _gf_true;
- }
- pthread_spin_unlock(&conf->fd_lock);
-
- return res;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ gf_boolean_t res = _gf_false;
+
+ conf = this->private;
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (fdctx && (fdctx->remote_fd == -1) && (remote_fd == GF_ANON_FD_NO))
+ res = _gf_true;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ return res;
}
int
-client_fd_fop_prepare_local (call_frame_t *frame, fd_t *fd, int64_t remote_fd)
+client_fd_fop_prepare_local(call_frame_t *frame, fd_t *fd, int64_t remote_fd)
{
- xlator_t *this = NULL;
- clnt_local_t *local = NULL;
- int ret = 0;
+ xlator_t *this = NULL;
+ clnt_local_t *local = NULL;
+ int ret = 0;
- if (!frame || !fd) {
- ret = -EINVAL;
- goto out;
- }
+ if (!frame || !fd) {
+ ret = -EINVAL;
+ goto out;
+ }
- this = frame->this;
+ this = frame->this;
- frame->local = mem_get0 (this->local_pool);
- if (frame->local == NULL) {
- ret = -ENOMEM;
- goto out;
- }
+ frame->local = mem_get0(this->local_pool);
+ if (frame->local == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
- local = frame->local;
- local->fd = fd_ref (fd);
- local->attempt_reopen = client_is_reopen_needed (fd, this, remote_fd);
+ local = frame->local;
+ local->fd = fd_ref(fd);
+ local->attempt_reopen = client_is_reopen_needed(fd, this, remote_fd);
- return 0;
+ return 0;
out:
- return ret;
+ return ret;
}
int
-client_process_response (call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfs3_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk,
- int index)
+client_process_response(call_frame_t *frame, xlator_t *this,
+ struct rpc_req *req, gfs3_compound_rsp *rsp,
+ compound_args_cbk_t *args_cbk, int index)
{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD (&entries.list);
-
- switch (args_cbk->enum_list[index]) {
+ int ret = 0;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ gf_dirent_t entries;
+ default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
+ clnt_local_t *local = frame->local;
+ compound_rsp *this_rsp = NULL;
+ compound_args_t *args = local->compound_args;
+
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ args_cbk->enum_list[index] = this_rsp->fop_enum;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ switch (args_cbk->enum_list[index]) {
+ case GF_FOP_STAT: {
+ gfs3_stat_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_stat_rsp;
+
+ client_post_stat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
+
+ CLIENT_POST_FOP_TYPE(stat, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfs3_readlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+
+ client_post_readlink(this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ CLIENT_POST_FOP_TYPE(readlink, this_rsp, this_args_cbk,
+ tmp_rsp->path, &this_args_cbk->stat, xdata);
+ break;
+ }
+ case GF_FOP_MKNOD: {
+ gfs3_mknod_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+
+ client_post_mknod(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(mknod, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+
+ client_post_mkdir(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(mkdir, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+
+ client_post_unlink(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(unlink, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+
+ client_post_rmdir(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(rmdir, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+
+ client_post_symlink(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ symlink, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfs3_rename_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rename_rsp;
+
+ client_post_rename(
+ this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &this_args_cbk->preparent2,
+ &this_args_cbk->postparent2, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
+ break;
+ }
+ case GF_FOP_LINK: {
+ gfs3_link_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_link_rsp;
+
+ client_post_link(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ link, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_TRUNCATE: {
+ gfs3_truncate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+
+ client_post_truncate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT_POST_FOP_TYPE(truncate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_OPEN: {
+ gfs3_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_open_rsp;
+
+ client_post_open(this, tmp_rsp, &xdata);
+ CLIENT_POST_FOP_TYPE(open, this_rsp, this_args_cbk, local->fd,
+ xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
+ }
+ case GF_FOP_READ: {
+ gfs3_read_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_read_rsp;
+
+ client_post_readv(this, tmp_rsp, &this_args_cbk->iobref,
+ req->rsp_iobref, &this_args_cbk->stat, vector,
+ &req->rsp[1], &this_args_cbk->count, &xdata);
+
+ /* Each read should be given read response that only
+ * corresponds to its request.
+ * Modify the iovecs accordingly.
+ * After each read, store the length of data already read
+ * so that the next ones can continue from there.
+ */
+ if (local->read_length) {
+ vector[0].iov_base += local->read_length;
+ local->read_length += tmp_rsp->op_ret;
+ } else {
+ local->read_length = tmp_rsp->op_ret;
+ }
+
+ args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno), vector,
+ this_args_cbk->count, &this_args_cbk->stat,
+ this_args_cbk->iobref, xdata);
+
+ if (tmp_rsp->op_ret >= 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+
+ break;
+ }
+ case GF_FOP_WRITE: {
+ gfs3_write_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_write_rsp;
+
+ client_post_writev(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ args_writev_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno),
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+
+ if (tmp_rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfs3_statfs_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_statfs_rsp;
+
+ client_post_statfs(this, tmp_rsp, &this_args_cbk->statvfs, &xdata);
+
+ CLIENT_POST_FOP_TYPE(statfs, this_rsp, this_args_cbk,
+ &this_args_cbk->statvfs, xdata);
+ break;
+ }
+ case GF_FOP_FLUSH: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_flush_rsp;
+
+ client_post_flush(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
+ if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+ break;
+ }
+ case GF_FOP_FSYNC: {
+ gfs3_fsync_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+
+ client_post_fsync(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+
+ CLIENT_POST_FOP_TYPE(fsync, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_SETXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ client_post_setxattr(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+
+ client_post_getxattr(this, tmp_rsp, &xattr, &xdata);
+
+ CLIENT_POST_FOP_TYPE(getxattr, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+
+ client_post_removexattr(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(removexattr, this_rsp, this_args_cbk, xdata);
+ break;
+ }
+ case GF_FOP_OPENDIR: {
+ gfs3_opendir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_opendir_rsp;
- case GF_FOP_STAT:
- {
- gfs3_stat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_stat_rsp;
-
- client_post_stat (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_opendir(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (stat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(opendir, this_rsp, this_args_cbk, local->fd,
+ xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfs3_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+ case GF_FOP_FSYNCDIR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
- client_post_readlink (this, tmp_rsp, &this_args_cbk->stat,
- &xdata);
- CLIENT_POST_FOP_TYPE (readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat,
- xdata);
- break;
- }
- case GF_FOP_MKNOD:
- {
- gfs3_mknod_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+ client_post_fsyncdir(this, tmp_rsp, &xdata);
- client_post_mknod (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (mknod, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP(fsyncdir, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+ case GF_FOP_ACCESS: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_access_rsp;
- client_post_mkdir (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (mkdir, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+ client_post_access(this, tmp_rsp, &xdata);
- client_post_unlink (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (unlink, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP(access, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+ case GF_FOP_CREATE: {
+ gfs3_create_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_create_rsp;
- client_post_rmdir (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (rmdir, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+ client_post_create(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, local, &xdata);
- client_post_symlink (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (symlink, this_rsp, this_args_cbk, NULL,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(create, this_rsp, this_args_cbk, local->fd,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_RENAME:
- {
- gfs3_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rename_rsp;
-
- client_post_rename (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT_POST_FOP_TYPE (rename, this_rsp, this_args_cbk,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, xdata);
- break;
- }
- case GF_FOP_LINK:
- {
- gfs3_link_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_link_rsp;
+ case GF_FOP_FTRUNCATE: {
+ gfs3_ftruncate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
- client_post_link (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (link, this_rsp, this_args_cbk, NULL,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ client_post_ftruncate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT_POST_FOP_TYPE(ftruncate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfs3_truncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+ case GF_FOP_FSTAT: {
+ gfs3_fstat_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fstat_rsp;
- client_post_truncate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (truncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN:
- {
- gfs3_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_open_rsp;
+ client_post_fstat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
- client_post_open (this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (open, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd,
- 0);
- break;
+ CLIENT_POST_FOP_TYPE(fstat, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
}
- case GF_FOP_READ:
- {
- gfs3_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_read_rsp;
-
- client_post_readv (this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat,
- vector, &req->rsp[1], &this_args_cbk->count,
- &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
+ case GF_FOP_LK: {
+ gfs3_lk_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lk_rsp;
- args_readv_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- vector, this_args_cbk->count,
- &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
+ client_post_lk(this, tmp_rsp, &this_args_cbk->lock, &xdata);
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
-
- break;
+ CLIENT_POST_FOP_TYPE(lk, this_rsp, this_args_cbk,
+ &this_args_cbk->lock, xdata);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfs3_write_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_write_rsp;
-
- client_post_writev (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- args_writev_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lookup_rsp;
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ client_post_lookup(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(lookup, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat, xdata,
+ &this_args_cbk->postparent);
+ break;
}
- case GF_FOP_STATFS:
- {
- gfs3_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_statfs_rsp;
-
- client_post_statfs (this, tmp_rsp, &this_args_cbk->statvfs,
- &xdata);
-
- CLIENT_POST_FOP_TYPE (statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_flush_rsp;
-
- client_post_flush (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP (flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
- break;
- }
- case GF_FOP_FSYNC:
- {
- gfs3_fsync_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+ case GF_FOP_READDIR: {
+ gfs3_readdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readdir_rsp;
- client_post_fsync (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ client_post_readdir(this, tmp_rsp, &entries, &xdata);
- CLIENT_POST_FOP_TYPE (fsync, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(readdir, this_rsp, this_args_cbk, &entries,
+ xdata);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ case GF_FOP_INODELK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
- client_post_setxattr (this, tmp_rsp, &xdata);
+ client_post_inodelk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (setxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(inodelk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+ case GF_FOP_FINODELK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
- client_post_getxattr (this, tmp_rsp, &xattr, &xdata);
+ client_post_finodelk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (getxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP(finodelk, this_rsp, this_args_cbk, xdata);
+ if (tmp_rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+ case GF_FOP_ENTRYLK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
- client_post_removexattr (this, tmp_rsp, &xdata);
+ client_post_entrylk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (removexattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(entrylk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfs3_opendir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_opendir_rsp;
+ case GF_FOP_FENTRYLK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
- client_post_opendir (this, tmp_rsp, &xdata);
+ client_post_fentrylk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (opendir, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ CLIENT_POST_FOP(fentrylk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
- client_post_fsyncdir (this, tmp_rsp, &xdata);
+ client_post_xattrop(this, tmp_rsp, &xattr, &xdata);
- CLIENT_POST_FOP (fsyncdir, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(xattrop, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
}
- case GF_FOP_ACCESS:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_access_rsp;
-
- client_post_access (this, tmp_rsp, &xdata);
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
- CLIENT_POST_FOP (access, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_CREATE:
- {
- gfs3_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_create_rsp;
-
- client_post_create (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT_POST_FOP_TYPE (create, this_rsp, this_args_cbk,
- local->fd, local->loc.inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_FTRUNCATE:
- {
- gfs3_ftruncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
+ client_post_fxattrop(this, tmp_rsp, &xattr, &xdata);
- client_post_ftruncate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (ftruncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fxattrop, this_rsp, this_args_cbk, xattr,
+ xdata);
+ if (rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfs3_fstat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fstat_rsp;
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
- client_post_fstat (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_fgetxattr(this, tmp_rsp, &xattr, &xdata);
- CLIENT_POST_FOP_TYPE (fstat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fgetxattr, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
}
- case GF_FOP_LK:
- {
- gfs3_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lk_rsp;
+ case GF_FOP_FSETXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetxattr_rsp;
- client_post_lk (this, tmp_rsp, &this_args_cbk->lock, &xdata);
+ client_post_fsetxattr(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lookup_rsp;
-
- client_post_lookup (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (lookup, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- xdata, &this_args_cbk->postparent);
- break;
+ CLIENT_POST_FOP(fsetxattr, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_READDIR:
- {
- gfs3_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdir_rsp;
+ case GF_FOP_RCHECKSUM: {
+ gfs3_rchecksum_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
- client_post_readdir (this, tmp_rsp, &entries, &xdata);
+ client_post_rchecksum(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (readdir, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ break;
+ CLIENT_POST_FOP_TYPE(
+ rchecksum, this_rsp, this_args_cbk, tmp_rsp->weak_checksum,
+ (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
+ break;
}
- case GF_FOP_INODELK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
+ case GF_FOP_SETATTR: {
+ gfs3_setattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_setattr_rsp;
- client_post_inodelk (this, tmp_rsp, &xdata);
+ client_post_setattr(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP (inodelk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(setattr, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
+ case GF_FOP_FSETATTR: {
+ gfs3_fsetattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
- client_post_finodelk (this, tmp_rsp, &xdata);
+ client_post_fsetattr(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP (finodelk, this_rsp, this_args_cbk, xdata);
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ CLIENT_POST_FOP_TYPE(fsetattr, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
- client_post_entrylk (this, tmp_rsp, &xdata);
+ client_post_readdirp(this, tmp_rsp, local->fd, &entries, &xdata);
- CLIENT_POST_FOP (entrylk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(readdirp, this_rsp, this_args_cbk, &entries,
+ xdata);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
+ case GF_FOP_FREMOVEXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
- client_post_fentrylk (this, tmp_rsp, &xdata);
+ client_post_fremovexattr(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (fentrylk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(fremovexattr, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
+ case GF_FOP_FALLOCATE: {
+ gfs3_fallocate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
- client_post_xattrop (this, tmp_rsp, &xattr, &xdata);
+ client_post_fallocate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (xattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fallocate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
+ case GF_FOP_DISCARD: {
+ gfs3_discard_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_discard_rsp;
- client_post_fxattrop (this, tmp_rsp, &xattr, &xdata);
+ client_post_discard(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (fxattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- if (rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ CLIENT_POST_FOP_TYPE(discard, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
+ case GF_FOP_ZEROFILL: {
+ gfs3_zerofill_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
- client_post_fgetxattr (this, tmp_rsp, &xattr, &xdata);
+ client_post_zerofill(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (fgetxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(zerofill, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetxattr_rsp;
+ case GF_FOP_IPC: {
+ gfs3_ipc_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_ipc_rsp;
- client_post_fsetxattr (this, tmp_rsp, &xdata);
+ client_post_ipc(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (fsetxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(ipc, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfs3_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
+ case GF_FOP_SEEK: {
+ gfs3_seek_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_seek_rsp;
- client_post_rchecksum (this, tmp_rsp, &xdata);
+ client_post_seek(this, tmp_rsp, &xdata);
- break;
- CLIENT_POST_FOP_TYPE (rchecksum, this_rsp, this_args_cbk,
- tmp_rsp->weak_checksum,
- (uint8_t*)tmp_rsp->strong_checksum.strong_checksum_val,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(seek, this_rsp, this_args_cbk, tmp_rsp->offset,
+ xdata);
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfs3_setattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setattr_rsp;
+ case GF_FOP_LEASE: {
+ gfs3_lease_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lease_rsp;
- client_post_setattr (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ client_post_lease(this, tmp_rsp, &this_args_cbk->lease, &xdata);
- CLIENT_POST_FOP_TYPE (setattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(lease, this_rsp, this_args_cbk,
+ &this_args_cbk->lease, xdata);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfs3_fsetattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
+ default:
+ return -ENOTSUP;
+ }
+
+ if (xdata)
+ dict_unref(xdata);
+ if (xattr)
+ dict_unref(xattr);
+ gf_dirent_free(&entries);
+ return 0;
+}
- client_post_fsetattr (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+int
+client_handle_fop_requirements(
+ xlator_t *this, call_frame_t *frame, gfs3_compound_req *req,
+ clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
+ struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
+ int *rsp_count, default_args_t *args, int fop_enum, int index)
+{
+ int ret = 0;
+ int op_errno = ENOMEM;
+ struct iobuf *rsp_iobuf = NULL;
+ int64_t remote_fd = -1;
+ compound_req *this_req = &req->compound_req_array
+ .compound_req_array_val[index];
- CLIENT_POST_FOP_TYPE (fsetattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
+ this_req->fop_enum = fop_enum;
- client_post_readdirp (this, tmp_rsp, local->fd, &entries,
- &xdata);
+ switch (fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_PRE_FOP(stat, this,
+ &this_req->compound_req_u.compound_stat_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
+ case GF_FOP_READLINK:
+ CLIENT_PRE_FOP(readlink, this,
+ &this_req->compound_req_u.compound_readlink_req,
+ op_errno, out, &args->loc, args->size, args->xdata);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT_PRE_FOP(mknod, this,
+ &this_req->compound_req_u.compound_mknod_req,
+ op_errno, out, &args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT_PRE_FOP(mkdir, this,
+ &this_req->compound_req_u.compound_mkdir_req,
+ op_errno, out, &args->loc, args->mode, args->umask,
+ args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT_PRE_FOP(unlink, this,
+ &this_req->compound_req_u.compound_unlink_req,
+ op_errno, out, &args->loc, args->xflag, args->xdata);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT_PRE_FOP(rmdir, this,
+ &this_req->compound_req_u.compound_rmdir_req,
+ op_errno, out, &args->loc, args->flags, args->xdata);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT_PRE_FOP(symlink, this,
+ &this_req->compound_req_u.compound_symlink_req,
+ op_errno, out, &args->loc, args->linkname,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT_PRE_FOP(rename, this,
+ &this_req->compound_req_u.compound_rename_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
+ case GF_FOP_LINK:
+ CLIENT_PRE_FOP(link, this,
+ &this_req->compound_req_u.compound_link_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT_PRE_FOP(
+ truncate, this, &this_req->compound_req_u.compound_truncate_req,
+ op_errno, out, &args->loc, args->offset, args->xdata);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT_PRE_FOP(
+ open, this, &this_req->compound_req_u.compound_open_req,
+ op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
+ case GF_FOP_READ:
+ op_errno = client_pre_readv(
+ this, &this_req->compound_req_u.compound_read_req, args->fd,
+ args->size, args->offset, args->flags, args->xdata);
- CLIENT_POST_FOP_TYPE (readdirp, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- client_post_fremovexattr (this, tmp_rsp, &xdata);
+ if (!*rsp_iobref) {
+ *rsp_iobref = iobref_new();
+ if (*rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
- CLIENT_POST_FOP (fremovexattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_FALLOCATE:
- {
- gfs3_fallocate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
+ if (*rsp_count + 1 >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
+ iobref_add(*rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ if (args->size > rsp_vector[*rsp_count].iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size "
+ "(%lu)",
+ (unsigned long)args->size,
+ (unsigned long)rsp_vector[*rsp_count].iov_len);
+ op_errno = EINVAL;
+ goto out;
+ }
+ *rsp_count += 1;
- client_post_fallocate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ break;
+ case GF_FOP_WRITE:
+ op_errno = client_pre_writev(
+ this, &this_req->compound_req_u.compound_write_req, args->fd,
+ iov_length(args->vector, args->count), args->offset,
+ args->flags, &args->xdata);
- CLIENT_POST_FOP_TYPE (fallocate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+
+ if (*req_count + args->count >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ memcpy(&req_vector[*req_count], args->vector,
+ (args->count * sizeof(req_vector[0])));
+ *req_count += args->count;
+
+ if (!*req_iobref)
+ *req_iobref = args->iobref;
+ else if (iobref_merge(*req_iobref, args->iobref))
+ goto out;
+ break;
+ case GF_FOP_STATFS:
+ CLIENT_PRE_FOP(statfs, this,
+ &this_req->compound_req_u.compound_statfs_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
+ case GF_FOP_FLUSH:
+ CLIENT_PRE_FOP(flush, this,
+ &this_req->compound_req_u.compound_flush_req,
+ op_errno, out, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT_PRE_FOP(
+ fsync, this, &this_req->compound_req_u.compound_fsync_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
+ case GF_FOP_SETXATTR:
+ CLIENT_PRE_FOP(setxattr, this,
+ &this_req->compound_req_u.compound_setxattr_req,
+ op_errno, out, &args->loc, args->xattr, args->flags,
+ args->xdata);
+ break;
+ case GF_FOP_GETXATTR:
+ CLIENT_PRE_FOP(getxattr, this,
+ &this_req->compound_req_u.compound_getxattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_PRE_FOP(removexattr, this,
+ &this_req->compound_req_u.compound_removexattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT_PRE_FOP(opendir, this,
+ &this_req->compound_req_u.compound_opendir_req,
+ op_errno, out, &args->loc, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT_PRE_FOP(
+ fsyncdir, this, &this_req->compound_req_u.compound_fsyncdir_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT_PRE_FOP(access, this,
+ &this_req->compound_req_u.compound_access_req,
+ op_errno, out, &args->loc, args->mask, args->xdata);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT_PRE_FOP(create, this,
+ &this_req->compound_req_u.compound_create_req,
+ op_errno, out, &args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT_PRE_FOP(ftruncate, this,
+ &this_req->compound_req_u.compound_ftruncate_req,
+ op_errno, out, args->fd, args->offset, args->xdata);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT_PRE_FOP(fstat, this,
+ &this_req->compound_req_u.compound_fstat_req,
+ op_errno, out, args->fd, args->xdata);
+ break;
+ case GF_FOP_LK:
+ CLIENT_PRE_FOP(lk, this, &this_req->compound_req_u.compound_lk_req,
+ op_errno, out, args->cmd, &args->lock, args->fd,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT_PRE_FOP(lookup, this,
+ &this_req->compound_req_u.compound_lookup_req,
+ op_errno, out, &args->loc, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_READDIR:
+ CLIENT_PRE_FOP(
+ readdir, this, &this_req->compound_req_u.compound_readdir_req,
+ op_errno, out, args->fd, args->size, args->offset, args->xdata);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT_PRE_FOP(inodelk, this,
+ &this_req->compound_req_u.compound_inodelk_req,
+ op_errno, out, &args->loc, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT_PRE_FOP(finodelk, this,
+ &this_req->compound_req_u.compound_finodelk_req,
+ op_errno, out, args->fd, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT_PRE_FOP(
+ entrylk, this, &this_req->compound_req_u.compound_entrylk_req,
+ op_errno, out, &args->loc, args->entrylkcmd, args->entrylktype,
+ args->volume, args->name, args->xdata);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT_PRE_FOP(
+ fentrylk, this, &this_req->compound_req_u.compound_fentrylk_req,
+ op_errno, out, args->fd, args->entrylkcmd, args->entrylktype,
+ args->volume, args->name, args->xdata);
+ break;
+ case GF_FOP_XATTROP:
+ CLIENT_PRE_FOP(xattrop, this,
+ &this_req->compound_req_u.compound_xattrop_req,
+ op_errno, out, &args->loc, args->xattr, args->optype,
+ args->xdata);
+ break;
+ case GF_FOP_FXATTROP:
+ CLIENT_PRE_FOP(fxattrop, this,
+ &this_req->compound_req_u.compound_fxattrop_req,
+ op_errno, out, args->fd, args->xattr, args->optype,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
+ case GF_FOP_FGETXATTR:
+ CLIENT_PRE_FOP(fgetxattr, this,
+ &this_req->compound_req_u.compound_fgetxattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
+ case GF_FOP_FSETXATTR:
+ CLIENT_PRE_FOP(fsetxattr, this,
+ &this_req->compound_req_u.compound_fsetxattr_req,
+ op_errno, out, args->fd, args->flags, args->xattr,
+ args->xdata);
+ break;
+ case GF_FOP_RCHECKSUM:
+ CLIENT_PRE_FOP(rchecksum, this,
+ &this_req->compound_req_u.compound_rchecksum_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT_PRE_FOP(setattr, this,
+ &this_req->compound_req_u.compound_setattr_req,
+ op_errno, out, &args->loc, args->valid, &args->stat,
+ args->xdata);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT_PRE_FOP(
+ fsetattr, this, &this_req->compound_req_u.compound_fsetattr_req,
+ op_errno, out, args->fd, args->valid, &args->stat, args->xdata);
+ break;
+ case GF_FOP_READDIRP:
+ CLIENT_PRE_FOP(
+ readdirp, this, &this_req->compound_req_u.compound_readdirp_req,
+ op_errno, out, args->fd, args->size, args->offset, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_PRE_FOP(fremovexattr, this,
+ &this_req->compound_req_u.compound_fremovexattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT_PRE_FOP(fallocate, this,
+ &this_req->compound_req_u.compound_fallocate_req,
+ op_errno, out, args->fd, args->flags, args->offset,
+ args->size, args->xdata);
+ break;
case GF_FOP_DISCARD:
- {
- gfs3_discard_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_discard_rsp;
-
- client_post_discard (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE (discard, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ discard, this, &this_req->compound_req_u.compound_discard_req,
+ op_errno, out, args->fd, args->offset, args->size, args->xdata);
+ break;
case GF_FOP_ZEROFILL:
- {
- gfs3_zerofill_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
-
- client_post_zerofill (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE (zerofill, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ zerofill, this, &this_req->compound_req_u.compound_zerofill_req,
+ op_errno, out, args->fd, args->offset, args->size, args->xdata);
+ break;
case GF_FOP_IPC:
- {
- gfs3_ipc_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ipc_rsp;
-
- client_post_ipc (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE (ipc, this_rsp, this_args_cbk, xdata);
- break;
- }
+ CLIENT_PRE_FOP(ipc, this,
+ &this_req->compound_req_u.compound_ipc_req, op_errno,
+ out, args->cmd, args->xdata);
+ break;
case GF_FOP_SEEK:
- {
- gfs3_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_seek_rsp;
-
- client_post_seek (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE (seek, this_rsp, this_args_cbk,
- tmp_rsp->offset, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ seek, this, &this_req->compound_req_u.compound_seek_req,
+ op_errno, out, args->fd, args->offset, args->what, args->xdata);
+ break;
case GF_FOP_LEASE:
- {
- gfs3_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lease_rsp;
-
- client_post_lease (this, tmp_rsp, &this_args_cbk->lease,
- &xdata);
-
- CLIENT_POST_FOP_TYPE (lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ lease, this, &this_req->compound_req_u.compound_lease_req,
+ op_errno, out, &args->loc, &args->lease, args->xdata);
+ break;
default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref (xdata);
- if (xattr)
- dict_unref (xattr);
- gf_dirent_free (&entries);
- return 0;
+ return ENOTSUP;
+ }
+ return 0;
+out:
+ return op_errno;
}
-int
-client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
- gfs3_compound_req *req,
- clnt_local_t *local,
- struct iobref **req_iobref,
- struct iobref **rsp_iobref,
- struct iovec *req_vector,
- struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args,
- int fop_enum, int index)
+void
+compound_request_cleanup(gfs3_compound_req *req)
{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req *this_req = &req->compound_req_array.compound_req_array_val[index];
+ int i = 0;
+ int length = req->compound_req_array.compound_req_array_len;
+ compound_req *curr_req = NULL;
- this_req->fop_enum = fop_enum;
+ if (!req->compound_req_array.compound_req_array_val)
+ return;
- switch (fop_enum) {
- case GF_FOP_STAT:
- CLIENT_PRE_FOP (stat, this,
- &this_req->compound_req_u.compound_stat_req,
- op_errno, out,
- &args->loc, args->xdata);
+ for (i = 0; i < length; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
+
+ switch (curr_req->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, stat);
break;
- case GF_FOP_READLINK:
- CLIENT_PRE_FOP (readlink, this,
- &this_req->compound_req_u.compound_readlink_req,
- op_errno, out,
- &args->loc, args->size, args->xdata);
+ case GF_FOP_READLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readlink);
break;
- case GF_FOP_MKNOD:
- CLIENT_PRE_FOP (mknod, this,
- &this_req->compound_req_u.compound_mknod_req,
- op_errno, out,
- &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_MKNOD:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mknod);
break;
- case GF_FOP_MKDIR:
- CLIENT_PRE_FOP (mkdir, this,
- &this_req->compound_req_u.compound_mkdir_req,
- op_errno, out,
- &args->loc, args->mode,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_MKDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
break;
- case GF_FOP_UNLINK:
- CLIENT_PRE_FOP (unlink, this,
- &this_req->compound_req_u.compound_unlink_req,
- op_errno, out,
- &args->loc, args->xflag, args->xdata);
+ case GF_FOP_UNLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, unlink);
break;
- case GF_FOP_RMDIR:
- CLIENT_PRE_FOP (rmdir, this,
- &this_req->compound_req_u.compound_rmdir_req,
- op_errno, out,
- &args->loc, args->flags, args->xdata);
+ case GF_FOP_RMDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
break;
- case GF_FOP_SYMLINK:
- CLIENT_PRE_FOP (symlink, this,
- &this_req->compound_req_u.compound_symlink_req,
- op_errno, out,
- &args->loc, args->linkname, args->umask,
- args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_SYMLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, symlink);
break;
- case GF_FOP_RENAME:
- CLIENT_PRE_FOP (rename, this,
- &this_req->compound_req_u.compound_rename_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
+ case GF_FOP_RENAME:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rename);
break;
- case GF_FOP_LINK:
- CLIENT_PRE_FOP (link, this,
- &this_req->compound_req_u.compound_link_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
+ case GF_FOP_LINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, link);
break;
- case GF_FOP_TRUNCATE:
- CLIENT_PRE_FOP (truncate, this,
- &this_req->compound_req_u.compound_truncate_req,
- op_errno, out,
- &args->loc, args->offset, args->xdata);
+ case GF_FOP_TRUNCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, truncate);
break;
- case GF_FOP_OPEN:
- CLIENT_PRE_FOP (open, this,
- &this_req->compound_req_u.compound_open_req,
- op_errno, out,
- &args->loc, args->fd, args->flags,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
+ case GF_FOP_OPEN:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, open);
break;
- case GF_FOP_READ:
- op_errno = client_pre_readv (this,
- &this_req->compound_req_u.compound_read_req,
- args->fd, args->size, args->offset,
- args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
-
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new ();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize (rsp_iobuf);
- iobref_add (*rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
- }
- *rsp_count += 1;
-
+ case GF_FOP_READ:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, read);
break;
- case GF_FOP_WRITE:
- op_errno = client_pre_writev (this,
- &this_req->compound_req_u.compound_write_req,
- args->fd, iov_length (args->vector, args->count),
- args->offset, args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy (&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
-
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else
- if (iobref_merge (*req_iobref, args->iobref))
- goto out;
+ case GF_FOP_WRITE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, write);
break;
- case GF_FOP_STATFS:
- CLIENT_PRE_FOP (statfs, this,
- &this_req->compound_req_u.compound_statfs_req,
- op_errno, out,
- &args->loc, args->xdata);
+ case GF_FOP_STATFS:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, statfs);
break;
- case GF_FOP_FLUSH:
- CLIENT_PRE_FOP (flush, this,
- &this_req->compound_req_u.compound_flush_req,
- op_errno, out,
- args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
+ case GF_FOP_FLUSH:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, flush);
break;
- case GF_FOP_FSYNC:
- CLIENT_PRE_FOP (fsync, this,
- &this_req->compound_req_u.compound_fsync_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
+ case GF_FOP_FSYNC:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsync);
break;
- case GF_FOP_SETXATTR:
- CLIENT_PRE_FOP (setxattr, this,
- &this_req->compound_req_u.compound_setxattr_req,
- op_errno, out,
- &args->loc, args->xattr, args->flags,
- args->xdata);
+ case GF_FOP_SETXATTR: {
+ gfs3_setxattr_req *args = &CPD_REQ_FIELD(curr_req, setxattr);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
break;
- case GF_FOP_GETXATTR:
- CLIENT_PRE_FOP (getxattr, this,
- &this_req->compound_req_u.compound_getxattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ }
+ case GF_FOP_GETXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_PRE_FOP (removexattr, this,
- &this_req->compound_req_u.compound_removexattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
break;
- case GF_FOP_OPENDIR:
- CLIENT_PRE_FOP (opendir, this,
- &this_req->compound_req_u.compound_opendir_req,
- op_errno, out,
- &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_OPENDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, opendir);
break;
- case GF_FOP_FSYNCDIR:
- CLIENT_PRE_FOP (fsyncdir, this,
- &this_req->compound_req_u.compound_fsyncdir_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
+ case GF_FOP_FSYNCDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
break;
- case GF_FOP_ACCESS:
- CLIENT_PRE_FOP (access, this,
- &this_req->compound_req_u.compound_access_req,
- op_errno, out,
- &args->loc, args->mask, args->xdata);
+ case GF_FOP_ACCESS:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, access);
break;
- case GF_FOP_CREATE:
- CLIENT_PRE_FOP (create, this,
- &this_req->compound_req_u.compound_create_req,
- op_errno, out,
- &args->loc, args->fd, args->mode, args->flags,
- args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
-
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_CREATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, create);
break;
- case GF_FOP_FTRUNCATE:
- CLIENT_PRE_FOP (ftruncate, this,
- &this_req->compound_req_u.compound_ftruncate_req,
- op_errno, out,
- args->fd, args->offset, args->xdata);
+ case GF_FOP_FTRUNCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
break;
- case GF_FOP_FSTAT:
- CLIENT_PRE_FOP (fstat, this,
- &this_req->compound_req_u.compound_fstat_req,
- op_errno, out,
- args->fd, args->xdata);
+ case GF_FOP_FSTAT:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fstat);
break;
- case GF_FOP_LK:
- CLIENT_PRE_FOP (lk, this,
- &this_req->compound_req_u.compound_lk_req,
- op_errno, out,
- args->cmd, &args->lock, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
+ case GF_FOP_LK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lk);
break;
- case GF_FOP_LOOKUP:
- CLIENT_PRE_FOP (lookup, this,
- &this_req->compound_req_u.compound_lookup_req,
- op_errno, out,
- &args->loc, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_LOOKUP:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lookup);
break;
- case GF_FOP_READDIR:
- CLIENT_PRE_FOP (readdir, this,
- &this_req->compound_req_u.compound_readdir_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
+ case GF_FOP_READDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readdir);
break;
- case GF_FOP_INODELK:
- CLIENT_PRE_FOP (inodelk, this,
- &this_req->compound_req_u.compound_inodelk_req,
- op_errno, out,
- &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
+ case GF_FOP_INODELK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
break;
- case GF_FOP_FINODELK:
- CLIENT_PRE_FOP (finodelk, this,
- &this_req->compound_req_u.compound_finodelk_req,
- op_errno, out,
- args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
+ case GF_FOP_FINODELK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
break;
- case GF_FOP_ENTRYLK:
- CLIENT_PRE_FOP (entrylk, this,
- &this_req->compound_req_u.compound_entrylk_req,
- op_errno, out,
- &args->loc, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
+ case GF_FOP_ENTRYLK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
break;
- case GF_FOP_FENTRYLK:
- CLIENT_PRE_FOP (fentrylk, this,
- &this_req->compound_req_u.compound_fentrylk_req,
- op_errno, out,
- args->fd, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
+ case GF_FOP_FENTRYLK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
break;
- case GF_FOP_XATTROP:
- CLIENT_PRE_FOP (xattrop, this,
- &this_req->compound_req_u.compound_xattrop_req,
- op_errno, out,
- &args->loc, args->xattr, args->optype,
- args->xdata);
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_req *args = &CPD_REQ_FIELD(curr_req, xattrop);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
break;
- case GF_FOP_FXATTROP:
- CLIENT_PRE_FOP (fxattrop, this,
- &this_req->compound_req_u.compound_fxattrop_req,
- op_errno, out,
- args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
+ }
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_req *args = &CPD_REQ_FIELD(curr_req, fxattrop);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
break;
- case GF_FOP_FGETXATTR:
- CLIENT_PRE_FOP (fgetxattr, this,
- &this_req->compound_req_u.compound_fgetxattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
+ }
+ case GF_FOP_FGETXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
break;
- case GF_FOP_FSETXATTR:
- CLIENT_PRE_FOP (fsetxattr, this,
- &this_req->compound_req_u.compound_fsetxattr_req,
- op_errno, out,
- args->fd, args->flags, args->xattr,
- args->xdata);
+ case GF_FOP_FSETXATTR: {
+ gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req, fsetxattr);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
break;
- case GF_FOP_RCHECKSUM:
- CLIENT_PRE_FOP (rchecksum, this,
- &this_req->compound_req_u.compound_rchecksum_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
+ }
+ case GF_FOP_RCHECKSUM:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
break;
- case GF_FOP_SETATTR:
- CLIENT_PRE_FOP (setattr, this,
- &this_req->compound_req_u.compound_setattr_req,
- op_errno, out,
- &args->loc, args->valid, &args->stat,
- args->xdata);
+ case GF_FOP_SETATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setattr);
break;
- case GF_FOP_FSETATTR:
- CLIENT_PRE_FOP (fsetattr, this,
- &this_req->compound_req_u.compound_fsetattr_req,
- op_errno, out,
- args->fd, args->valid, &args->stat,
- args->xdata);
+ case GF_FOP_FSETATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
break;
- case GF_FOP_READDIRP:
- CLIENT_PRE_FOP (readdirp, this,
- &this_req->compound_req_u.compound_readdirp_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req, readdirp);
+ GF_FREE(args->dict.dict_val);
break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_PRE_FOP (fremovexattr, this,
- &this_req->compound_req_u.compound_fremovexattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_PRE_FOP (fallocate, this,
- &this_req->compound_req_u.compound_fallocate_req,
- op_errno, out,
- args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
- case GF_FOP_DISCARD:
- CLIENT_PRE_FOP (discard, this,
- &this_req->compound_req_u.compound_discard_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
+ }
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
break;
- case GF_FOP_ZEROFILL:
- CLIENT_PRE_FOP (zerofill, this,
- &this_req->compound_req_u.compound_zerofill_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
+ case GF_FOP_FALLOCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
break;
- case GF_FOP_IPC:
- CLIENT_PRE_FOP (ipc, this,
- &this_req->compound_req_u.compound_ipc_req,
- op_errno, out,
- args->cmd, args->xdata);
+ case GF_FOP_DISCARD:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, discard);
break;
- case GF_FOP_SEEK:
- CLIENT_PRE_FOP (seek, this,
- &this_req->compound_req_u.compound_seek_req,
- op_errno, out,
- args->fd, args->offset, args->what,
- args->xdata);
+ case GF_FOP_ZEROFILL:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
break;
- case GF_FOP_LEASE:
- CLIENT_PRE_FOP (lease, this,
- &this_req->compound_req_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease,
- args->xdata);
+ case GF_FOP_IPC:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ipc);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, seek);
+ break;
+ default:
break;
- default:
- return ENOTSUP;
- }
- return 0;
-out:
- return op_errno;
-}
-
-void
-compound_request_cleanup (gfs3_compound_req *req)
-{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req *curr_req = NULL;
-
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsync);
- break;
- case GF_FOP_SETXATTR:
- {
- gfs3_setxattr_req *args = &CPD_REQ_FIELD (curr_req,
- setxattr);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_req *args = &CPD_REQ_FIELD (curr_req,
- xattrop);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_req *args = &CPD_REQ_FIELD (curr_req,
- fxattrop);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR:
- {
- gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req,
- fsetxattr);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req,
- readdirp);
- GF_FREE (args->dict.dict_val);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, seek);
- break;
- default:
- break;
- }
}
+ }
- GF_FREE (req->compound_req_array.compound_req_array_val);
- return;
+ GF_FREE(req->compound_req_array.compound_req_array_val);
+ return;
}
void
-clnt_getactivelk_rsp_cleanup (gfs3_getactivelk_rsp *rsp)
+clnt_getactivelk_rsp_cleanup(gfs3_getactivelk_rsp *rsp)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- while (trav) {
- next = trav->nextentry;
- free (trav->client_uid);
- free (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ free(trav->client_uid);
+ free(trav);
+ trav = next;
+ }
}
void
-clnt_getactivelk_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp)
+clnt_getactivelk_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- while (trav) {
- next = trav->nextentry;
- free (trav->client_uid);
- free (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ free(trav->client_uid);
+ free(trav);
+ trav = next;
+ }
}
int
-clnt_unserialize_rsp_locklist (xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
- lock_migration_info_t *lmi)
+clnt_unserialize_rsp_locklist(xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
+ lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-clnt_unserialize_rsp_locklist_v2 (xlator_t *this, struct gfx_getactivelk_rsp *rsp,
- lock_migration_info_t *lmi)
+clnt_unserialize_rsp_locklist_v2(xlator_t *this,
+ struct gfx_getactivelk_rsp *rsp,
+ lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
void
-clnt_setactivelk_req_cleanup (gfs3_setactivelk_req *req)
+clnt_setactivelk_req_cleanup(gfs3_setactivelk_req *req)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = req->request;
+ trav = req->request;
- while (trav) {
- next = trav->nextentry;
- GF_FREE (trav->client_uid);
- GF_FREE (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ GF_FREE(trav->client_uid);
+ GF_FREE(trav);
+ trav = next;
+ }
}
void
-clnt_setactivelk_req_cleanup_v2 (gfx_setactivelk_req *req)
+clnt_setactivelk_req_cleanup_v2(gfx_setactivelk_req *req)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = req->request;
+ trav = req->request;
- while (trav) {
- next = trav->nextentry;
- GF_FREE (trav->client_uid);
- GF_FREE (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ GF_FREE(trav->client_uid);
+ GF_FREE(trav);
+ trav = next;
+ }
}
int
-serialize_req_locklist (lock_migration_info_t *locklist,
- gfs3_setactivelk_req *req)
+serialize_req_locklist(lock_migration_info_t *locklist,
+ gfs3_setactivelk_req *req)
{
- lock_migration_info_t *tmp = NULL;
- gfs3_locklist *trav = NULL;
- gfs3_locklist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", locklist, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
-
- list_for_each_entry (tmp, &locklist->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav),
- gf_client_mt_clnt_lock_request_t);
- if (!trav)
- goto out;
-
- switch (tmp->flock.l_type) {
- case F_RDLCK:
- tmp->flock.l_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- tmp->flock.l_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- tmp->flock.l_type = GF_LK_F_UNLCK;
- break;
-
- default:
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %"PRId32"!",
- tmp->flock.l_type);
- break;
- }
+ lock_migration_info_t *tmp = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ int ret = -1;
- gf_proto_flock_from_flock (&trav->flock, &tmp->flock);
+ GF_VALIDATE_OR_GOTO("server", locklist, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- trav->lk_flags = tmp->lk_flags;
+ list_for_each_entry(tmp, &locklist->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_client_mt_clnt_lock_request_t);
+ if (!trav)
+ goto out;
- trav->client_uid = gf_strdup (tmp->client_uid);
- if (!trav->client_uid) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
- ret = -1;
- goto out;
- }
+ switch (tmp->flock.l_type) {
+ case F_RDLCK:
+ tmp->flock.l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ tmp->flock.l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ tmp->flock.l_type = GF_LK_F_UNLCK;
+ break;
- if (prev)
- prev->nextentry = trav;
- else
- req->request = trav;
+ default:
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ break;
+ }
+
+ gf_proto_flock_from_flock(&trav->flock, &tmp->flock);
- prev = trav;
- trav = NULL;
+ trav->lk_flags = tmp->lk_flags;
+
+ trav->client_uid = gf_strdup(tmp->client_uid);
+ if (!trav->client_uid) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "client_uid could not be allocated");
+ ret = -1;
+ goto out;
}
- ret = 0;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ req->request = trav;
+
+ prev = trav;
+ trav = NULL;
+ }
+
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
-
int
-serialize_req_locklist_v2 (lock_migration_info_t *locklist,
- gfx_setactivelk_req *req)
+serialize_req_locklist_v2(lock_migration_info_t *locklist,
+ gfx_setactivelk_req *req)
{
- lock_migration_info_t *tmp = NULL;
- gfs3_locklist *trav = NULL;
- gfs3_locklist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", locklist, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
-
- list_for_each_entry (tmp, &locklist->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav),
- gf_client_mt_clnt_lock_request_t);
- if (!trav)
- goto out;
-
- switch (tmp->flock.l_type) {
- case F_RDLCK:
- tmp->flock.l_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- tmp->flock.l_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- tmp->flock.l_type = GF_LK_F_UNLCK;
- break;
-
- default:
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %"PRId32"!",
- tmp->flock.l_type);
- break;
- }
+ lock_migration_info_t *tmp = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ int ret = -1;
- gf_proto_flock_from_flock (&trav->flock, &tmp->flock);
+ GF_VALIDATE_OR_GOTO("server", locklist, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- trav->lk_flags = tmp->lk_flags;
+ list_for_each_entry(tmp, &locklist->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_client_mt_clnt_lock_request_t);
+ if (!trav)
+ goto out;
- trav->client_uid = gf_strdup (tmp->client_uid);
- if (!trav->client_uid) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
- ret = -1;
- goto out;
- }
+ switch (tmp->flock.l_type) {
+ case F_RDLCK:
+ tmp->flock.l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ tmp->flock.l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ tmp->flock.l_type = GF_LK_F_UNLCK;
+ break;
+
+ default:
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ break;
+ }
+
+ gf_proto_flock_from_flock(&trav->flock, &tmp->flock);
- if (prev)
- prev->nextentry = trav;
- else
- req->request = trav;
+ trav->lk_flags = tmp->lk_flags;
- prev = trav;
- trav = NULL;
+ trav->client_uid = gf_strdup(tmp->client_uid);
+ if (!trav->client_uid) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "client_uid could not be allocated");
+ ret = -1;
+ goto out;
}
- ret = 0;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ req->request = trav;
+
+ prev = trav;
+ trav = NULL;
+ }
+
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
void
-client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len)
+client_compound_rsp_cleanup(gfs3_compound_rsp *rsp, int len)
{
- int i = 0;
- compound_rsp *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_FOP_RSP_CLEANUP (rsp, stat, i);
- break;
- case GF_FOP_MKNOD:
- CLIENT_FOP_RSP_CLEANUP (rsp, mknod, i);
- break;
- case GF_FOP_MKDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, mkdir, i);
- break;
- case GF_FOP_UNLINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, unlink, i);
- break;
- case GF_FOP_RMDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, rmdir, i);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, symlink, i);
- break;
- case GF_FOP_RENAME:
- CLIENT_FOP_RSP_CLEANUP (rsp, rename, i);
- break;
- case GF_FOP_LINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, link, i);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, truncate, i);
- break;
- case GF_FOP_OPEN:
- CLIENT_FOP_RSP_CLEANUP (rsp, open, i);
- break;
- case GF_FOP_READ:
- CLIENT_FOP_RSP_CLEANUP (rsp, read, i);
- break;
- case GF_FOP_WRITE:
- CLIENT_FOP_RSP_CLEANUP (rsp, write, i);
- break;
- case GF_FOP_STATFS:
- CLIENT_FOP_RSP_CLEANUP (rsp, statfs, i);
- break;
- case GF_FOP_FSYNC:
- CLIENT_FOP_RSP_CLEANUP (rsp, fsync, i);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, opendir, i);
- break;
- case GF_FOP_CREATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, create, i);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, ftruncate, i);
- break;
- case GF_FOP_FSTAT:
- CLIENT_FOP_RSP_CLEANUP (rsp, fstat, i);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_FOP_RSP_CLEANUP (rsp, lookup, i);
- break;
- case GF_FOP_SETATTR:
- CLIENT_FOP_RSP_CLEANUP (rsp, setattr, i);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_FOP_RSP_CLEANUP (rsp, fsetattr, i);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, fallocate, i);
- break;
- case GF_FOP_DISCARD:
- CLIENT_FOP_RSP_CLEANUP (rsp, discard, i);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_FOP_RSP_CLEANUP (rsp, zerofill, i);
- break;
- case GF_FOP_IPC:
- CLIENT_FOP_RSP_CLEANUP (rsp, ipc, i);
- break;
- case GF_FOP_SEEK:
- CLIENT_FOP_RSP_CLEANUP (rsp, seek, i);
- break;
- case GF_FOP_LEASE:
- CLIENT_FOP_RSP_CLEANUP (rsp, lease, i);
- break;
- /* fops that use gf_common_rsp */
- case GF_FOP_FLUSH:
- CLIENT_COMMON_RSP_CLEANUP (rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMMON_RSP_CLEANUP (rsp, access, i);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fentrylk, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_LK:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, lk, i);
- gfs3_lk_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, lk);
- free (tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readlink, i);
- gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readlink);
- free (tmp_rsp->path);
- break;
- }
- case GF_FOP_XATTROP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, xattrop, i);
- gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- xattrop);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, fxattrop, i);
- gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fxattrop);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_READDIR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readdir, i);
- gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdir);
- clnt_readdir_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readdirp, i);
- gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdirp);
- clnt_readdirp_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, getxattr, i);
- gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- getxattr);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, fgetxattr, i);
- gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fgetxattr);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_RCHECKSUM:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, rchecksum, i);
- gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp,
- rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free (rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
+ int i = 0;
+ compound_rsp *this_rsp = NULL;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (this_rsp->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_FOP_RSP_CLEANUP(rsp, stat, i);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT_FOP_RSP_CLEANUP(rsp, mknod, i);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, mkdir, i);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, unlink, i);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, rmdir, i);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, symlink, i);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT_FOP_RSP_CLEANUP(rsp, rename, i);
+ break;
+ case GF_FOP_LINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, link, i);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, truncate, i);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT_FOP_RSP_CLEANUP(rsp, open, i);
+ break;
+ case GF_FOP_READ:
+ CLIENT_FOP_RSP_CLEANUP(rsp, read, i);
+ break;
+ case GF_FOP_WRITE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, write, i);
+ break;
+ case GF_FOP_STATFS:
+ CLIENT_FOP_RSP_CLEANUP(rsp, statfs, i);
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fsync, i);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, opendir, i);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, create, i);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, ftruncate, i);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fstat, i);
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT_FOP_RSP_CLEANUP(rsp, lookup, i);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, setattr, i);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fsetattr, i);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fallocate, i);
+ break;
+ case GF_FOP_DISCARD:
+ CLIENT_FOP_RSP_CLEANUP(rsp, discard, i);
+ break;
+ case GF_FOP_ZEROFILL:
+ CLIENT_FOP_RSP_CLEANUP(rsp, zerofill, i);
+ break;
+ case GF_FOP_IPC:
+ CLIENT_FOP_RSP_CLEANUP(rsp, ipc, i);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, seek, i);
+ break;
+ case GF_FOP_LEASE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, lease, i);
+ break;
+ /* fops that use gf_common_rsp */
+ case GF_FOP_FLUSH:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, flush, i);
+ break;
+ case GF_FOP_SETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, setxattr, i);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, removexattr, i);
+ break;
+ case GF_FOP_FSETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, access, i);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, inodelk, i);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, finodelk, i);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, entrylk, i);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
+ break;
+ /* fops that need extra cleanup */
+ case GF_FOP_LK: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, lk, i);
+ gfs3_lk_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, lk);
+ free(tmp_rsp->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readlink, i);
+ gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readlink);
+ free(tmp_rsp->path);
+ break;
+ }
+ case GF_FOP_XATTROP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, xattrop, i);
+ gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, xattrop);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, fxattrop, i);
+ gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, fxattrop);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readdir, i);
+ gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdir);
+ clnt_readdir_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readdirp, i);
+ gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdirp);
+ clnt_readdirp_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, getxattr, i);
+ gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, getxattr);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, fgetxattr, i);
+ gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ fgetxattr);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_RCHECKSUM: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, rchecksum, i);
+ gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp, rchecksum);
+ if (rck->strong_checksum.strong_checksum_val) {
+ free(rck->strong_checksum.strong_checksum_val);
}
+ break;
+ }
+ default:
+ break;
}
- return;
+ }
+ return;
}
/* compound v2 */
int
-client_handle_fop_requirements_v2 (xlator_t *this, call_frame_t *frame,
- gfx_compound_req *req,
- clnt_local_t *local,
- struct iobref **req_iobref,
- struct iobref **rsp_iobref,
- struct iovec *req_vector,
- struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args,
- int fop_enum, int index)
+client_handle_fop_requirements_v2(
+ xlator_t *this, call_frame_t *frame, gfx_compound_req *req,
+ clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
+ struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
+ int *rsp_count, default_args_t *args, int fop_enum, int index)
{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req_v2 *this_req = &req->compound_req_array.compound_req_array_val[index];
+ int ret = 0;
+ int op_errno = ENOMEM;
+ struct iobuf *rsp_iobuf = NULL;
+ int64_t remote_fd = -1;
+ compound_req_v2 *this_req = &req->compound_req_array
+ .compound_req_array_val[index];
- this_req->fop_enum = fop_enum;
+ this_req->fop_enum = fop_enum;
- switch (fop_enum) {
+ switch (fop_enum) {
case GF_FOP_STAT:
- CLIENT4_PRE_FOP (stat, this,
- &this_req->compound_req_v2_u.compound_stat_req,
- op_errno, out,
- &args->loc, args->xdata);
- break;
+ CLIENT4_PRE_FOP(stat, this,
+ &this_req->compound_req_v2_u.compound_stat_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
case GF_FOP_READLINK:
- CLIENT4_PRE_FOP (readlink, this,
- &this_req->compound_req_v2_u.compound_readlink_req,
- op_errno, out,
- &args->loc, args->size, args->xdata);
- break;
+ CLIENT4_PRE_FOP(readlink, this,
+ &this_req->compound_req_v2_u.compound_readlink_req,
+ op_errno, out, &args->loc, args->size, args->xdata);
+ break;
case GF_FOP_MKNOD:
- CLIENT4_PRE_FOP (mknod, this,
- &this_req->compound_req_v2_u.compound_mknod_req,
- op_errno, out,
- &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(mknod, this,
+ &this_req->compound_req_v2_u.compound_mknod_req,
+ op_errno, out, &args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_MKDIR:
- CLIENT4_PRE_FOP (mkdir, this,
- &this_req->compound_req_v2_u.compound_mkdir_req,
- op_errno, out,
- &args->loc, args->mode,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(mkdir, this,
+ &this_req->compound_req_v2_u.compound_mkdir_req,
+ op_errno, out, &args->loc, args->mode, args->umask,
+ args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_UNLINK:
- CLIENT4_PRE_FOP (unlink, this,
- &this_req->compound_req_v2_u.compound_unlink_req,
- op_errno, out,
- &args->loc, args->xflag, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ unlink, this, &this_req->compound_req_v2_u.compound_unlink_req,
+ op_errno, out, &args->loc, args->xflag, args->xdata);
+ break;
case GF_FOP_RMDIR:
- CLIENT4_PRE_FOP (rmdir, this,
- &this_req->compound_req_v2_u.compound_rmdir_req,
- op_errno, out,
- &args->loc, args->flags, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ rmdir, this, &this_req->compound_req_v2_u.compound_rmdir_req,
+ op_errno, out, &args->loc, args->flags, args->xdata);
+ break;
case GF_FOP_SYMLINK:
- CLIENT4_PRE_FOP (symlink, this,
- &this_req->compound_req_v2_u.compound_symlink_req,
- op_errno, out,
- &args->loc, args->linkname, args->umask,
- args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(symlink, this,
+ &this_req->compound_req_v2_u.compound_symlink_req,
+ op_errno, out, &args->loc, args->linkname,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_RENAME:
- CLIENT4_PRE_FOP (rename, this,
- &this_req->compound_req_v2_u.compound_rename_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ rename, this, &this_req->compound_req_v2_u.compound_rename_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
case GF_FOP_LINK:
- CLIENT4_PRE_FOP (link, this,
- &this_req->compound_req_v2_u.compound_link_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ link, this, &this_req->compound_req_v2_u.compound_link_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
case GF_FOP_TRUNCATE:
- CLIENT4_PRE_FOP (truncate, this,
- &this_req->compound_req_v2_u.compound_truncate_req,
- op_errno, out,
- &args->loc, args->offset, args->xdata);
- break;
+ CLIENT4_PRE_FOP(truncate, this,
+ &this_req->compound_req_v2_u.compound_truncate_req,
+ op_errno, out, &args->loc, args->offset,
+ args->xdata);
+ break;
case GF_FOP_OPEN:
- CLIENT4_PRE_FOP (open, this,
- &this_req->compound_req_v2_u.compound_open_req,
- op_errno, out,
- &args->loc, args->fd, args->flags,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- break;
+ CLIENT4_PRE_FOP(
+ open, this, &this_req->compound_req_v2_u.compound_open_req,
+ op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
case GF_FOP_READ:
- op_errno = client_pre_readv_v2 (this,
- &this_req->compound_req_v2_u.compound_read_req,
- args->fd, args->size, args->offset,
- args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
+ op_errno = client_pre_readv_v2(
+ this, &this_req->compound_req_v2_u.compound_read_req, args->fd,
+ args->size, args->offset, args->flags, args->xdata);
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new ();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize (rsp_iobuf);
- iobref_add (*rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
+ if (!*rsp_iobref) {
+ *rsp_iobref = iobref_new();
+ if (*rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto out;
}
- *rsp_count += 1;
+ }
- break;
+ if (*rsp_count + 1 >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
+ iobref_add(*rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ if (args->size > rsp_vector[*rsp_count].iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size "
+ "(%lu)",
+ (unsigned long)args->size,
+ (unsigned long)rsp_vector[*rsp_count].iov_len);
+ op_errno = EINVAL;
+ goto out;
+ }
+ *rsp_count += 1;
+
+ break;
case GF_FOP_WRITE:
- op_errno = client_pre_writev_v2 (this,
- &this_req->compound_req_v2_u.compound_write_req,
- args->fd, iov_length (args->vector, args->count),
- args->offset, args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy (&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
+ op_errno = client_pre_writev_v2(
+ this, &this_req->compound_req_v2_u.compound_write_req, args->fd,
+ iov_length(args->vector, args->count), args->offset,
+ args->flags, &args->xdata);
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else
- if (iobref_merge (*req_iobref, args->iobref))
- goto out;
- break;
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+
+ if (*req_count + args->count >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ memcpy(&req_vector[*req_count], args->vector,
+ (args->count * sizeof(req_vector[0])));
+ *req_count += args->count;
+
+ if (!*req_iobref)
+ *req_iobref = args->iobref;
+ else if (iobref_merge(*req_iobref, args->iobref))
+ goto out;
+ break;
case GF_FOP_STATFS:
- CLIENT4_PRE_FOP (statfs, this,
- &this_req->compound_req_v2_u.compound_statfs_req,
- op_errno, out,
- &args->loc, args->xdata);
- break;
+ CLIENT4_PRE_FOP(statfs, this,
+ &this_req->compound_req_v2_u.compound_statfs_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
case GF_FOP_FLUSH:
- CLIENT4_PRE_FOP (flush, this,
- &this_req->compound_req_v2_u.compound_flush_req,
- op_errno, out,
- args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- break;
+ CLIENT4_PRE_FOP(flush, this,
+ &this_req->compound_req_v2_u.compound_flush_req,
+ op_errno, out, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
case GF_FOP_FSYNC:
- CLIENT4_PRE_FOP (fsync, this,
- &this_req->compound_req_v2_u.compound_fsync_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ fsync, this, &this_req->compound_req_v2_u.compound_fsync_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
case GF_FOP_SETXATTR:
- CLIENT4_PRE_FOP (setxattr, this,
- &this_req->compound_req_v2_u.compound_setxattr_req,
- op_errno, out,
- &args->loc, args->xattr, args->flags,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(setxattr, this,
+ &this_req->compound_req_v2_u.compound_setxattr_req,
+ op_errno, out, &args->loc, args->xattr, args->flags,
+ args->xdata);
+ break;
case GF_FOP_GETXATTR:
- CLIENT4_PRE_FOP (getxattr, this,
- &this_req->compound_req_v2_u.compound_getxattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(getxattr, this,
+ &this_req->compound_req_v2_u.compound_getxattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_REMOVEXATTR:
- CLIENT4_PRE_FOP (removexattr, this,
- &this_req->compound_req_v2_u.compound_removexattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ removexattr, this,
+ &this_req->compound_req_v2_u.compound_removexattr_req, op_errno,
+ out, &args->loc, args->name, args->xdata);
+ break;
case GF_FOP_OPENDIR:
- CLIENT4_PRE_FOP (opendir, this,
- &this_req->compound_req_v2_u.compound_opendir_req,
- op_errno, out,
- &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(opendir, this,
+ &this_req->compound_req_v2_u.compound_opendir_req,
+ op_errno, out, &args->loc, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_FSYNCDIR:
- CLIENT4_PRE_FOP (fsyncdir, this,
- &this_req->compound_req_v2_u.compound_fsyncdir_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsyncdir, this,
+ &this_req->compound_req_v2_u.compound_fsyncdir_req,
+ op_errno, out, args->fd, args->datasync,
+ args->xdata);
+ break;
case GF_FOP_ACCESS:
- CLIENT4_PRE_FOP (access, this,
- &this_req->compound_req_v2_u.compound_access_req,
- op_errno, out,
- &args->loc, args->mask, args->xdata);
- break;
+ CLIENT4_PRE_FOP(access, this,
+ &this_req->compound_req_v2_u.compound_access_req,
+ op_errno, out, &args->loc, args->mask, args->xdata);
+ break;
case GF_FOP_CREATE:
- CLIENT4_PRE_FOP (create, this,
- &this_req->compound_req_v2_u.compound_create_req,
- op_errno, out,
- &args->loc, args->fd, args->mode, args->flags,
- args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
-
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(create, this,
+ &this_req->compound_req_v2_u.compound_create_req,
+ op_errno, out, &args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_FTRUNCATE:
- CLIENT4_PRE_FOP (ftruncate, this,
- &this_req->compound_req_v2_u.compound_ftruncate_req,
- op_errno, out,
- args->fd, args->offset, args->xdata);
- break;
+ CLIENT4_PRE_FOP(ftruncate, this,
+ &this_req->compound_req_v2_u.compound_ftruncate_req,
+ op_errno, out, args->fd, args->offset, args->xdata);
+ break;
case GF_FOP_FSTAT:
- CLIENT4_PRE_FOP (fstat, this,
- &this_req->compound_req_v2_u.compound_fstat_req,
- op_errno, out,
- args->fd, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fstat, this,
+ &this_req->compound_req_v2_u.compound_fstat_req,
+ op_errno, out, args->fd, args->xdata);
+ break;
case GF_FOP_LK:
- CLIENT4_PRE_FOP (lk, this,
- &this_req->compound_req_v2_u.compound_lk_req,
- op_errno, out,
- args->cmd, &args->lock, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- break;
+ CLIENT4_PRE_FOP(
+ lk, this, &this_req->compound_req_v2_u.compound_lk_req,
+ op_errno, out, args->cmd, &args->lock, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
case GF_FOP_LOOKUP:
- CLIENT4_PRE_FOP (lookup, this,
- &this_req->compound_req_v2_u.compound_lookup_req,
- op_errno, out,
- &args->loc, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(lookup, this,
+ &this_req->compound_req_v2_u.compound_lookup_req,
+ op_errno, out, &args->loc, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_READDIR:
- CLIENT4_PRE_FOP (readdir, this,
- &this_req->compound_req_v2_u.compound_readdir_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(readdir, this,
+ &this_req->compound_req_v2_u.compound_readdir_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
case GF_FOP_INODELK:
- CLIENT4_PRE_FOP (inodelk, this,
- &this_req->compound_req_v2_u.compound_inodelk_req,
- op_errno, out,
- &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
- break;
+ CLIENT4_PRE_FOP(inodelk, this,
+ &this_req->compound_req_v2_u.compound_inodelk_req,
+ op_errno, out, &args->loc, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ break;
case GF_FOP_FINODELK:
- CLIENT4_PRE_FOP (finodelk, this,
- &this_req->compound_req_v2_u.compound_finodelk_req,
- op_errno, out,
- args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- break;
+ CLIENT4_PRE_FOP(finodelk, this,
+ &this_req->compound_req_v2_u.compound_finodelk_req,
+ op_errno, out, args->fd, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
case GF_FOP_ENTRYLK:
- CLIENT4_PRE_FOP (entrylk, this,
- &this_req->compound_req_v2_u.compound_entrylk_req,
- op_errno, out,
- &args->loc, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(entrylk, this,
+ &this_req->compound_req_v2_u.compound_entrylk_req,
+ op_errno, out, &args->loc, args->entrylkcmd,
+ args->entrylktype, args->volume, args->name,
+ args->xdata);
+ break;
case GF_FOP_FENTRYLK:
- CLIENT4_PRE_FOP (fentrylk, this,
- &this_req->compound_req_v2_u.compound_fentrylk_req,
- op_errno, out,
- args->fd, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fentrylk, this,
+ &this_req->compound_req_v2_u.compound_fentrylk_req,
+ op_errno, out, args->fd, args->entrylkcmd,
+ args->entrylktype, args->volume, args->name,
+ args->xdata);
+ break;
case GF_FOP_XATTROP:
- CLIENT4_PRE_FOP (xattrop, this,
- &this_req->compound_req_v2_u.compound_xattrop_req,
- op_errno, out,
- &args->loc, args->xattr, args->optype,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(xattrop, this,
+ &this_req->compound_req_v2_u.compound_xattrop_req,
+ op_errno, out, &args->loc, args->xattr,
+ args->optype, args->xdata);
+ break;
case GF_FOP_FXATTROP:
- CLIENT4_PRE_FOP (fxattrop, this,
- &this_req->compound_req_v2_u.compound_fxattrop_req,
- op_errno, out,
- args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- break;
+ CLIENT4_PRE_FOP(fxattrop, this,
+ &this_req->compound_req_v2_u.compound_fxattrop_req,
+ op_errno, out, args->fd, args->xattr, args->optype,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
case GF_FOP_FGETXATTR:
- CLIENT4_PRE_FOP (fgetxattr, this,
- &this_req->compound_req_v2_u.compound_fgetxattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fgetxattr, this,
+ &this_req->compound_req_v2_u.compound_fgetxattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
case GF_FOP_FSETXATTR:
- CLIENT4_PRE_FOP (fsetxattr, this,
- &this_req->compound_req_v2_u.compound_fsetxattr_req,
- op_errno, out,
- args->fd, args->flags, args->xattr,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsetxattr, this,
+ &this_req->compound_req_v2_u.compound_fsetxattr_req,
+ op_errno, out, args->fd, args->flags, args->xattr,
+ args->xdata);
+ break;
case GF_FOP_RCHECKSUM:
- CLIENT4_PRE_FOP (rchecksum, this,
- &this_req->compound_req_v2_u.compound_rchecksum_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(rchecksum, this,
+ &this_req->compound_req_v2_u.compound_rchecksum_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
case GF_FOP_SETATTR:
- CLIENT4_PRE_FOP (setattr, this,
- &this_req->compound_req_v2_u.compound_setattr_req,
- op_errno, out,
- &args->loc, args->valid, &args->stat,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(setattr, this,
+ &this_req->compound_req_v2_u.compound_setattr_req,
+ op_errno, out, &args->loc, args->valid, &args->stat,
+ args->xdata);
+ break;
case GF_FOP_FSETATTR:
- CLIENT4_PRE_FOP (fsetattr, this,
- &this_req->compound_req_v2_u.compound_fsetattr_req,
- op_errno, out,
- args->fd, args->valid, &args->stat,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsetattr, this,
+ &this_req->compound_req_v2_u.compound_fsetattr_req,
+ op_errno, out, args->fd, args->valid, &args->stat,
+ args->xdata);
+ break;
case GF_FOP_READDIRP:
- CLIENT4_PRE_FOP (readdirp, this,
- &this_req->compound_req_v2_u.compound_readdirp_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- break;
+ CLIENT4_PRE_FOP(readdirp, this,
+ &this_req->compound_req_v2_u.compound_readdirp_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
case GF_FOP_FREMOVEXATTR:
- CLIENT4_PRE_FOP (fremovexattr, this,
- &this_req->compound_req_v2_u.compound_fremovexattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ fremovexattr, this,
+ &this_req->compound_req_v2_u.compound_fremovexattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
case GF_FOP_FALLOCATE:
- CLIENT4_PRE_FOP (fallocate, this,
- &this_req->compound_req_v2_u.compound_fallocate_req,
- op_errno, out,
- args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fallocate, this,
+ &this_req->compound_req_v2_u.compound_fallocate_req,
+ op_errno, out, args->fd, args->flags, args->offset,
+ args->size, args->xdata);
+ break;
case GF_FOP_DISCARD:
- CLIENT4_PRE_FOP (discard, this,
- &this_req->compound_req_v2_u.compound_discard_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(discard, this,
+ &this_req->compound_req_v2_u.compound_discard_req,
+ op_errno, out, args->fd, args->offset, args->size,
+ args->xdata);
+ break;
case GF_FOP_ZEROFILL:
- CLIENT4_PRE_FOP (zerofill, this,
- &this_req->compound_req_v2_u.compound_zerofill_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(zerofill, this,
+ &this_req->compound_req_v2_u.compound_zerofill_req,
+ op_errno, out, args->fd, args->offset, args->size,
+ args->xdata);
+ break;
case GF_FOP_IPC:
- CLIENT4_PRE_FOP (ipc, this,
- &this_req->compound_req_v2_u.compound_ipc_req,
- op_errno, out,
- args->cmd, args->xdata);
- break;
+ CLIENT4_PRE_FOP(ipc, this,
+ &this_req->compound_req_v2_u.compound_ipc_req,
+ op_errno, out, args->cmd, args->xdata);
+ break;
case GF_FOP_SEEK:
- CLIENT4_PRE_FOP (seek, this,
- &this_req->compound_req_v2_u.compound_seek_req,
- op_errno, out,
- args->fd, args->offset, args->what,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ seek, this, &this_req->compound_req_v2_u.compound_seek_req,
+ op_errno, out, args->fd, args->offset, args->what, args->xdata);
+ break;
case GF_FOP_LEASE:
- CLIENT4_PRE_FOP (lease, this,
- &this_req->compound_req_v2_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ lease, this, &this_req->compound_req_v2_u.compound_lease_req,
+ op_errno, out, &args->loc, &args->lease, args->xdata);
+ break;
default:
- return ENOTSUP;
- }
- return 0;
+ return ENOTSUP;
+ }
+ return 0;
out:
- return op_errno;
+ return op_errno;
}
void
-compound_request_cleanup_v2 (gfx_compound_req *req)
+compound_request_cleanup_v2(gfx_compound_req *req)
{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req_v2 *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsync);
- break;
- case GF_FOP_SETXATTR:
- {
- gfx_setxattr_req *args = &CPD4_REQ_FIELD (curr_req,
- setxattr);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP:
- {
- gfx_xattrop_req *args = &CPD4_REQ_FIELD (curr_req,
- xattrop);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfx_fxattrop_req *args = &CPD4_REQ_FIELD (curr_req,
- fxattrop);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR:
- {
- gfx_fsetxattr_req *args = &CPD4_REQ_FIELD(curr_req,
- fsetxattr);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readdirp);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, seek);
- break;
- default:
- break;
- }
- }
+ int i = 0;
+ int length = req->compound_req_array.compound_req_array_len;
+ compound_req_v2 *curr_req = NULL;
- GF_FREE (req->compound_req_array.compound_req_array_val);
+ if (!req->compound_req_array.compound_req_array_val)
return;
-}
+ for (i = 0; i < length; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
-void
-client_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, int len)
-{
- int i = 0;
- compound_rsp_v2 *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- /* fops that need extra cleanup */
- case GF_FOP_LK:
- {
- gfx_lk_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, lk);
- free (tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK:
- {
- gfx_readlink_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readlink);
- free (tmp_rsp->path);
- break;
- }
- case GF_FOP_READDIR:
- {
+ switch (curr_req->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, stat);
+ break;
+ case GF_FOP_READLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readlink);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mknod);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, unlink);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, symlink);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rename);
+ break;
+ case GF_FOP_LINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, link);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, truncate);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, open);
+ break;
+ case GF_FOP_READ:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, read);
+ break;
+ case GF_FOP_WRITE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, write);
+ break;
+ case GF_FOP_STATFS:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, statfs);
+ break;
+ case GF_FOP_FLUSH:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, flush);
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsync);
+ break;
+ case GF_FOP_SETXATTR: {
+ gfx_setxattr_req *args = &CPD4_REQ_FIELD(curr_req, setxattr);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, opendir);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, access);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, create);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fstat);
+ break;
+ case GF_FOP_LK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lk);
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lookup);
+ break;
+ case GF_FOP_READDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdir);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
+ break;
+ case GF_FOP_XATTROP: {
+ gfx_xattrop_req *args = &CPD4_REQ_FIELD(curr_req, xattrop);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfx_fxattrop_req *args = &CPD4_REQ_FIELD(curr_req, fxattrop);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
+ break;
+ case GF_FOP_FSETXATTR: {
+ gfx_fsetxattr_req *args = &CPD4_REQ_FIELD(curr_req, fsetxattr);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setattr);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
+ break;
+ case GF_FOP_READDIRP:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdirp);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
+ break;
+ case GF_FOP_DISCARD:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, discard);
+ break;
+ case GF_FOP_ZEROFILL:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
+ break;
+ case GF_FOP_IPC:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ipc);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, seek);
+ break;
+ default:
+ break;
+ }
+ }
- gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdir);
- clnt_readdir_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
+ GF_FREE(req->compound_req_array.compound_req_array_val);
+ return;
+}
- gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdirp);
- clnt_readdirp_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_RCHECKSUM:
- {
-
- gfx_rchecksum_rsp *rck = &CPD4_RSP_FIELD(this_rsp,
- rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free (rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
+void
+client_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, int len)
+{
+ int i = 0;
+ compound_rsp_v2 *this_rsp = NULL;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (this_rsp->fop_enum) {
+ /* fops that need extra cleanup */
+ case GF_FOP_LK: {
+ gfx_lk_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, lk);
+ free(tmp_rsp->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfx_readlink_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readlink);
+ free(tmp_rsp->path);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdir);
+ clnt_readdir_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdirp);
+ clnt_readdirp_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_rsp *rck = &CPD4_RSP_FIELD(this_rsp, rchecksum);
+ if (rck->strong_checksum.strong_checksum_val) {
+ free(rck->strong_checksum.strong_checksum_val);
}
+ break;
+ }
+ default:
+ break;
}
- return;
+ }
+ return;
}
int
-client_process_response_v2 (call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfx_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk,
- int index)
+client_process_response_v2(call_frame_t *frame, xlator_t *this,
+ struct rpc_req *req, gfx_compound_rsp *rsp,
+ compound_args_cbk_t *args_cbk, int index)
{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp_v2 *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD (&entries.list);
-
- switch (args_cbk->enum_list[index]) {
-
+ int ret = 0;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ gf_dirent_t entries;
+ default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
+ clnt_local_t *local = frame->local;
+ compound_rsp_v2 *this_rsp = NULL;
+ compound_args_t *args = local->compound_args;
+
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ args_cbk->enum_list[index] = this_rsp->fop_enum;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ switch (args_cbk->enum_list[index]) {
case GF_FOP_STAT:
- case GF_FOP_FSTAT:
- {
- gfx_common_iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
+ case GF_FOP_FSTAT: {
+ gfx_common_iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
- client_post_common_iatt (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_common_iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &xdata);
- CLIENT4_POST_FOP_TYPE (stat, common_iatt, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(stat, common_iatt, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfx_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
+ case GF_FOP_READLINK: {
+ gfx_readlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
- gfx_stat_to_iattx (&tmp_rsp->buf, &this_args_cbk->stat);
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ gfx_stat_to_iattx(&tmp_rsp->buf, &this_args_cbk->stat);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (readlink, readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readlink, readlink, this_rsp, this_args_cbk,
+ tmp_rsp->path, &this_args_cbk->stat, xdata);
+ break;
}
case GF_FOP_MKDIR:
case GF_FOP_MKNOD:
case GF_FOP_SYMLINK:
- case GF_FOP_LINK:
- {
- gfx_common_3iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
+ case GF_FOP_LINK: {
+ gfx_common_3iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
- client_post_common_3iatt (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (mknod, common_3iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ client_post_common_3iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(mknod, common_3iatt, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
}
case GF_FOP_UNLINK:
- case GF_FOP_RMDIR:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
+ case GF_FOP_RMDIR: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (unlink, common_2iatt, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_RENAME:
- {
- gfx_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
-
- client_post_rename_v2 (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT4_POST_FOP_TYPE (rename, rename, this_rsp, this_args_cbk,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, xdata);
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(unlink, common_2iatt, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfx_rename_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
+
+ client_post_rename_v2(
+ this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &this_args_cbk->preparent2,
+ &this_args_cbk->postparent2, &xdata);
+ CLIENT4_POST_FOP_TYPE(
+ rename, rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
+ break;
}
case GF_FOP_WRITE:
case GF_FOP_TRUNCATE:
@@ -3026,97 +2780,88 @@ client_process_response_v2 (call_frame_t *frame, xlator_t *this,
case GF_FOP_DISCARD:
case GF_FOP_FALLOCATE:
case GF_FOP_FSETATTR:
- case GF_FOP_SETATTR:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
-
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT4_POST_FOP_TYPE (truncate, common_2iatt, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN:
- {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
-
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (open, open, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd,
- 0);
- break;
- }
- case GF_FOP_READ:
- {
- gfx_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
-
- client_post_readv_v2 (this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat,
- vector, &req->rsp[1], &this_args_cbk->count,
- &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
-
- args_readv_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- vector, this_args_cbk->count,
- &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
-
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
+ case GF_FOP_SETATTR: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
- break;
- }
- case GF_FOP_STATFS:
- {
- gfx_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
-
- gf_statfs_to_statfs (&tmp_rsp->statfs, &this_args_cbk->statvfs);
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE (statfs, statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
-
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP (flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT4_POST_FOP_TYPE(truncate, common_2iatt, this_rsp,
+ this_args_cbk, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_OPEN: {
+ gfx_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
+
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+ CLIENT4_POST_FOP_TYPE(open, open, this_rsp, this_args_cbk,
+ local->fd, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
+ }
+ case GF_FOP_READ: {
+ gfx_read_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
+
+ client_post_readv_v2(this, tmp_rsp, &this_args_cbk->iobref,
+ req->rsp_iobref, &this_args_cbk->stat, vector,
+ &req->rsp[1], &this_args_cbk->count, &xdata);
+
+ /* Each read should be given read response that only
+ * corresponds to its request.
+ * Modify the iovecs accordingly.
+ * After each read, store the length of data already read
+ * so that the next ones can continue from there.
+ */
+ if (local->read_length) {
+ vector[0].iov_base += local->read_length;
+ local->read_length += tmp_rsp->op_ret;
+ } else {
+ local->read_length = tmp_rsp->op_ret;
+ }
+
+ args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno), vector,
+ this_args_cbk->count, &this_args_cbk->stat,
+ this_args_cbk->iobref, xdata);
+
+ if (tmp_rsp->op_ret >= 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfx_statfs_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
+
+ gf_statfs_to_statfs(&tmp_rsp->statfs, &this_args_cbk->statvfs);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+
+ CLIENT4_POST_FOP_TYPE(statfs, statfs, this_rsp, this_args_cbk,
+ &this_args_cbk->statvfs, xdata);
+ break;
+ }
+ case GF_FOP_FLUSH: {
+ gfx_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
+
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+
+ CLIENT4_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
+ if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+ break;
}
case GF_FOP_FSYNCDIR:
case GF_FOP_ACCESS:
@@ -3128,290 +2873,284 @@ client_process_response_v2 (call_frame_t *frame, xlator_t *this,
case GF_FOP_FINODELK:
case GF_FOP_ENTRYLK:
case GF_FOP_FENTRYLK:
- case GF_FOP_IPC:
- {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_setxattr_rsp;
+ case GF_FOP_IPC: {
+ gfx_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_setxattr_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP (setxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT4_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
+ break;
}
case GF_FOP_GETXATTR:
case GF_FOP_FGETXATTR:
case GF_FOP_XATTROP:
- case GF_FOP_FXATTROP:
- {
- gfx_common_dict_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
+ case GF_FOP_FXATTROP: {
+ gfx_common_dict_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
- client_post_common_dict (this, tmp_rsp, &xattr, &xdata);
+ client_post_common_dict(this, tmp_rsp, &xattr, &xdata);
- CLIENT4_POST_FOP_TYPE (getxattr, common_dict, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(getxattr, common_dict, this_rsp,
+ this_args_cbk, xattr, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_opendir_rsp;
+ case GF_FOP_OPENDIR: {
+ gfx_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_opendir_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (opendir, open, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ CLIENT4_POST_FOP_TYPE(opendir, open, this_rsp, this_args_cbk,
+ local->fd, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfx_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
-
- client_post_create_v2 (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT4_POST_FOP_TYPE (create, create, this_rsp, this_args_cbk,
- local->fd, local->loc.inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ case GF_FOP_CREATE: {
+ gfx_create_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
+
+ client_post_create_v2(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, local, &xdata);
+
+ CLIENT4_POST_FOP_TYPE(
+ create, create, this_rsp, this_args_cbk, local->fd,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_LK:
- {
- gfx_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
+ case GF_FOP_LK: {
+ gfx_lk_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
- client_post_lk_v2 (this, tmp_rsp, &this_args_cbk->lock, &xdata);
+ client_post_lk_v2(this, tmp_rsp, &this_args_cbk->lock, &xdata);
- CLIENT4_POST_FOP_TYPE (lk, lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(lk, lk, this_rsp, this_args_cbk,
+ &this_args_cbk->lock, xdata);
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
+ case GF_FOP_LOOKUP: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (lookup, common_2iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- xdata, &this_args_cbk->postparent);
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(lookup, common_2iatt, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat, xdata,
+ &this_args_cbk->postparent);
+ break;
}
- case GF_FOP_READDIR:
- {
- gfx_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
- client_post_readdir_v2 (this, tmp_rsp, &entries, &xdata);
+ client_post_readdir_v2(this, tmp_rsp, &entries, &xdata);
- CLIENT4_POST_FOP_TYPE (readdir, readdir, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readdir, readdir, this_rsp, this_args_cbk,
+ &entries, xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfx_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (rchecksum, rchecksum, this_rsp, this_args_cbk,
- tmp_rsp->weak_checksum,
- (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(
+ rchecksum, rchecksum, this_rsp, this_args_cbk,
+ tmp_rsp->weak_checksum,
+ (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
- client_post_readdirp_v2 (this, tmp_rsp, local->fd, &entries,
- &xdata);
+ client_post_readdirp_v2(this, tmp_rsp, local->fd, &entries, &xdata);
- CLIENT4_POST_FOP_TYPE (readdirp, readdirp, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readdirp, readdirp, this_rsp, this_args_cbk,
+ &entries, xdata);
+ break;
}
- case GF_FOP_SEEK:
- {
- gfx_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
+ case GF_FOP_SEEK: {
+ gfx_seek_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (seek, seek, this_rsp, this_args_cbk,
- tmp_rsp->offset, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(seek, seek, this_rsp, this_args_cbk,
+ tmp_rsp->offset, xdata);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfx_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
+ case GF_FOP_LEASE: {
+ gfx_lease_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
- client_post_lease_v2 (this, tmp_rsp, &this_args_cbk->lease,
- &xdata);
+ client_post_lease_v2(this, tmp_rsp, &this_args_cbk->lease, &xdata);
- CLIENT4_POST_FOP_TYPE (lease, lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(lease, lease, this_rsp, this_args_cbk,
+ &this_args_cbk->lease, xdata);
+ break;
}
default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref (xdata);
- if (xattr)
- dict_unref (xattr);
- gf_dirent_free (&entries);
- return 0;
+ return -ENOTSUP;
+ }
+
+ if (xdata)
+ dict_unref(xdata);
+ if (xattr)
+ dict_unref(xattr);
+ gf_dirent_free(&entries);
+ return 0;
}
extern int
-client3_3_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client3_3_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client3_3_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client3_3_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client4_0_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client4_0_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client4_0_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client4_0_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
static int
-send_release4_0_over_wire (xlator_t *this, clnt_fd_ctx_t *fdctx,
- call_frame_t *fr)
+send_release4_0_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ call_frame_t *fr)
{
- clnt_conf_t *conf = NULL;
- conf = (clnt_conf_t *) this->private;
- if (fdctx->is_dir) {
- gfx_releasedir_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
-
- gf_msg_trace (this->name, 0, "sending releasedir on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASEDIR,
- client4_0_releasedir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_releasedir_req);
- } else {
- gfx_release_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending release on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASE,
- client4_0_release_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_release_req);
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ conf = (clnt_conf_t *)this->private;
+ if (fdctx->is_dir) {
+ gfx_releasedir_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+
+ gf_msg_trace(this->name, 0, "sending releasedir on fd");
+ (void)client_submit_request(
+ this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
+ client4_0_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_releasedir_req);
+ } else {
+ gfx_release_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending release on fd");
+ (void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
+ client4_0_release_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfx_release_req);
+ }
+
+ return 0;
}
static int
-send_release3_3_over_wire (xlator_t *this, clnt_fd_ctx_t *fdctx,
- call_frame_t *fr)
+send_release3_3_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ call_frame_t *fr)
{
- clnt_conf_t *conf = NULL;
- conf = (clnt_conf_t *) this->private;
- if (fdctx->is_dir) {
- gfs3_releasedir_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending releasedir on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASEDIR,
- client3_3_releasedir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
- } else {
- gfs3_release_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending release on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASE,
- client3_3_release_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_release_req);
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ conf = (clnt_conf_t *)this->private;
+ if (fdctx->is_dir) {
+ gfs3_releasedir_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending releasedir on fd");
+ (void)client_submit_request(
+ this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
+ client3_3_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_releasedir_req);
+ } else {
+ gfs3_release_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending release on fd");
+ (void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
+ client3_3_release_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfs3_release_req);
+ }
+
+ return 0;
}
int
-client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
+client_fdctx_destroy(xlator_t *this, clnt_fd_ctx_t *fdctx)
{
- clnt_conf_t *conf = NULL;
- call_frame_t *fr = NULL;
- int32_t ret = -1;
- char parent_down = 0;
- fd_lk_ctx_t *lk_ctx = NULL;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
-
- conf = (clnt_conf_t *) this->private;
-
- if (fdctx->remote_fd == -1) {
- gf_msg_debug (this->name, 0, "not a valid fd");
- goto out;
- }
-
- pthread_mutex_lock (&conf->lock);
- {
- parent_down = conf->parent_down;
- }
- pthread_mutex_unlock (&conf->lock);
- lk_ctx = fdctx->lk_ctx;
- fdctx->lk_ctx = NULL;
-
- if (lk_ctx)
- fd_lk_ctx_unref (lk_ctx);
-
- if (!parent_down)
- rpc_clnt_ref (conf->rpc);
- else
- goto out;
-
- fr = create_frame (this, this->ctx->pool);
- if (fr == NULL) {
- goto out;
- }
-
- ret = 0;
-
- if (conf->fops->progver == GLUSTER_FOP_VERSION)
- send_release3_3_over_wire (this, fdctx, fr);
- else
- send_release4_0_over_wire (this, fdctx, fr);
-
- rpc_clnt_unref (conf->rpc);
+ clnt_conf_t *conf = NULL;
+ call_frame_t *fr = NULL;
+ int32_t ret = -1;
+ char parent_down = 0;
+ fd_lk_ctx_t *lk_ctx = NULL;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
+
+ conf = (clnt_conf_t *)this->private;
+
+ if (fdctx->remote_fd == -1) {
+ gf_msg_debug(this->name, 0, "not a valid fd");
+ goto out;
+ }
+
+ pthread_mutex_lock(&conf->lock);
+ {
+ parent_down = conf->parent_down;
+ }
+ pthread_mutex_unlock(&conf->lock);
+ lk_ctx = fdctx->lk_ctx;
+ fdctx->lk_ctx = NULL;
+
+ if (lk_ctx)
+ fd_lk_ctx_unref(lk_ctx);
+
+ if (!parent_down)
+ rpc_clnt_ref(conf->rpc);
+ else
+ goto out;
+
+ fr = create_frame(this, this->ctx->pool);
+ if (fr == NULL) {
+ goto out;
+ }
+
+ ret = 0;
+
+ if (conf->fops->progver == GLUSTER_FOP_VERSION)
+ send_release3_3_over_wire(this, fdctx, fr);
+ else
+ send_release4_0_over_wire(this, fdctx, fr);
+
+ rpc_clnt_unref(conf->rpc);
out:
- if (fdctx) {
- fdctx->remote_fd = -1;
- GF_FREE (fdctx);
- }
+ if (fdctx) {
+ fdctx->remote_fd = -1;
+ GF_FREE(fdctx);
+ }
- return ret;
+ return ret;
}
diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c
index 4851252e8a6..48f32116de9 100644
--- a/xlators/protocol/client/src/client-lk.c
+++ b/xlators/protocol/client/src/client-lk.c
@@ -15,519 +15,504 @@
#include "client-messages.h"
static void
-__insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock);
+__insert_and_merge(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock);
static void
-__dump_client_lock (client_posix_lock_t *lock)
+__dump_client_lock(client_posix_lock_t *lock)
{
- xlator_t *this = NULL;
-
- this = THIS;
-
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
- "{fd=%p}"
- "{%s lk-owner:%s %"PRId64" - %"PRId64"}"
- "{start=%"PRId64" end=%"PRId64"}",
- lock->fd,
- lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
- lkowner_utoa (&lock->owner),
- lock->user_flock.l_start,
- lock->user_flock.l_len,
- lock->fl_start,
- lock->fl_end);
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
+ "{fd=%p}"
+ "{%s lk-owner:%s %" PRId64 " - %" PRId64
+ "}"
+ "{start=%" PRId64 " end=%" PRId64 "}",
+ lock->fd, lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
+ lkowner_utoa(&lock->owner), lock->user_flock.l_start,
+ lock->user_flock.l_len, lock->fl_start, lock->fl_end);
}
static int
-dump_client_locks_fd (clnt_fd_ctx_t *fdctx)
+dump_client_locks_fd(clnt_fd_ctx_t *fdctx)
{
- client_posix_lock_t *lock = NULL;
- int count = 0;
+ client_posix_lock_t *lock = NULL;
+ int count = 0;
- list_for_each_entry (lock, &fdctx->lock_list, list) {
- __dump_client_lock (lock);
- count++;
- }
-
- return count;
+ list_for_each_entry(lock, &fdctx->lock_list, list)
+ {
+ __dump_client_lock(lock);
+ count++;
+ }
+ return count;
}
int
-dump_client_locks (inode_t *inode)
+dump_client_locks(inode_t *inode)
{
- fd_t *fd = NULL;
- xlator_t *this = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_conf_t *conf = NULL;
+ fd_t *fd = NULL;
+ xlator_t *this = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_conf_t *conf = NULL;
- int total_count = 0;
- int locks_fd_count = 0;
+ int total_count = 0;
+ int locks_fd_count = 0;
- this = THIS;
- conf = this->private;
+ this = THIS;
+ conf = this->private;
- LOCK (&inode->lock);
+ LOCK(&inode->lock);
+ {
+ list_for_each_entry(fd, &inode->fd_list, inode_list)
{
- list_for_each_entry (fd, &inode->fd_list, inode_list) {
- locks_fd_count = 0;
+ locks_fd_count = 0;
- pthread_spin_lock(&conf->fd_lock);
- fdctx = this_fd_get_ctx (fd, this);
- if (fdctx)
- locks_fd_count = dump_client_locks_fd (fdctx);
- pthread_spin_unlock(&conf->fd_lock);
-
- total_count += locks_fd_count;
- }
+ pthread_spin_lock(&conf->fd_lock);
+ fdctx = this_fd_get_ctx(fd, this);
+ if (fdctx)
+ locks_fd_count = dump_client_locks_fd(fdctx);
+ pthread_spin_unlock(&conf->fd_lock);
+ total_count += locks_fd_count;
}
- UNLOCK (&inode->lock);
-
- return total_count;
+ }
+ UNLOCK(&inode->lock);
+ return total_count;
}
static off_t
-__get_lock_length (off_t start, off_t end)
+__get_lock_length(off_t start, off_t end)
{
- if (end == LLONG_MAX)
- return 0;
- else
- return (end - start + 1);
+ if (end == LLONG_MAX)
+ return 0;
+ else
+ return (end - start + 1);
}
/* Add two locks */
static client_posix_lock_t *
-add_locks (client_posix_lock_t *l1, client_posix_lock_t *l2)
+add_locks(client_posix_lock_t *l1, client_posix_lock_t *l2)
{
- client_posix_lock_t *sum = NULL;
+ client_posix_lock_t *sum = NULL;
- sum = GF_CALLOC (1, sizeof (*sum), gf_client_mt_clnt_lock_t);
- if (!sum)
- return NULL;
+ sum = GF_CALLOC(1, sizeof(*sum), gf_client_mt_clnt_lock_t);
+ if (!sum)
+ return NULL;
- sum->fl_start = min (l1->fl_start, l2->fl_start);
- sum->fl_end = max (l1->fl_end, l2->fl_end);
+ sum->fl_start = min(l1->fl_start, l2->fl_start);
+ sum->fl_end = max(l1->fl_end, l2->fl_end);
- sum->user_flock.l_start = sum->fl_start;
- sum->user_flock.l_len = __get_lock_length (sum->fl_start,
- sum->fl_end);
+ sum->user_flock.l_start = sum->fl_start;
+ sum->user_flock.l_len = __get_lock_length(sum->fl_start, sum->fl_end);
- return sum;
+ return sum;
}
-
/* Return true if the locks overlap, false otherwise */
static int
-locks_overlap (client_posix_lock_t *l1, client_posix_lock_t *l2)
+locks_overlap(client_posix_lock_t *l1, client_posix_lock_t *l2)
{
- /*
- Note:
- FUSE always gives us absolute offsets, so no need to worry
- about SEEK_CUR or SEEK_END
- */
-
- return ((l1->fl_end >= l2->fl_start) &&
- (l2->fl_end >= l1->fl_start));
+ /*
+ Note:
+ FUSE always gives us absolute offsets, so no need to worry
+ about SEEK_CUR or SEEK_END
+ */
+
+ return ((l1->fl_end >= l2->fl_start) && (l2->fl_end >= l1->fl_start));
}
static void
-__delete_client_lock (client_posix_lock_t *lock)
+__delete_client_lock(client_posix_lock_t *lock)
{
- list_del_init (&lock->list);
+ list_del_init(&lock->list);
}
/* Destroy a posix_lock */
static void
-__destroy_client_lock (client_posix_lock_t *lock)
+__destroy_client_lock(client_posix_lock_t *lock)
{
- GF_FREE (lock);
+ GF_FREE(lock);
}
/* Subtract two locks */
struct _values {
- client_posix_lock_t *locks[3];
+ client_posix_lock_t *locks[3];
};
/* {big} must always be contained inside {small} */
static struct _values
-subtract_locks (client_posix_lock_t *big, client_posix_lock_t *small)
+subtract_locks(client_posix_lock_t *big, client_posix_lock_t *small)
{
- struct _values v = { .locks = {0, 0, 0} };
-
- if ((big->fl_start == small->fl_start) &&
- (big->fl_end == small->fl_end)) {
- /* both edges coincide with big */
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t );
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_type = small->fl_type;
- }
- else if ((small->fl_start > big->fl_start) &&
- (small->fl_end < big->fl_end)) {
- /* both edges lie inside big */
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_end = small->fl_start - 1;
- v.locks[0]->user_flock.l_len = __get_lock_length (v.locks[0]->fl_start,
- v.locks[0]->fl_end);
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- v.locks[2] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[2]);
- memcpy (v.locks[2], big, sizeof (client_posix_lock_t));
- v.locks[2]->fl_start = small->fl_end + 1;
- v.locks[2]->user_flock.l_start = small->fl_end + 1;
- }
- /* one edge coincides with big */
- else if (small->fl_start == big->fl_start) {
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_start = small->fl_end + 1;
- v.locks[0]->user_flock.l_start = small->fl_end + 1;
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- }
- else if (small->fl_end == big->fl_end) {
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_end = small->fl_start - 1;
- v.locks[0]->user_flock.l_len = __get_lock_length (v.locks[0]->fl_start,
- v.locks[0]->fl_end);
-
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- }
- else {
- /* LOG-TODO : decide what more info is required here*/
- gf_msg ("client-protocol", GF_LOG_CRITICAL, 0,
- PC_MSG_LOCK_ERROR,
- "Unexpected case in subtract_locks. Please send "
- "a bug report to gluster-devel@gluster.org");
- }
-
- return v;
+ struct _values v = {.locks = {0, 0, 0}};
+
+ if ((big->fl_start == small->fl_start) && (big->fl_end == small->fl_end)) {
+ /* both edges coincide with big */
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_type = small->fl_type;
+ } else if ((small->fl_start > big->fl_start) &&
+ (small->fl_end < big->fl_end)) {
+ /* both edges lie inside big */
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_end = small->fl_start - 1;
+ v.locks[0]->user_flock.l_len = __get_lock_length(v.locks[0]->fl_start,
+ v.locks[0]->fl_end);
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ v.locks[2] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[2]);
+ memcpy(v.locks[2], big, sizeof(client_posix_lock_t));
+ v.locks[2]->fl_start = small->fl_end + 1;
+ v.locks[2]->user_flock.l_start = small->fl_end + 1;
+ }
+ /* one edge coincides with big */
+ else if (small->fl_start == big->fl_start) {
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_start = small->fl_end + 1;
+ v.locks[0]->user_flock.l_start = small->fl_end + 1;
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ } else if (small->fl_end == big->fl_end) {
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_end = small->fl_start - 1;
+ v.locks[0]->user_flock.l_len = __get_lock_length(v.locks[0]->fl_start,
+ v.locks[0]->fl_end);
+
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ } else {
+ /* LOG-TODO : decide what more info is required here*/
+ gf_msg("client-protocol", GF_LOG_CRITICAL, 0, PC_MSG_LOCK_ERROR,
+ "Unexpected case in subtract_locks. Please send "
+ "a bug report to gluster-devel@gluster.org");
+ }
+
+ return v;
}
static void
-__delete_unlck_locks (clnt_fd_ctx_t *fdctx)
+__delete_unlck_locks(clnt_fd_ctx_t *fdctx)
{
- client_posix_lock_t *l = NULL;
- client_posix_lock_t *tmp = NULL;
-
- list_for_each_entry_safe (l, tmp, &fdctx->lock_list, list) {
- if (l->fl_type == F_UNLCK) {
- __delete_client_lock (l);
- __destroy_client_lock (l);
- }
- }
+ client_posix_lock_t *l = NULL;
+ client_posix_lock_t *tmp = NULL;
+
+ list_for_each_entry_safe(l, tmp, &fdctx->lock_list, list)
+ {
+ if (l->fl_type == F_UNLCK) {
+ __delete_client_lock(l);
+ __destroy_client_lock(l);
+ }
+ }
}
static void
-__insert_lock (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+__insert_lock(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- list_add_tail (&lock->list, &fdctx->lock_list);
+ list_add_tail(&lock->list, &fdctx->lock_list);
- return;
+ return;
}
static void
-__insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+__insert_and_merge(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- client_posix_lock_t *conf = NULL;
- client_posix_lock_t *t = NULL;
- client_posix_lock_t *sum = NULL;
- int i = 0;
- struct _values v = { .locks = {0, 0, 0} };
-
- list_for_each_entry_safe (conf, t, &fdctx->lock_list, list) {
- if (!locks_overlap (conf, lock))
- continue;
+ client_posix_lock_t *conf = NULL;
+ client_posix_lock_t *t = NULL;
+ client_posix_lock_t *sum = NULL;
+ int i = 0;
+ struct _values v = {.locks = {0, 0, 0}};
- if (is_same_lkowner (&conf->owner, &lock->owner)) {
- if (conf->fl_type == lock->fl_type) {
- sum = add_locks (lock, conf);
+ list_for_each_entry_safe(conf, t, &fdctx->lock_list, list)
+ {
+ if (!locks_overlap(conf, lock))
+ continue;
- sum->fd = lock->fd;
+ if (is_same_lkowner(&conf->owner, &lock->owner)) {
+ if (conf->fl_type == lock->fl_type) {
+ sum = add_locks(lock, conf);
- __delete_client_lock (conf);
- __destroy_client_lock (conf);
+ sum->fd = lock->fd;
- __destroy_client_lock (lock);
- __insert_and_merge (fdctx, sum);
+ __delete_client_lock(conf);
+ __destroy_client_lock(conf);
- return;
- } else {
- sum = add_locks (lock, conf);
+ __destroy_client_lock(lock);
+ __insert_and_merge(fdctx, sum);
- sum->fd = conf->fd;
- sum->owner = conf->owner;
+ return;
+ } else {
+ sum = add_locks(lock, conf);
- v = subtract_locks (sum, lock);
+ sum->fd = conf->fd;
+ sum->owner = conf->owner;
- __delete_client_lock (conf);
- __destroy_client_lock (conf);
+ v = subtract_locks(sum, lock);
- __delete_client_lock (lock);
- __destroy_client_lock (lock);
+ __delete_client_lock(conf);
+ __destroy_client_lock(conf);
- __destroy_client_lock (sum);
+ __delete_client_lock(lock);
+ __destroy_client_lock(lock);
- for (i = 0; i < 3; i++) {
- if (!v.locks[i])
- continue;
+ __destroy_client_lock(sum);
- INIT_LIST_HEAD (&v.locks[i]->list);
- __insert_and_merge (fdctx,
- v.locks[i]);
- }
+ for (i = 0; i < 3; i++) {
+ if (!v.locks[i])
+ continue;
- __delete_unlck_locks (fdctx);
- return;
- }
+ INIT_LIST_HEAD(&v.locks[i]->list);
+ __insert_and_merge(fdctx, v.locks[i]);
}
- if (lock->fl_type == F_UNLCK) {
- continue;
- }
+ __delete_unlck_locks(fdctx);
+ return;
+ }
+ }
- if ((conf->fl_type == F_RDLCK) && (lock->fl_type == F_RDLCK)) {
- __insert_lock (fdctx, lock);
- return;
- }
+ if (lock->fl_type == F_UNLCK) {
+ continue;
}
- /* no conflicts, so just insert */
- if (lock->fl_type != F_UNLCK) {
- __insert_lock (fdctx, lock);
- } else {
- __destroy_client_lock (lock);
+ if ((conf->fl_type == F_RDLCK) && (lock->fl_type == F_RDLCK)) {
+ __insert_lock(fdctx, lock);
+ return;
}
+ }
+
+ /* no conflicts, so just insert */
+ if (lock->fl_type != F_UNLCK) {
+ __insert_lock(fdctx, lock);
+ } else {
+ __destroy_client_lock(lock);
+ }
}
static void
-client_setlk (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+client_setlk(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- __insert_and_merge (fdctx, lock);
+ __insert_and_merge(fdctx, lock);
}
static void
-destroy_client_lock (client_posix_lock_t *lock)
+destroy_client_lock(client_posix_lock_t *lock)
{
- GF_FREE (lock);
+ GF_FREE(lock);
}
int32_t
-delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner)
+delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner)
{
- clnt_fd_ctx_t *fdctx = NULL;
- client_posix_lock_t *lock = NULL;
- client_posix_lock_t *tmp = NULL;
- xlator_t *this = NULL;
- clnt_conf_t *conf = NULL;
-
- struct list_head delete_list;
- int ret = 0;
- int count = 0;
-
- INIT_LIST_HEAD (&delete_list);
- this = THIS;
- conf = this->private;
-
- pthread_spin_lock(&conf->fd_lock);
-
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
-
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_FD_CTX_INVALID, "fdctx not valid");
- ret = -1;
- goto out;
- }
+ clnt_fd_ctx_t *fdctx = NULL;
+ client_posix_lock_t *lock = NULL;
+ client_posix_lock_t *tmp = NULL;
+ xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
- list_for_each_entry_safe (lock, tmp, &fdctx->lock_list, list) {
- if (!is_same_lkowner (&lock->owner, owner)) {
- list_del_init (&lock->list);
- list_add_tail (&lock->list, &delete_list);
- count++;
- }
- }
+ struct list_head delete_list;
+ int ret = 0;
+ int count = 0;
+ INIT_LIST_HEAD(&delete_list);
+ this = THIS;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock);
- list_for_each_entry_safe (lock, tmp, &delete_list, list) {
- list_del_init (&lock->list);
- destroy_client_lock (lock);
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
+ "fdctx not valid");
+ ret = -1;
+ goto out;
+ }
+
+ list_for_each_entry_safe(lock, tmp, &fdctx->lock_list, list)
+ {
+ if (!is_same_lkowner(&lock->owner, owner)) {
+ list_del_init(&lock->list);
+ list_add_tail(&lock->list, &delete_list);
+ count++;
}
+ }
+
+ pthread_spin_unlock(&conf->fd_lock);
- /* FIXME: Need to actually print the locks instead of count */
- gf_msg_trace (this->name, 0,
- "Number of locks cleared=%d", count);
+ list_for_each_entry_safe(lock, tmp, &delete_list, list)
+ {
+ list_del_init(&lock->list);
+ destroy_client_lock(lock);
+ }
+
+ /* FIXME: Need to actually print the locks instead of count */
+ gf_msg_trace(this->name, 0, "Number of locks cleared=%d", count);
out:
- return ret;
+ return ret;
}
int32_t
-client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd)
+client_cmd_to_gf_cmd(int32_t cmd, int32_t *gf_cmd)
{
- int ret = 0;
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- *gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- *gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- *gf_cmd = GF_LK_SETLKW;
- else if (cmd == F_RESLK_LCK)
- *gf_cmd = GF_LK_RESLK_LCK;
- else if (cmd == F_RESLK_LCKW)
- *gf_cmd = GF_LK_RESLK_LCKW;
- else if (cmd == F_RESLK_UNLCK)
- *gf_cmd = GF_LK_RESLK_UNLCK;
- else if (cmd == F_GETLK_FD)
- *gf_cmd = GF_LK_GETLK_FD;
- else
- ret = -1;
-
- return ret;
-
+ int ret = 0;
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ *gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ *gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ *gf_cmd = GF_LK_SETLKW;
+ else if (cmd == F_RESLK_LCK)
+ *gf_cmd = GF_LK_RESLK_LCK;
+ else if (cmd == F_RESLK_LCKW)
+ *gf_cmd = GF_LK_RESLK_LCKW;
+ else if (cmd == F_RESLK_UNLCK)
+ *gf_cmd = GF_LK_RESLK_UNLCK;
+ else if (cmd == F_GETLK_FD)
+ *gf_cmd = GF_LK_GETLK_FD;
+ else
+ ret = -1;
+
+ return ret;
}
static client_posix_lock_t *
-new_client_lock (struct gf_flock *flock, gf_lkowner_t *owner,
- int32_t cmd, fd_t *fd)
+new_client_lock(struct gf_flock *flock, gf_lkowner_t *owner, int32_t cmd,
+ fd_t *fd)
{
- client_posix_lock_t *new_lock = NULL;
+ client_posix_lock_t *new_lock = NULL;
- new_lock = GF_CALLOC (1, sizeof (*new_lock),
- gf_client_mt_clnt_lock_t);
- if (!new_lock) {
- goto out;
- }
+ new_lock = GF_CALLOC(1, sizeof(*new_lock), gf_client_mt_clnt_lock_t);
+ if (!new_lock) {
+ goto out;
+ }
- INIT_LIST_HEAD (&new_lock->list);
- new_lock->fd = fd;
- memcpy (&new_lock->user_flock, flock, sizeof (struct gf_flock));
+ INIT_LIST_HEAD(&new_lock->list);
+ new_lock->fd = fd;
+ memcpy(&new_lock->user_flock, flock, sizeof(struct gf_flock));
- new_lock->fl_type = flock->l_type;
- new_lock->fl_start = flock->l_start;
+ new_lock->fl_type = flock->l_type;
+ new_lock->fl_start = flock->l_start;
- if (flock->l_len == 0)
- new_lock->fl_end = LLONG_MAX;
- else
- new_lock->fl_end = flock->l_start + flock->l_len - 1;
+ if (flock->l_len == 0)
+ new_lock->fl_end = LLONG_MAX;
+ else
+ new_lock->fl_end = flock->l_start + flock->l_len - 1;
- new_lock->owner = *owner;
+ new_lock->owner = *owner;
- new_lock->cmd = cmd; /* Not really useful */
+ new_lock->cmd = cmd; /* Not really useful */
out:
- return new_lock;
+ return new_lock;
}
void
-client_save_number_fds (clnt_conf_t *conf, int count)
+client_save_number_fds(clnt_conf_t *conf, int count)
{
- LOCK (&conf->rec_lock);
- {
- conf->reopen_fd_count = count;
- }
- UNLOCK (&conf->rec_lock);
+ LOCK(&conf->rec_lock);
+ {
+ conf->reopen_fd_count = count;
+ }
+ UNLOCK(&conf->rec_lock);
}
int
-client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock,
- gf_lkowner_t *owner, int32_t cmd)
+client_add_lock_for_recovery(fd_t *fd, struct gf_flock *flock,
+ gf_lkowner_t *owner, int32_t cmd)
{
- clnt_fd_ctx_t *fdctx = NULL;
- xlator_t *this = NULL;
- client_posix_lock_t *lock = NULL;
- clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ xlator_t *this = NULL;
+ client_posix_lock_t *lock = NULL;
+ clnt_conf_t *conf = NULL;
- int ret = 0;
+ int ret = 0;
- this = THIS;
- conf = this->private;
+ this = THIS;
+ conf = this->private;
- pthread_spin_lock(&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ pthread_spin_unlock(&conf->fd_lock);
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
- "failed to get fd context. sending EBADFD");
- ret = -EBADFD;
- goto out;
- }
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
+ "failed to get fd context. sending EBADFD");
+ ret = -EBADFD;
+ goto out;
+ }
- lock = new_client_lock (flock, owner, cmd, fd);
- if (!lock) {
- pthread_spin_unlock(&conf->fd_lock);
+ lock = new_client_lock(flock, owner, cmd, fd);
+ if (!lock) {
+ pthread_spin_unlock(&conf->fd_lock);
- ret = -ENOMEM;
- goto out;
- }
+ ret = -ENOMEM;
+ goto out;
+ }
- client_setlk (fdctx, lock);
+ client_setlk(fdctx, lock);
- pthread_spin_unlock(&conf->fd_lock);
+ pthread_spin_unlock(&conf->fd_lock);
out:
- return ret;
-
+ return ret;
}
int32_t
-client_dump_locks (char *name, inode_t *inode,
- dict_t *dict)
+client_dump_locks(char *name, inode_t *inode, dict_t *dict)
{
- int ret = 0;
- dict_t *new_dict = NULL;
- char dict_string[256];
-
- GF_ASSERT (dict);
- new_dict = dict;
-
- ret = dump_client_locks (inode);
- snprintf (dict_string, 256, "%d locks dumped in log file", ret);
-
- ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
- PC_MSG_DICT_SET_FAILED,
- "could not set dict with %s", CLIENT_DUMP_LOCKS);
- goto out;
- }
+ int ret = 0;
+ dict_t *new_dict = NULL;
+ char dict_string[256];
+
+ GF_ASSERT(dict);
+ new_dict = dict;
+
+ ret = dump_client_locks(inode);
+ snprintf(dict_string, 256, "%d locks dumped in log file", ret);
+
+ ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
+ if (ret) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "could not set dict with %s", CLIENT_DUMP_LOCKS);
+ goto out;
+ }
out:
- return ret;
+ return ret;
}
int32_t
-is_client_dump_locks_cmd (char *name)
+is_client_dump_locks_cmd(char *name)
{
- int ret = 0;
+ int ret = 0;
- if (strcmp (name, CLIENT_DUMP_LOCKS) == 0)
- ret = 1;
+ if (strcmp(name, CLIENT_DUMP_LOCKS) == 0)
+ ret = 1;
- return ret;
+ return ret;
}
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 5c5a96d9178..9e5a5b44c69 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -18,5800 +18,5897 @@
#include "client-common.h"
#include "compound-fop-utils.h"
-int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
+int32_t
+client3_getspec(call_frame_t *frame, xlator_t *this, void *data);
rpc_clnt_prog_t clnt3_3_fop_prog;
-
-
/* CBK */
int
-client3_3_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_symlink_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_symlink (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_symlink_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_symlink(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- /* no need to print the gfid, because it will be null,
- * since symlink operation failed.
- */
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: (%s to %s)",
- local->loc.path, local->loc2.path);
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ /* no need to print the gfid, because it will be null,
+ * since symlink operation failed.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: (%s to %s)", local->loc.path,
+ local->loc2.path);
}
+ }
- CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode, &stbuf,
- &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(symlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_mknod_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
-
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_mknod (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_mknod_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_mknod(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKNOD,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
- CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_mkdir_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_mkdir (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_mkdir_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_mkdir(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKDIR,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
- CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-_copy_gfid_from_inode_holders (uuid_t gfid, loc_t *loc, fd_t *fd)
+_copy_gfid_from_inode_holders(uuid_t gfid, loc_t *loc, fd_t *fd)
{
- int ret = 0;
-
- if (fd && fd->inode && !gf_uuid_is_null (fd->inode->gfid)) {
- gf_uuid_copy (gfid, fd->inode->gfid);
- goto out;
- }
-
- if (!loc) {
- GF_ASSERT (0);
- ret = -1;
- goto out;
- }
-
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid)) {
- gf_uuid_copy (gfid, loc->inode->gfid);
- } else if (!gf_uuid_is_null (loc->gfid)) {
- gf_uuid_copy (gfid, loc->gfid);
- } else {
- GF_ASSERT (0);
- ret = -1;
- }
+ int ret = 0;
+
+ if (fd && fd->inode && !gf_uuid_is_null(fd->inode->gfid)) {
+ gf_uuid_copy(gfid, fd->inode->gfid);
+ goto out;
+ }
+
+ if (!loc) {
+ GF_ASSERT(0);
+ ret = -1;
+ goto out;
+ }
+
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid)) {
+ gf_uuid_copy(gfid, loc->inode->gfid);
+ } else if (!gf_uuid_is_null(loc->gfid)) {
+ gf_uuid_copy(gfid, loc->gfid);
+ } else {
+ GF_ASSERT(0);
+ ret = -1;
+ }
out:
- return ret;
+ return ret;
}
int
-client_add_fd_to_saved_fds (xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
- int64_t remote_fd, int is_dir)
+client_add_fd_to_saved_fds(xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
+ int64_t remote_fd, int is_dir)
{
- int ret = 0;
- uuid_t gfid = {0};
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
-
- conf = this->private;
- ret = _copy_gfid_from_inode_holders (gfid, loc, fd);
- if (ret) {
- ret = -EINVAL;
- goto out;
- }
-
- fdctx = GF_CALLOC (1, sizeof (*fdctx),
- gf_client_mt_clnt_fdctx_t);
- if (!fdctx) {
- ret = -ENOMEM;
- goto out;
- }
-
- gf_uuid_copy (fdctx->gfid, gfid);
- fdctx->is_dir = is_dir;
- fdctx->remote_fd = remote_fd;
- fdctx->flags = flags;
- fdctx->lk_ctx = fd_lk_ctx_ref (fd->lk_ctx);
- fdctx->reopen_done = client_default_reopen_done;
-
- INIT_LIST_HEAD (&fdctx->sfd_pos);
- INIT_LIST_HEAD (&fdctx->lock_list);
-
- pthread_spin_lock (&conf->fd_lock);
- {
- this_fd_set_ctx (fd, this, loc, fdctx);
-
- list_add_tail (&fdctx->sfd_pos, &conf->saved_fds);
- }
- pthread_spin_unlock (&conf->fd_lock);
+ int ret = 0;
+ uuid_t gfid = {0};
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+
+ conf = this->private;
+ ret = _copy_gfid_from_inode_holders(gfid, loc, fd);
+ if (ret) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ fdctx = GF_CALLOC(1, sizeof(*fdctx), gf_client_mt_clnt_fdctx_t);
+ if (!fdctx) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ gf_uuid_copy(fdctx->gfid, gfid);
+ fdctx->is_dir = is_dir;
+ fdctx->remote_fd = remote_fd;
+ fdctx->flags = flags;
+ fdctx->lk_ctx = fd_lk_ctx_ref(fd->lk_ctx);
+ fdctx->reopen_done = client_default_reopen_done;
+
+ INIT_LIST_HEAD(&fdctx->sfd_pos);
+ INIT_LIST_HEAD(&fdctx->lock_list);
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ this_fd_set_ctx(fd, this, loc, fdctx);
+
+ list_add_tail(&fdctx->sfd_pos, &conf->saved_fds);
+ }
+ pthread_spin_unlock(&conf->fd_lock);
out:
- return ret;
+ return ret;
}
int
-client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- int ret = 0;
- gfs3_open_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- fd = local->fd;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- local->flags, rsp.fd, 0);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ int ret = 0;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ fd = local->fd;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
+ local->flags, rsp.fd, 0);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
+ }
- ret = client_post_open (this, &rsp, &xdata);
+ ret = client_post_open(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_OPEN,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s (%s)", local->loc.path,
+ loc_gfid_utoa(&local->loc));
+ }
- CLIENT_STACK_UNWIND (open, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, xdata);
+ CLIENT_STACK_UNWIND(open, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_stat_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_stat_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_stat_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt iatt = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_stat (this, &rsp, &iatt, &xdata);
+ gfs3_stat_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt iatt = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_stat(this, &rsp, &iatt, &xdata);
out:
- if (rsp.op_ret == -1) {
- /* stale filehandles are possible during normal operations, no
- * need to spam the logs with these */
- if (rsp.op_errno == ESTALE) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s",
- strerror (gf_error_to_errno
- (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ /* stale filehandles are possible during normal operations, no
+ * need to spam the logs with these */
+ if (rsp.op_errno == ESTALE) {
+ gf_msg_debug(this->name, 0, "remote operation failed: %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
}
+ }
- CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &iatt, xdata);
+ CLIENT_STACK_UNWIND(stat, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &iatt, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_readlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_readlink_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt iatt = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readlink (this, &rsp, &iatt, &xdata);
+ gfs3_readlink_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt iatt = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readlink(this, &rsp, &iatt, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror
- (gf_error_to_errno (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), rsp.path,
- &iatt, xdata);
+ CLIENT_STACK_UNWIND(readlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.path, &iatt,
+ xdata);
- /* This is allocated by the libc while decoding RPC msg */
- /* Hence no 'GF_FREE', but just 'free' */
- free (rsp.path);
+ /* This is allocated by the libc while decoding RPC msg */
+ /* Hence no 'GF_FREE', but just 'free' */
+ free(rsp.path);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_unlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_unlink_rsp rsp = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_unlink (this, &rsp, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_unlink_rsp rsp = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_unlink(this, &rsp, &preparent, &postparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror
- (gf_error_to_errno (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &preparent,
- &postparent, xdata);
+ CLIENT_STACK_UNWIND(unlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &preparent,
+ &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_rmdir_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_rmdir (this, &rsp, &preparent, &postparent,
- &xdata);
+ gfs3_rmdir_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_rmdir(this, &rsp, &preparent, &postparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
}
- CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &preparent,
- &postparent, xdata);
+ }
+ CLIENT_STACK_UNWIND(rmdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &preparent,
+ &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_truncate_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_truncate (this, &rsp, &prestat, &poststat,
- &xdata);
+ gfs3_truncate_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_truncate(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(truncate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_statfs_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct statvfs statfs = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_statfs (this, &rsp, &statfs, &xdata);
+ gfs3_statfs_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct statvfs statfs = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_statfs(this, &rsp, &statfs, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &statfs, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(statfs, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &statfs, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_write_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_write_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_writev (this, &rsp, &prestat, &poststat, &xdata);
- if (ret < 0)
- goto out;
+ gfs3_write_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_write_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_writev(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else if (rsp.op_ret >= 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (writev, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- free (rsp.xdata.xdata_val);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else if (rsp.op_ret >= 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(writev, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ free(rsp.xdata.xdata_val);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- gf_common_rsp rsp = {0,};
- int ret = 0;
-
- frame = myframe;
- this = THIS;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
-
- ret = client_post_flush (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+
+ frame = myframe;
+ this = THIS;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0, "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+
+ ret = client_post_flush(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_FLUSH,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (flush, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(flush, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_fsync_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsync_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fsync (this, &rsp, &prestat, &poststat,
- &xdata);
- if (ret < 0)
- goto out;
+ gfs3_fsync_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fsync_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fsync(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsync, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_setxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- int op_errno = EINVAL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_setxattr (this, &rsp, &xdata);
- if (ret < 0)
- goto out;
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ int op_errno = EINVAL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_setxattr(this, &rsp, &xdata);
+ if (ret < 0)
+ goto out;
out:
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (rsp.op_ret == -1) {
- if (op_errno == ENOTSUP) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (rsp.op_ret == -1) {
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata);
+ CLIENT_STACK_UNWIND(setxattr, frame, rsp.op_ret, op_errno, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_getxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- int op_errno = EINVAL;
- gfs3_getxattr_rsp rsp = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = gf_error_to_errno (rsp.op_errno);
- ret = client_post_getxattr (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ int op_errno = EINVAL;
+ gfs3_getxattr_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ ret = client_post_getxattr(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- if ((op_errno == ENOTSUP) || (op_errno == ENODATA) ||
- (op_errno == ESTALE) || (op_errno == ENOENT)) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s. Path: %s "
- "(%s). Key: %s", strerror (op_errno),
- local->loc.path,
- loc_gfid_utoa (&local->loc),
- (local->name) ? local->name : "(null)");
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed. Path: %s (%s). Key: %s",
- local->loc.path,
- loc_gfid_utoa (&local->loc),
- (local->name) ? local->name : "(null)");
- }
+ if (rsp.op_ret == -1) {
+ if ((op_errno == ENOTSUP) || (op_errno == ENODATA) ||
+ (op_errno == ESTALE) || (op_errno == ENOENT)) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed: %s. Path: %s "
+ "(%s). Key: %s",
+ strerror(op_errno), local->loc.path,
+ loc_gfid_utoa(&local->loc),
+ (local->name) ? local->name : "(null)");
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed. Path: %s (%s). Key: %s",
+ local->loc.path, loc_gfid_utoa(&local->loc),
+ (local->name) ? local->name : "(null)");
}
+ }
- CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata);
+ CLIENT_STACK_UNWIND(getxattr, frame, rsp.op_ret, op_errno, dict, xdata);
- /* don't use GF_FREE, this memory was allocated by libc */
- free (rsp.dict.dict_val);
+ /* don't use GF_FREE, this memory was allocated by libc */
+ free(rsp.dict.dict_val);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fgetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- gfs3_fgetxattr_rsp rsp = {0,};
- int ret = 0;
- int op_errno = EINVAL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = gf_error_to_errno (rsp.op_errno);
- ret = client_post_fgetxattr (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ gfs3_fgetxattr_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int op_errno = EINVAL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ ret = client_post_fgetxattr(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- if ((op_errno == ENOTSUP) || (op_errno == ERANGE) ||
- (op_errno == ENODATA) || (op_errno == ENOENT)) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s",
- strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if ((op_errno == ENOTSUP) || (op_errno == ERANGE) ||
+ (op_errno == ENODATA) || (op_errno == ENOENT)) {
+ gf_msg_debug(this->name, 0, "remote operation failed: %s",
+ strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata);
+ CLIENT_STACK_UNWIND(fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata);
- free (rsp.dict.dict_val);
+ free(rsp.dict.dict_val);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_removexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- gf_loglevel_t loglevel = GF_LOG_NONE;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_removexattr (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ gf_loglevel_t loglevel = GF_LOG_NONE;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_removexattr(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- /* EPERM/EACCESS is returned some times in case of selinux
- attributes, or other system attributes which may not be
- possible to remove from an user process is encountered.
- we can't treat it as an error */
- if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno) ||
- (EPERM == rsp.op_errno) || (EACCES == rsp.op_errno))
- loglevel = GF_LOG_DEBUG;
- else
- loglevel = GF_LOG_WARNING;
-
- gf_msg (this->name, loglevel,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ /* EPERM/EACCESS is returned some times in case of selinux
+ attributes, or other system attributes which may not be
+ possible to remove from an user process is encountered.
+ we can't treat it as an error */
+ if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno) ||
+ (EPERM == rsp.op_errno) || (EACCES == rsp.op_errno))
+ loglevel = GF_LOG_DEBUG;
+ else
+ loglevel = GF_LOG_WARNING;
- CLIENT_STACK_UNWIND (removexattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ gf_msg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- free (rsp.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(removexattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ free(rsp.xdata.xdata_val);
- return 0;
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fremovexattr (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fremovexattr(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fremovexattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fsyncdir (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fsyncdir(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsyncdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_access (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_access(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (access, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(access, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_ftruncate_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_ftruncate (this, &rsp, &prestat, &poststat,
- &xdata);
+ gfs3_ftruncate_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_ftruncate(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(ftruncate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_fstat_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fstat (this, &rsp, &stat, &xdata);
+ gfs3_fstat_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fstat(this, &rsp, &stat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &stat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fstat, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &stat, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_inodelk (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_inodelk(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_INODELK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
- CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(inodelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
-
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_finodelk (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_finodelk(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_FINODELK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- } else if (rsp.op_ret == 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (finodelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
-
- free (rsp.xdata.xdata_val);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ } else if (rsp.op_ret == 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(finodelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
+
+ free(rsp.xdata.xdata_val);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_entrylk (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_entrylk(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(entrylk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fentrylk (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fentrylk(this, &rsp, &xdata);
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (fentrylk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(fentrylk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- gfs3_xattrop_rsp rsp = {0,};
- int ret = 0;
- int op_errno = EINVAL;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = rsp.op_errno;
- ret = client_post_xattrop (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ gfs3_xattrop_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int op_errno = EINVAL;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = rsp.op_errno;
+ ret = client_post_xattrop(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_XATTROP, op_errno),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed. "
- "Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. "
+ "Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ }
- CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret,
- gf_error_to_errno (op_errno), dict, xdata);
+ CLIENT_STACK_UNWIND(xattrop, frame, rsp.op_ret, gf_error_to_errno(op_errno),
+ dict, xdata);
- free (rsp.dict.dict_val);
+ free(rsp.dict.dict_val);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- dict_t *xdata = NULL;
- gfs3_fxattrop_rsp rsp = {0,};
- int ret = 0;
- int op_errno = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fxattrop_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
- op_errno = rsp.op_errno;
- ret = client_post_fxattrop (this, &rsp, &dict, &xdata);
- if (ret) {
- rsp.op_ret = -1;
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ dict_t *xdata = NULL;
+ gfs3_fxattrop_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int op_errno = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fxattrop_rsp);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ goto out;
+ }
+ op_errno = rsp.op_errno;
+ ret = client_post_fxattrop(this, &rsp, &dict, &xdata);
+ if (ret) {
+ rsp.op_ret = -1;
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else if (rsp.op_ret == 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret,
- gf_error_to_errno (op_errno), dict, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else if (rsp.op_ret == 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(fxattrop, frame, rsp.op_ret,
+ gf_error_to_errno(op_errno), dict, xdata);
- free (rsp.dict.dict_val);
+ free(rsp.dict.dict_val);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fsetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gf_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- int op_errno = EINVAL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_setxattr (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ int op_errno = EINVAL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_setxattr(this, &rsp, &xdata);
out:
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (rsp.op_ret == -1) {
- if (op_errno == ENOTSUP) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (rsp.op_ret == -1) {
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata);
+ CLIENT_STACK_UNWIND(fsetxattr, frame, rsp.op_ret, op_errno, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_fsetattr_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fsetattr (this, &rsp, &prestat, &poststat, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_fsetattr_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fsetattr(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsetattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count,
+client3_3_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_fallocate_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_fallocate (this, &rsp, &prestat, &poststat, &xdata);
- if (ret < 0)
- goto out;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
+ call_frame_t *frame = NULL;
+ gfs3_fallocate_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_fallocate(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, xdata, (rsp.xdata.xdata_val),
+ (rsp.xdata.xdata_len), ret, rsp.op_errno, out);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fallocate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fallocate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_discard_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_discard_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_discard (this, &rsp, &prestat, &poststat, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_discard_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_discard_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_discard(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (discard, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(discard, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_zerofill_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_zerofill_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_zerofill (this, &rsp, &prestat, &poststat, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_zerofill_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_zerofill_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_zerofill(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (zerofill, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(zerofill, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_ipc_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_ipc_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_ipc (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_ipc_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_ipc_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_ipc(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (ipc, frame,
- rsp.op_ret, gf_error_to_errno (rsp.op_errno),
- xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(ipc, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_seek_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gfs3_seek_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_seek_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_seek (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ struct gfs3_seek_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_seek_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_seek(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (seek, frame,
- rsp.op_ret, gf_error_to_errno (rsp.op_errno),
- rsp.offset, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(seek, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.offset, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_setattr_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_setattr (this, &rsp, &prestat, &poststat, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_setattr_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_setattr(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(setattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- inode_t *inode = NULL;
- struct iatt stbuf = {0, };
- struct iatt preparent = {0, };
- struct iatt postparent = {0, };
- int32_t ret = -1;
- clnt_local_t *local = NULL;
- gfs3_create_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
- fd = local->fd;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_post_create (this, &rsp, &stbuf,
- &preparent, &postparent,
- local, &xdata);
- if (ret < 0)
- goto out;
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- local->flags, rsp.fd, 0);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ inode_t *inode = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int32_t ret = -1;
+ clnt_local_t *local = NULL;
+ gfs3_create_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+ fd = local->fd;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_post_create(this, &rsp, &stbuf, &preparent, &postparent,
+ local, &xdata);
+ if (ret < 0)
+ goto out;
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
+ local->flags, rsp.fd, 0);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
-
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed. Path: %s",
+ local->loc.path);
+ }
- CLIENT_STACK_UNWIND (create, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(create, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_rchecksum_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_rchecksum (this, &rsp, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_rchecksum_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_rchecksum(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- rsp.weak_checksum,
- (uint8_t *)rsp.strong_checksum.strong_checksum_val,
- xdata);
-
- if (rsp.strong_checksum.strong_checksum_val) {
- /* This is allocated by the libc while decoding RPC msg */
- /* Hence no 'GF_FREE', but just 'free' */
- free (rsp.strong_checksum.strong_checksum_val);
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(rchecksum, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.weak_checksum,
+ (uint8_t *)rsp.strong_checksum.strong_checksum_val,
+ xdata);
+
+ if (rsp.strong_checksum.strong_checksum_val) {
+ /* This is allocated by the libc while decoding RPC msg */
+ /* Hence no 'GF_FREE', but just 'free' */
+ free(rsp.strong_checksum.strong_checksum_val);
+ }
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_lease_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gf_lease lease = {0,};
- gfs3_lease_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- gf_msg (this->name, GF_LOG_ERROR, ENOTCONN,
- PC_MSG_REMOTE_OP_FAILED, "Lease fop failed");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lease_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_lease (this, &rsp, &lease, &xdata);
+ call_frame_t *frame = NULL;
+ struct gf_lease lease = {
+ 0,
+ };
+ gfs3_lease_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED,
+ "Lease fop failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lease_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_lease(this, &rsp, &lease, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (lease, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &lease, xdata);
+ CLIENT_STACK_UNWIND(lease, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &lease, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gf_flock lock = {0,};
- gfs3_lk_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret >= 0) {
- ret = client_post_lk (this, &rsp, &lock, &xdata);
- if (ret < 0)
- goto out;
- }
+ call_frame_t *frame = NULL;
+ struct gf_flock lock = {
+ 0,
+ };
+ gfs3_lk_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret >= 0) {
+ ret = client_post_lk(this, &rsp, &lock, &xdata);
+ if (ret < 0)
+ goto out;
+ }
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (lk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &lock, xdata);
+ CLIENT_STACK_UNWIND(lk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
+ &lock, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- free (rsp.flock.lk_owner.lk_owner_val);
+ free(rsp.flock.lk_owner.lk_owner_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_readdir_rsp rsp = {0,};
- int32_t ret = 0;
- clnt_local_t *local = NULL;
- gf_dirent_t entries;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- INIT_LIST_HEAD (&entries.list);
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readdir (this, &rsp, &entries, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_readdir_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ clnt_local_t *local = NULL;
+ gf_dirent_t entries;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readdir(this, &rsp, &entries, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: remote_fd = %d",
- local->cmd);
- }
- CLIENT_STACK_UNWIND (readdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &entries, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed: remote_fd = %d", local->cmd);
+ }
+ CLIENT_STACK_UNWIND(readdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &entries, xdata);
- if (rsp.op_ret != -1) {
- gf_dirent_free (&entries);
- }
+ if (rsp.op_ret != -1) {
+ gf_dirent_free(&entries);
+ }
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- clnt_readdir_rsp_cleanup (&rsp);
+ clnt_readdir_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
int
-client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_readdirp_rsp rsp = {0,};
- int32_t ret = 0;
- clnt_local_t *local = NULL;
- gf_dirent_t entries;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- INIT_LIST_HEAD (&entries.list);
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readdirp (this, &rsp, local->fd, &entries, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_readdirp_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ clnt_local_t *local = NULL;
+ gf_dirent_t entries;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readdirp(this, &rsp, local->fd, &entries, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (readdirp, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &entries, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(readdirp, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &entries, xdata);
- if (rsp.op_ret != -1) {
- gf_dirent_free (&entries);
- }
- free (rsp.xdata.xdata_val);
+ if (rsp.op_ret != -1) {
+ gf_dirent_free(&entries);
+ }
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- clnt_readdirp_rsp_cleanup (&rsp);
+ clnt_readdirp_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
int
-client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_rename_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preoldparent = {0,};
- struct iatt postoldparent = {0,};
- struct iatt prenewparent = {0,};
- struct iatt postnewparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_rename (this, &rsp, &stbuf, &preoldparent,
- &postoldparent, &prenewparent,
- &postnewparent, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_rename_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preoldparent = {
+ 0,
+ };
+ struct iatt postoldparent = {
+ 0,
+ };
+ struct iatt prenewparent = {
+ 0,
+ };
+ struct iatt postnewparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_rename(this, &rsp, &stbuf, &preoldparent, &postoldparent,
+ &prenewparent, &postnewparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- &stbuf, &preoldparent, &postoldparent,
- &prenewparent, &postnewparent, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(rename, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &stbuf, &preoldparent,
+ &postoldparent, &prenewparent, &postnewparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_link_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_link (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_link_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_link(this, &rsp, &stbuf, &preparent, &postparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: (%s -> %s)",
- local->loc.path, local->loc2.path);
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed: (%s -> %s)", local->loc.path,
+ local->loc2.path);
}
+ }
- CLIENT_STACK_UNWIND (link, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(link, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- int ret = 0;
- gfs3_opendir_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- fd = local->fd;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- 0, rsp.fd, 1);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ int ret = 0;
+ gfs3_opendir_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ fd = local->fd;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc, 0,
+ rsp.fd, 1);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
+ }
- ret = client_post_opendir (this, &rsp, &xdata);
+ ret = client_post_opendir(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed."
- " Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
- CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, xdata);
-
- free (rsp.xdata.xdata_val);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed."
+ " Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ }
+ CLIENT_STACK_UNWIND(opendir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, xdata);
+
+ free(rsp.xdata.xdata_val);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
-
int
-client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- int ret = 0;
- gfs3_lookup_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt postparent = {0,};
- int op_errno = EINVAL;
- dict_t *xdata = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- /* Preserve the op_errno received from the server */
- op_errno = gf_error_to_errno (rsp.op_errno);
-
- ret = client_post_lookup (this, &rsp, &stbuf, &postparent, &xdata);
- if (ret < 0) {
- /* Don't change the op_errno if the fop failed on server */
- if (rsp.op_ret == 0)
- op_errno = rsp.op_errno;
- rsp.op_ret = -1;
- goto out;
- }
-
- if (rsp.op_ret < 0)
- goto out;
-
- if ((!gf_uuid_is_null (inode->gfid))
- && (gf_uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) {
- gf_msg_debug (frame->this->name, 0,
- "gfid changed for %s", local->loc.path);
-
- rsp.op_ret = -1;
- op_errno = ESTALE;
- if (xdata)
- ret = dict_set_int32 (xdata, "gfid-changed", 1);
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ int ret = 0;
+ gfs3_lookup_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int op_errno = EINVAL;
+ dict_t *xdata = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ /* Preserve the op_errno received from the server */
+ op_errno = gf_error_to_errno(rsp.op_errno);
+
+ ret = client_post_lookup(this, &rsp, &stbuf, &postparent, &xdata);
+ if (ret < 0) {
+ /* Don't change the op_errno if the fop failed on server */
+ if (rsp.op_ret == 0)
+ op_errno = rsp.op_errno;
+ rsp.op_ret = -1;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0)
+ goto out;
+
+ if ((!gf_uuid_is_null(inode->gfid)) &&
+ (gf_uuid_compare(stbuf.ia_gfid, inode->gfid) != 0)) {
+ gf_msg_debug(frame->this->name, 0, "gfid changed for %s",
+ local->loc.path);
+
+ rsp.op_ret = -1;
+ op_errno = ESTALE;
+ if (xdata)
+ ret = dict_set_int32(xdata, "gfid-changed", 1);
- goto out;
- }
+ goto out;
+ }
- rsp.op_ret = 0;
+ rsp.op_ret = 0;
out:
- /* Restore the correct op_errno to rsp.op_errno */
- rsp.op_errno = op_errno;
- if (rsp.op_ret == -1) {
- /* any error other than ENOENT */
- if (!(local->loc.name && rsp.op_errno == ENOENT) &&
- !(rsp.op_errno == ESTALE))
- gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed. Path: %s (%s)",
- local->loc.path,
- loc_gfid_utoa (&local->loc));
- else
- gf_msg_trace (this->name, 0, "not found on remote "
- "node");
+ /* Restore the correct op_errno to rsp.op_errno */
+ rsp.op_errno = op_errno;
+ if (rsp.op_ret == -1) {
+ /* any error other than ENOENT */
+ if (!(local->loc.name && rsp.op_errno == ENOENT) &&
+ !(rsp.op_errno == ESTALE))
+ gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed. Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ else
+ gf_msg_trace(this->name, 0,
+ "not found on remote "
+ "node");
+ }
- }
+ CLIENT_STACK_UNWIND(lookup, frame, rsp.op_ret, rsp.op_errno, inode, &stbuf,
+ xdata, &postparent);
- CLIENT_STACK_UNWIND (lookup, frame, rsp.op_ret, rsp.op_errno, inode,
- &stbuf, xdata, &postparent);
+ if (xdata)
+ dict_unref(xdata);
- if (xdata)
- dict_unref (xdata);
+ free(rsp.xdata.xdata_val);
- free (rsp.xdata.xdata_val);
-
- return 0;
+ return 0;
}
int
-client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct iobref *iobref = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- struct iatt stat = {0,};
- gfs3_read_rsp rsp = {0,};
- int ret = 0, rspcount = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- memset (vector, 0, sizeof (vector));
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readv (this, &rsp, &iobref, req->rsp_iobref,
- &stat, vector, &req->rsp[1],
- &rspcount, &xdata);
+ call_frame_t *frame = NULL;
+ struct iobref *iobref = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iatt stat = {
+ 0,
+ };
+ gfs3_read_rsp rsp = {
+ 0,
+ };
+ int ret = 0, rspcount = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ memset(vector, 0, sizeof(vector));
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readv(this, &rsp, &iobref, req->rsp_iobref, &stat, vector,
+ &req->rsp[1], &rspcount, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else if (rsp.op_ret >= 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (readv, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), vector, rspcount,
- &stat, iobref, xdata);
-
- free (rsp.xdata.xdata_val);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else if (rsp.op_ret >= 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(readv, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), vector, rspcount,
+ &stat, iobref, xdata);
+
+ free(rsp.xdata.xdata_val);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client3_3_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
+ call_frame_t *frame = NULL;
- frame = myframe;
- STACK_DESTROY (frame->root);
- return 0;
+ frame = myframe;
+ STACK_DESTROY(frame->root);
+ return 0;
}
int
-client3_3_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
+ call_frame_t *frame = NULL;
- frame = myframe;
- STACK_DESTROY (frame->root);
- return 0;
+ frame = myframe;
+ STACK_DESTROY(frame->root);
+ return 0;
}
static int
-client3_3_getactivelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_getactivelk_rsp rsp = {0,};
- int32_t ret = 0;
- lock_migration_info_t locklist;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_getactivelk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- INIT_LIST_HEAD (&locklist.list);
-
- if (rsp.op_ret > 0) {
- clnt_unserialize_rsp_locklist (this, &rsp, &locklist);
- }
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
+ call_frame_t *frame = NULL;
+ gfs3_getactivelk_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ lock_migration_info_t locklist;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_getactivelk_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ INIT_LIST_HEAD(&locklist.list);
+
+ if (rsp.op_ret > 0) {
+ clnt_unserialize_rsp_locklist(this, &rsp, &locklist);
+ }
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, xdata, (rsp.xdata.xdata_val),
+ (rsp.xdata.xdata_len), ret, rsp.op_errno, out);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (getactivelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &locklist,
- xdata);
+ CLIENT_STACK_UNWIND(getactivelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &locklist, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- clnt_getactivelk_rsp_cleanup (&rsp);
+ clnt_getactivelk_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
static int
-client3_3_setactivelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_getactivelk_rsp rsp = {0,};
- int32_t ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_setactivelk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
+ call_frame_t *frame = NULL;
+ gfs3_getactivelk_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_setactivelk_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, xdata, (rsp.xdata.xdata_val),
+ (rsp.xdata.xdata_len), ret, rsp.op_errno, out);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (setactivelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(setactivelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_compound_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_compound_rsp rsp = {0,};
- compound_args_cbk_t *args_cbk = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
- int i = 0;
- int length = 0;
- int ret = -1;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_compound_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- length = local->length;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), rsp.op_ret,
- rsp.op_errno, out);
-
- args_cbk = compound_args_cbk_alloc (length, xdata);
- if (!args_cbk) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOMEM;
- goto out;
- }
-
- /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
- for (i = 0; i < args_cbk->fop_length; i++) {
- ret = client_process_response (frame, this, req, &rsp,
- args_cbk, i);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
-
+ gfs3_compound_rsp rsp = {
+ 0,
+ };
+ compound_args_cbk_t *args_cbk = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+ int i = 0;
+ int length = 0;
+ int ret = -1;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_compound_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ length = local->length;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, xdata, (rsp.xdata.xdata_val),
+ (rsp.xdata.xdata_len), rsp.op_ret,
+ rsp.op_errno, out);
+
+ args_cbk = compound_args_cbk_alloc(length, xdata);
+ if (!args_cbk) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOMEM;
+ goto out;
+ }
+
+ /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
+ for (i = 0; i < args_cbk->fop_length; i++) {
+ ret = client_process_response(frame, this, req, &rsp, args_cbk, i);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
- rsp.op_ret = 0;
+ }
+ rsp.op_ret = 0;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (compound, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), args_cbk, xdata);
-
- free (rsp.xdata.xdata_val);
- client_compound_rsp_cleanup (&rsp, length);
- free (rsp.compound_rsp_array.compound_rsp_array_val);
-
- if (xdata)
- dict_unref (xdata);
-
- compound_args_cbk_cleanup (args_cbk);
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(compound, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), args_cbk, xdata);
+
+ free(rsp.xdata.xdata_val);
+ client_compound_rsp_cleanup(&rsp, length);
+ free(rsp.compound_rsp_array.compound_rsp_array_val);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ compound_args_cbk_cleanup(args_cbk);
+ return 0;
}
int32_t
-client3_3_releasedir (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_releasedir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- gf_boolean_t destroy = _gf_false;
-
- if (!this || !data)
- goto out;
-
- args = data;
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_del_ctx (args->fd, this);
- if (fdctx != NULL) {
- remote_fd = fdctx->remote_fd;
-
- /* fdctx->remote_fd == -1 indicates a reopen attempt
- in progress. Just mark ->released = 1 and let
- reopen_cbk handle releasing
- */
-
- if (remote_fd == -1) {
- fdctx->released = 1;
- } else {
- list_del_init (&fdctx->sfd_pos);
- destroy = _gf_true;
- }
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
+ gf_boolean_t destroy = _gf_false;
+
+ if (!this || !data)
+ goto out;
+
+ args = data;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_del_ctx(args->fd, this);
+ if (fdctx != NULL) {
+ remote_fd = fdctx->remote_fd;
+
+ /* fdctx->remote_fd == -1 indicates a reopen attempt
+ in progress. Just mark ->released = 1 and let
+ reopen_cbk handle releasing
+ */
+
+ if (remote_fd == -1) {
+ fdctx->released = 1;
+ } else {
+ list_del_init(&fdctx->sfd_pos);
+ destroy = _gf_true;
+ }
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
out:
- return 0;
+ return 0;
}
int32_t
-client3_3_release (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_release(call_frame_t *frame, xlator_t *this, void *data)
{
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- gf_boolean_t destroy = _gf_false;
-
- if (!this || !data)
- goto out;
-
- args = data;
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_del_ctx (args->fd, this);
- if (fdctx != NULL) {
- remote_fd = fdctx->remote_fd;
-
- /* fdctx->remote_fd == -1 indicates a reopen attempt
- in progress. Just mark ->released = 1 and let
- reopen_cbk handle releasing
- */
- if (remote_fd == -1) {
- fdctx->released = 1;
- } else {
- list_del_init (&fdctx->sfd_pos);
- destroy = _gf_true;
- }
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ gf_boolean_t destroy = _gf_false;
+
+ if (!this || !data)
+ goto out;
+
+ args = data;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_del_ctx(args->fd, this);
+ if (fdctx != NULL) {
+ remote_fd = fdctx->remote_fd;
+
+ /* fdctx->remote_fd == -1 indicates a reopen attempt
+ in progress. Just mark ->released = 1 and let
+ reopen_cbk handle releasing
+ */
+ if (remote_fd == -1) {
+ fdctx->released = 1;
+ } else {
+ list_del_init(&fdctx->sfd_pos);
+ destroy = _gf_true;
+ }
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
out:
- return 0;
+ return 0;
}
-
int32_t
-client3_3_lookup (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_lookup(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- clnt_args_t *args = NULL;
- gfs3_lookup_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- data_t *content = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- int count = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- memset (vector, 0, sizeof (vector));
-
- conf = this->private;
- args = data;
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- if (args->xdata) {
- content = dict_get (args->xdata, GF_CONTENT_KEY);
- if (content != NULL) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This change very much depends on quick-read
- changes */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- iobref_add (rsp_iobref, rsp_iobuf);
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
- }
-
- }
-
- ret = client_pre_lookup (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_LOOKUP, client3_3_lookup_cbk,
- NULL, rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfs3_lookup_req);
-
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_lookup_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ data_t *content = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ int count = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ memset(vector, 0, sizeof(vector));
+
+ conf = this->private;
+ args = data;
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ if (args->xdata) {
+ content = dict_get(args->xdata, GF_CONTENT_KEY);
+ if (content != NULL) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ /* This change very much depends on quick-read
+ changes */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
+
+ iobref_add(rsp_iobref, rsp_iobuf);
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
+ }
+
+ ret = client_pre_lookup(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LOOKUP,
+ client3_3_lookup_cbk, NULL, rsphdr, count, NULL,
+ 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_lookup_req);
+
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL,
- NULL);
+ CLIENT_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- return 0;
+ return 0;
}
int32_t
-client3_3_stat (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_stat(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_stat_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_stat (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_STAT, client3_3_stat_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_stat_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_stat_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_stat(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STAT,
+ client3_3_stat_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_stat_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(stat, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_truncate (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_truncate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_truncate_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_truncate (this, &req, args->loc, args->offset,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_TRUNCATE,
- client3_3_truncate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_truncate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_truncate_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_truncate(this, &req, args->loc, args->offset, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_TRUNCATE,
+ client3_3_truncate_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_truncate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(truncate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_ftruncate (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_ftruncate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_ftruncate_req req = {{0,},};
- int op_errno = EINVAL;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
- ret = client_pre_ftruncate (this, &req, args->fd, args->offset,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FTRUNCATE,
- client3_3_ftruncate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_ftruncate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_ftruncate_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = EINVAL;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ ret = client_pre_ftruncate(this, &req, args->fd, args->offset, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FTRUNCATE, client3_3_ftruncate_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_ftruncate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(ftruncate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_access (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_access(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_access_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
-
- ret = client_pre_access (this, &req, args->loc, args->mask,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ACCESS,
- client3_3_access_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_access_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_access_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ ret = client_pre_access(this, &req, args->loc, args->mask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ACCESS,
+ client3_3_access_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_access_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (access, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(access, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_readlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_readlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_readlink_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- clnt_local_t *local = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iovec *rsphdr = NULL;
- int count = 0;
- struct iovec vector[MAX_IOVEC] = {{0}, };
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- ret = client_pre_readlink (this, &req, args->loc, args->size,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READLINK,
- client3_3_readlink_cbk, NULL,
- rsphdr, count, NULL, 0,
- local->iobref,
- (xdrproc_t)xdr_gfs3_readlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_readlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ clnt_local_t *local = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iovec *rsphdr = NULL;
+ int count = 0;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ ret = client_pre_readlink(this, &req, args->loc, args->size, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
+
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READLINK,
+ client3_3_readlink_cbk, NULL, rsphdr, count,
+ NULL, 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_readlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- if (rsp_iobref != NULL) {
- iobref_unref (rsp_iobref);
- }
+ if (rsp_iobref != NULL) {
+ iobref_unref(rsp_iobref);
+ }
- CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(readlink, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_unlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_unlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_unlink_req req = {{0,},};
- int ret = 0;
- int op_errno = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_unlink (this, &req, args->loc, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_UNLINK,
- client3_3_unlink_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_unlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_unlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_unlink(this, &req, args->loc, args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_UNLINK,
+ client3_3_unlink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_unlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(unlink, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_rmdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_rmdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_rmdir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_rmdir (this, &req, args->loc, args->flags,
- args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RMDIR, client3_3_rmdir_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_rmdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_rmdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_rmdir(this, &req, args->loc, args->flags, args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RMDIR,
+ client3_3_rmdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_rmdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(rmdir, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_symlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_symlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_symlink_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- if (!(args->loc && args->loc->parent))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- local->loc2.path = gf_strdup (args->linkname);
-
- ret = client_pre_symlink (this, &req, args->loc,
- args->linkname, args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SYMLINK, client3_3_symlink_cbk,
- NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfs3_symlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_symlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ local->loc2.path = gf_strdup(args->linkname);
+
+ ret = client_pre_symlink(this, &req, args->loc, args->linkname, args->umask,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SYMLINK,
+ client3_3_symlink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_symlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(symlink, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_rename (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_rename(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_rename_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_rename (this, &req, args->oldloc, args->newloc,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RENAME, client3_3_rename_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_rename_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_rename_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_rename(this, &req, args->oldloc, args->newloc,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RENAME,
+ client3_3_rename_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_rename_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ CLIENT_STACK_UNWIND(rename, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_link (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_link(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_link_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- ret = client_pre_link (this, &req, args->oldloc, args->newloc,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- loc_copy (&local->loc, args->oldloc);
- loc_path (&local->loc, NULL);
- loc_copy (&local->loc2, args->newloc);
- loc_path (&local->loc2, NULL);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_LINK, client3_3_link_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_link_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_link_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ ret = client_pre_link(this, &req, args->oldloc, args->newloc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ loc_copy(&local->loc, args->oldloc);
+ loc_path(&local->loc, NULL);
+ loc_copy(&local->loc2, args->newloc);
+ loc_path(&local->loc2, NULL);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LINK,
+ client3_3_link_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_link_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(link, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_mknod (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_mknod(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_mknod_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_mknod (this, &req, args->loc,
- args->mode, args->rdev, args->umask,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_MKNOD, client3_3_mknod_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_mknod_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_mknod_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_mknod(this, &req, args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKNOD,
+ client3_3_mknod_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_mknod_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(mknod, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_mkdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_mkdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_mkdir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- if (!args->xdata || !dict_get (args->xdata, "gfid-req")) {
- op_errno = EPERM;
- gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_GFID_NULL, "mkdir: %s is received "
- "without gfid-req %p", args->loc->path,
- args->xdata);
- goto unwind;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- if (!(args->loc && args->loc->parent))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_mkdir (this, &req, args->loc, args->mode,
- args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_MKDIR, client3_3_mkdir_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_mkdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_mkdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ if (!args->xdata || !dict_get(args->xdata, "gfid-req")) {
+ op_errno = EPERM;
+ gf_msg_callingfn(this->name, GF_LOG_WARNING, op_errno, PC_MSG_GFID_NULL,
+ "mkdir: %s is received "
+ "without gfid-req %p",
+ args->loc->path, args->xdata);
+ goto unwind;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_mkdir(this, &req, args->loc, args->mode, args->umask,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKDIR,
+ client3_3_mkdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_mkdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(mkdir, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_create (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_create(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_create_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- local->flags = args->flags;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_create (this, &req, args->loc,
- args->fd, args->mode,
- args->flags, args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_CREATE, client3_3_create_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_create_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_create_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ local->flags = args->flags;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_create(this, &req, args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_CREATE,
+ client3_3_create_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_create_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ CLIENT_STACK_UNWIND(create, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_open (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_open(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_open_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->flags = args->flags;
-
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_open (this, &req, args->loc, args->fd, args->flags,
- args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client3_3_open_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_open_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->flags = args->flags;
+
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_open(this, &req, args->loc, args->fd, args->flags,
+ args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client3_3_open_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(open, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_readv (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_readv(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- gfs3_read_req req = {{0,},};
- int ret = 0;
- struct iovec rsp_vec = {0, };
- struct iobuf *rsp_iobuf = NULL;
- struct iobref *rsp_iobref = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_readv (this, &req, args->fd, args->size,
- args->offset, args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- local = frame->local;
-
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsp_vec.iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vec.iov_len = iobuf_pagesize (rsp_iobuf);
-
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
-
- if (args->size > rsp_vec.iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size (%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vec.iov_len);
- op_errno = EINVAL;
- goto unwind;
- }
-
- local->iobref = rsp_iobref;
- rsp_iobref = NULL;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READ, client3_3_readv_cbk, NULL,
- NULL, 0, &rsp_vec, 1,
- local->iobref,
- (xdrproc_t)xdr_gfs3_read_req);
- if (ret) {
- //unwind is done in the cbk
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ gfs3_read_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ struct iovec rsp_vec = {
+ 0,
+ };
+ struct iobuf *rsp_iobuf = NULL;
+ struct iobref *rsp_iobref = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_readv(this, &req, args->fd, args->size, args->offset,
+ args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ local = frame->local;
+
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsp_vec.iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vec.iov_len = iobuf_pagesize(rsp_iobuf);
+
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+
+ if (args->size > rsp_vec.iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size (%lu)",
+ (unsigned long)args->size, (unsigned long)rsp_vec.iov_len);
+ op_errno = EINVAL;
+ goto unwind;
+ }
+
+ local->iobref = rsp_iobref;
+ rsp_iobref = NULL;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READ,
+ client3_3_readv_cbk, NULL, NULL, 0, &rsp_vec, 1,
+ local->iobref, (xdrproc_t)xdr_gfs3_read_req);
+ if (ret) {
+ // unwind is done in the cbk
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
+ if (rsp_iobuf)
+ iobuf_unref(rsp_iobuf);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_writev (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_writev(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_write_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_writev (this, &req, args->fd, args->size,
- args->offset, args->flags, &args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_WRITE, client3_3_writev_cbk,
- args->iobref, args->vector, args->count,
- NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_write_req);
- if (ret) {
- /*
- * If the lower layers fail to submit a request, they'll also
- * do the unwind for us (see rpc_clnt_submit), so don't unwind
- * here in such cases.
- */
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_write_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_writev(this, &req, args->fd, args->size, args->offset,
+ args->flags, &args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_WRITE,
+ client3_3_writev_cbk, args->iobref,
+ args->vector, args->count, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_write_req);
+ if (ret) {
+ /*
+ * If the lower layers fail to submit a request, they'll also
+ * do the unwind for us (see rpc_clnt_submit), so don't unwind
+ * here in such cases.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(writev, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_flush (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_flush(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_flush_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- ret = client_pre_flush (this, &req, args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FLUSH, client3_3_flush_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_flush_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_flush_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ ret = client_pre_flush(this, &req, args->fd, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FLUSH,
+ client3_3_flush_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_flush_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (flush, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(flush, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fsync (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fsync(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_fsync_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = 0;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsync (this, &req, args->fd, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSYNC, client3_3_fsync_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsync_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
-
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_fsync_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = 0;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fsync(this, &req, args->fd, args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNC,
+ client3_3_fsync_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_fsync_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fsync, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fstat (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fstat(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_fstat_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ gfs3_fstat_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_fstat (this, &req, args->fd, args->xdata);
+ ret = client_pre_fstat(this, &req, args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSTAT, client3_3_fstat_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fstat_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSTAT,
+ client3_3_fstat_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_fstat_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fstat, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_opendir (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_opendir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_opendir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_opendir (this, &req, args->loc, args->fd,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR, client3_3_opendir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_opendir(this, &req, args->loc, args->fd, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client3_3_opendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(opendir, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fsyncdir (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_fsyncdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_fsyncdir_req req = {{0,},};
- int ret = 0;
- int32_t op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsyncdir (this, &req, args->fd, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSYNCDIR, client3_3_fsyncdir_cbk,
- NULL, NULL, 0,
- NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fsyncdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_fsyncdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int32_t op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fsyncdir(this, &req, args->fd, args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR,
+ client3_3_fsyncdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_fsyncdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fsyncdir, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_statfs (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_statfs(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_statfs_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_statfs_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
+ args = data;
- conf = this->private;
+ conf = this->private;
- ret = client_pre_statfs (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_STATFS, client3_3_statfs_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_statfs_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_pre_statfs(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STATFS,
+ client3_3_statfs_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_statfs_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(statfs, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_setxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_setxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_setxattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_setxattr (this, &req, args->loc, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETXATTR, client3_3_setxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_setxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.dict.dict_val);
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_setxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_setxattr(this, &req, args->loc, args->xattr, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETXATTR,
+ client3_3_setxattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_setxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.dict.dict_val);
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL);
- GF_FREE (req.dict.dict_val);
+ CLIENT_STACK_UNWIND(setxattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.dict.dict_val);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fsetxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fsetxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_fsetxattr_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsetxattr (this, &req, args->fd, args->flags,
- args->xattr, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSETXATTR, client3_3_fsetxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fsetxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_fsetxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_FREE (req.dict.dict_val);
+ if (!frame || !this || !data)
+ goto unwind;
- GF_FREE (req.xdata.xdata_val);
+ args = data;
+ conf = this->private;
- return 0;
+ ret = client_pre_fsetxattr(this, &req, args->fd, args->flags, args->xattr,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FSETXATTR, client3_3_fsetxattr_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fsetxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.dict_val);
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL);
- GF_FREE (req.dict.dict_val);
+ CLIENT_STACK_UNWIND(fsetxattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.dict.dict_val);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_fgetxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fgetxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_fgetxattr_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- clnt_local_t *local = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);;
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
-
- ret = client_pre_fgetxattr (this, &req, args->fd, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FGETXATTR,
- client3_3_fgetxattr_cbk, NULL,
- rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfs3_fgetxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_fgetxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ clnt_local_t *local = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ ;
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
+ ret = client_pre_fgetxattr(this, &req, args->fd, args->name, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FGETXATTR, client3_3_fgetxattr_cbk,
+ NULL, rsphdr, count, NULL, 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_fgetxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(fgetxattr, frame, -1, op_errno, NULL, NULL);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_getxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_getxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_getxattr_req req = {{0,},};
- dict_t *dict = NULL;
- int ret = 0;
- int32_t op_ret = -1;
- int op_errno = ESTALE;
- int count = 0;
- clnt_local_t *local = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
-
- if (!frame || !this || !data) {
- op_errno = 0;
- goto unwind;
- }
- args = data;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- if (args->name)
- local->name = gf_strdup (args->name);
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_getxattr_req req = {
+ {
+ 0,
+ },
+ };
+ dict_t *dict = NULL;
+ int ret = 0;
+ int32_t op_ret = -1;
+ int op_errno = ESTALE;
+ int count = 0;
+ clnt_local_t *local = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+
+ if (!frame || !this || !data) {
+ op_errno = 0;
+ goto unwind;
+ }
+ args = data;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ if (args->name)
+ local->name = gf_strdup(args->name);
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
+ conf = this->private;
+
+ if (args && args->name) {
+ if (is_client_dump_locks_cmd((char *)args->name)) {
+ dict = dict_new();
+
+ if (!dict) {
op_errno = ENOMEM;
goto unwind;
- }
+ }
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
- if (rsp_iobuf == NULL) {
+ ret = client_dump_locks((char *)args->name, args->loc->inode, dict);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Client dump "
+ "locks failed");
op_errno = ENOMEM;
goto unwind;
- }
+ }
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
-
- conf = this->private;
-
- if (args && args->name) {
- if (is_client_dump_locks_cmd ((char *)args->name)) {
- dict = dict_new ();
-
- if (!dict) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- ret = client_dump_locks ((char *)args->name,
- args->loc->inode,
- dict);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Client dump "
- "locks failed");
- op_errno = ENOMEM;
- goto unwind;
- }
-
- GF_ASSERT (dict);
- op_ret = 0;
- op_errno = 0;
- goto unwind;
- }
+ GF_ASSERT(dict);
+ op_ret = 0;
+ op_errno = 0;
+ goto unwind;
}
+ }
- ret = client_pre_getxattr (this, &req, args->loc, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_GETXATTR,
- client3_3_getxattr_cbk, NULL,
- rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfs3_getxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_pre_getxattr(this, &req, args->loc, args->name, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETXATTR,
+ client3_3_getxattr_cbk, NULL, rsphdr, count,
+ NULL, 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_getxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL);
+ CLIENT_STACK_UNWIND(getxattr, frame, op_ret, op_errno, dict, NULL);
- if (dict) {
- dict_unref(dict);
- }
+ if (dict) {
+ dict_unref(dict);
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_xattrop (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_xattrop(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_xattrop_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- int count = 0;
- clnt_local_t *local = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
- conf = this->private;
-
- ret = client_pre_xattrop (this, &req, args->loc, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_XATTROP,
- client3_3_xattrop_cbk, NULL,
- rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfs3_xattrop_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.dict.dict_val);
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_xattrop_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ int count = 0;
+ clnt_local_t *local = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+ conf = this->private;
+
+ ret = client_pre_xattrop(this, &req, args->loc, args->xattr, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_XATTROP,
+ client3_3_xattrop_cbk, NULL, rsphdr, count,
+ NULL, 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_xattrop_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.dict_val);
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(xattrop, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fxattrop (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fxattrop(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- gfs3_fxattrop_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fxattrop (this, &req, args->fd, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- local = frame->local;
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FXATTROP,
- client3_3_fxattrop_cbk, NULL,
- rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfs3_fxattrop_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.dict.dict_val);
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ gfs3_fxattrop_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fxattrop(this, &req, args->fd, args->xattr, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ local = frame->local;
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FXATTROP,
+ client3_3_fxattrop_cbk, NULL, rsphdr, count,
+ NULL, 0, local->iobref,
+ (xdrproc_t)xdr_gfs3_fxattrop_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.dict_val);
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(fxattrop, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_removexattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_removexattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_removexattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_removexattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- ret = client_pre_removexattr (this, &req, args->loc, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_REMOVEXATTR,
- client3_3_removexattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_removexattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (!frame || !this || !data)
+ goto unwind;
- GF_FREE (req.xdata.xdata_val);
+ args = data;
+ conf = this->private;
- return 0;
+ ret = client_pre_removexattr(this, &req, args->loc, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_REMOVEXATTR, client3_3_removexattr_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_removexattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(removexattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_fremovexattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fremovexattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_fremovexattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_fremovexattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
+ args = data;
- conf = this->private;
+ conf = this->private;
- ret = client_pre_fremovexattr (this, &req, args->fd, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FREMOVEXATTR,
- client3_3_fremovexattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fremovexattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ ret = client_pre_fremovexattr(this, &req, args->fd, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FREMOVEXATTR,
+ client3_3_fremovexattr_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfs3_fremovexattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fremovexattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_lease (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_lease(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_lease_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- GF_VALIDATE_OR_GOTO ("client", this, unwind);
- GF_VALIDATE_OR_GOTO (this->name, frame, unwind);
- GF_VALIDATE_OR_GOTO (this->name, data, unwind);
-
- args = data;
- conf = this->private;
-
- ret = client_pre_lease (this, &req, args->loc, args->lease,
- args->xdata);
- if (ret < 0) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LEASE,
- client3_3_lease_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lease_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_lease_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ GF_VALIDATE_OR_GOTO("client", this, unwind);
+ GF_VALIDATE_OR_GOTO(this->name, frame, unwind);
+ GF_VALIDATE_OR_GOTO(this->name, data, unwind);
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_lease(this, &req, args->loc, args->lease, args->xdata);
+ if (ret < 0) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LEASE,
+ client3_3_lease_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_lease_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lease, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(lease, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_lk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_lk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_lk_req req = {{0,},};
- int32_t gf_cmd = 0;
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- ret = client_cmd_to_gf_cmd (args->cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto unwind;
- }
-
- local->owner = frame->root->lk_owner;
- local->cmd = args->cmd;
- local->fd = fd_ref (args->fd);
-
- ret = client_pre_lk (this, &req, args->cmd, args->flock,
- args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LK,
- client3_3_lk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_lk_req req = {
+ {
+ 0,
+ },
+ };
+ int32_t gf_cmd = 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ ret = client_cmd_to_gf_cmd(args->cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto unwind;
+ }
+
+ local->owner = frame->root->lk_owner;
+ local->cmd = args->cmd;
+ local->fd = fd_ref(args->fd);
+
+ ret = client_pre_lk(this, &req, args->cmd, args->flock, args->fd,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LK,
+ client3_3_lk_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_lk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(lk, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_inodelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_inodelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_inodelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_inodelk (this, &req, args->loc, args->cmd,
- args->flock, args->volume, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_INODELK,
- client3_3_inodelk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_inodelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_inodelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_inodelk(this, &req, args->loc, args->cmd, args->flock,
+ args->volume, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_INODELK,
+ client3_3_inodelk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_inodelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(inodelk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_finodelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_finodelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_finodelk_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_finodelk (this, &req, args->fd,
- args->cmd, args->flock, args->volume,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FINODELK,
- client3_3_finodelk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_finodelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_finodelk_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_finodelk(this, &req, args->fd, args->cmd, args->flock,
+ args->volume, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FINODELK,
+ client3_3_finodelk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_finodelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(finodelk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_entrylk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_entrylk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_entrylk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
- ret = client_pre_entrylk (this, &req, args->loc, args->cmd_entrylk,
- args->type, args->volume, args->basename,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ENTRYLK,
- client3_3_entrylk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_entrylk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_entrylk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ ret = client_pre_entrylk(this, &req, args->loc, args->cmd_entrylk,
+ args->type, args->volume, args->basename,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ENTRYLK,
+ client3_3_entrylk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_entrylk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(entrylk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client3_3_fentrylk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_fentrylk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_fentrylk_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fentrylk (this, &req, args->fd, args->cmd_entrylk,
- args->type, args->volume, args->basename,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FENTRYLK,
- client3_3_fentrylk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fentrylk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfs3_fentrylk_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fentrylk(this, &req, args->fd, args->cmd_entrylk,
+ args->type, args->volume, args->basename,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FENTRYLK,
+ client3_3_fentrylk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_fentrylk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fentrylk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_rchecksum (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_rchecksum_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_rchecksum_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- args = data;
- conf = this->private;
-
- ret = client_pre_rchecksum (this, &req, args->fd, args->len,
- args->offset, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RCHECKSUM,
- client3_3_rchecksum_cbk, NULL,
- NULL, 0, NULL,
- 0, NULL,
- (xdrproc_t)xdr_gfs3_rchecksum_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (!frame || !this || !data)
+ goto unwind;
- GF_FREE (req.xdata.xdata_val);
+ args = data;
+ conf = this->private;
- return 0;
+ ret = client_pre_rchecksum(this, &req, args->fd, args->len, args->offset,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_RCHECKSUM, client3_3_rchecksum_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_rchecksum_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_readdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_readdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- gfs3_readdir_req req = {{0,},};
- gfs3_readdir_rsp rsp = {0, };
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- int readdir_rsp_size = 0;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ gfs3_readdir_req req = {
+ {
+ 0,
+ },
+ };
+ gfs3_readdir_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ int readdir_rsp_size = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ readdir_rsp_size = xdr_sizeof((xdrproc_t)xdr_gfs3_readdir_rsp, &rsp) +
+ args->size;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->cmd = remote_fd;
+
+ if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE +
+ GLUSTERFS_RDMA_MAX_HEADER_SIZE) > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
- args = data;
- conf = this->private;
+ /* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
- readdir_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdir_rsp, &rsp)
- + args->size;
+ iobref_add(rsp_iobref, rsp_iobuf);
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->cmd = remote_fd;
-
- if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE + GLUSTERFS_RDMA_MAX_HEADER_SIZE)
- > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This iobuf will live for only receiving the response,
- so not harmful */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- iobref_add (rsp_iobref, rsp_iobuf);
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
- }
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
- ret = client_pre_readdir (this, &req, args->fd, args->size,
- args->offset, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ ret = client_pre_readdir(this, &req, args->fd, args->size, args->offset,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READDIR,
- client3_3_readdir_cbk, NULL,
- rsphdr, count,
- NULL, 0, rsp_iobref,
- (xdrproc_t)xdr_gfs3_readdir_req);
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIR,
+ client3_3_readdir_cbk, NULL, rsphdr, count,
+ NULL, 0, rsp_iobref,
+ (xdrproc_t)xdr_gfs3_readdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(readdir, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int32_t
-client3_3_readdirp (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_readdirp(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfs3_readdirp_req req = {{0,},};
- gfs3_readdirp_rsp rsp = {0,};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- int readdirp_rsp_size = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
+ clnt_args_t *args = NULL;
+ gfs3_readdirp_req req = {
+ {
+ 0,
+ },
+ };
+ gfs3_readdirp_rsp rsp = {
+ 0,
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ int readdirp_rsp_size = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ clnt_local_t *local = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ ret = client_pre_readdirp(this, &req, args->fd, args->size, args->offset,
+ args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ readdirp_rsp_size = xdr_sizeof((xdrproc_t)xdr_gfs3_readdirp_rsp, &rsp) +
+ args->size;
+
+ if ((readdirp_rsp_size + GLUSTERFS_RPC_REPLY_SIZE +
+ GLUSTERFS_RDMA_MAX_HEADER_SIZE) > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
}
- frame->local = local;
-
- ret = client_pre_readdirp (this, &req, args->fd, args->size,
- args->offset, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
+ /* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
}
- readdirp_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdirp_rsp, &rsp)
- + args->size;
-
- if ((readdirp_rsp_size + GLUSTERFS_RPC_REPLY_SIZE
- + GLUSTERFS_RDMA_MAX_HEADER_SIZE)
- > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This iobuf will live for only receiving the response,
- so not harmful */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
- }
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
- local->fd = fd_ref (args->fd);
+ local->fd = fd_ref(args->fd);
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READDIRP,
- client3_3_readdirp_cbk, NULL,
- rsphdr, count, NULL,
- 0, rsp_iobref,
- (xdrproc_t)xdr_gfs3_readdirp_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIRP,
+ client3_3_readdirp_cbk, NULL, rsphdr, count,
+ NULL, 0, rsp_iobref,
+ (xdrproc_t)xdr_gfs3_readdirp_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- return 0;
+ return 0;
unwind:
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL);
- return 0;
+ CLIENT_STACK_UNWIND(readdirp, frame, -1, op_errno, NULL, NULL);
+ return 0;
}
-
int32_t
-client3_3_setattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_setattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_setattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_setattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_setattr (this, &req, args->loc, args->valid,
- args->stbuf, args->xdata);
+ ret = client_pre_setattr(this, &req, args->loc, args->valid, args->stbuf,
+ args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETATTR,
- client3_3_setattr_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_setattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETATTR,
+ client3_3_setattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_setattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(setattr, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_fsetattr (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_fsetattr_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsetattr (this, &req, args->fd, args->valid,
- args->stbuf, args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSETATTR,
- client3_3_fsetattr_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsetattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_fsetattr_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fsetattr(this, &req, args->fd, args->valid, args->stbuf,
+ args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR,
+ client3_3_fsetattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_fsetattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
client3_3_fallocate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_fallocate_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fallocate (this, &req, args->fd, args->flags,
- args->offset, args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FALLOCATE,
- client3_3_fallocate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fallocate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_fallocate_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fallocate(this, &req, args->fd, args->flags, args->offset,
+ args->size, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FALLOCATE, client3_3_fallocate_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fallocate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fallocate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(fallocate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
client3_3_discard(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_discard_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_discard (this, &req, args->fd, args->offset,
- args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
-
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_DISCARD, client3_3_discard_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_discard_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_discard_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_discard(this, &req, args->fd, args->offset, args->size,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_DISCARD,
+ client3_3_discard_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_discard_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(discard, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(discard, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
client3_3_zerofill(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_zerofill_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- GF_ASSERT (frame);
-
- if (!this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_zerofill (this, &req, args->fd, args->offset,
- args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_ZEROFILL, client3_3_zerofill_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_zerofill_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_zerofill_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ GF_ASSERT(frame);
+
+ if (!this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_zerofill(this, &req, args->fd, args->offset, args->size,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ZEROFILL,
+ client3_3_zerofill_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_zerofill_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(zerofill, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(zerofill, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_ipc (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_ipc(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfs3_ipc_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfs3_ipc_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- if (!this || !data)
- goto unwind;
+ if (!this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_ipc (this, &req, args->cmd, args->xdata);
+ ret = client_pre_ipc(this, &req, args->cmd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_IPC, client3_3_ipc_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_ipc_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_IPC,
+ client3_3_ipc_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_ipc_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
int32_t
-client3_3_seek (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_seek(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- struct gfs3_seek_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ struct gfs3_seek_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- if (!this || !data)
- goto unwind;
+ if (!this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_seek (this, &req, args->fd,
- args->offset, args->what, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ ret = client_pre_seek(this, &req, args->fd, args->offset, args->what,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_SEEK, client3_3_seek_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_seek_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SEEK,
+ client3_3_seek_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_seek_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
/* Brief explanation of gfs3_compound_req structure :
@@ -5826,368 +5923,368 @@ unwind:
*/
int32_t
-client3_3_compound (call_frame_t *frame, xlator_t *this, void *data)
+client3_3_compound(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- compound_args_t *c_args = data;
- gfs3_compound_req req = {0,};
- clnt_local_t *local = NULL;
- int op_errno = ENOMEM;
- int ret = 0;
- int i = 0;
- int rsp_count = 0;
- struct iovec rsp_vector[MAX_IOVEC] = {{0}, };
- struct iovec req_vector[MAX_IOVEC] = {{0}, };
- struct iovec vector[MAX_IOVEC] = {{0}, };
- struct iovec *rsphdr = NULL;
- struct iobref *req_iobref = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobref *rsphdr_iobref = NULL;
- struct iobuf *rsphdr_iobuf = NULL;
- int rsphdr_count = 0;
- int req_count = 0;
- dict_t *xdata = c_args->xdata;
-
- GF_ASSERT (frame);
-
- if (!this)
- goto unwind;
-
- memset (req_vector, 0, sizeof (req_vector));
- memset (rsp_vector, 0, sizeof (rsp_vector));
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->length = c_args->fop_length;
- local->compound_args = c_args;
-
- rsphdr_iobref = iobref_new ();
- if (rsphdr_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsphdr_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsphdr_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsphdr_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsphdr_iobuf);
- rsphdr_count = 1;
- iobref_add (rsphdr_iobref, rsphdr_iobuf);
- iobuf_unref (rsphdr_iobuf);
- rsphdr_iobuf = NULL;
-
- req.compound_fop_enum = c_args->fop_enum;
- req.compound_req_array.compound_req_array_len = c_args->fop_length;
- req.compound_version = 0;
- if (xdata) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata,
- (&req.xdata.xdata_val),
- req.xdata.xdata_len,
- op_errno, unwind);
- }
-
- req.compound_req_array.compound_req_array_val = GF_CALLOC (local->length,
- sizeof (compound_req),
- gf_client_mt_compound_req_t);
-
- if (!req.compound_req_array.compound_req_array_val) {
- op_errno = ENOMEM;
- goto unwind;
+ clnt_conf_t *conf = NULL;
+ compound_args_t *c_args = data;
+ gfs3_compound_req req = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ int op_errno = ENOMEM;
+ int ret = 0;
+ int i = 0;
+ int rsp_count = 0;
+ struct iovec rsp_vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec req_vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec *rsphdr = NULL;
+ struct iobref *req_iobref = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iobref *rsphdr_iobref = NULL;
+ struct iobuf *rsphdr_iobuf = NULL;
+ int rsphdr_count = 0;
+ int req_count = 0;
+ dict_t *xdata = c_args->xdata;
+
+ GF_ASSERT(frame);
+
+ if (!this)
+ goto unwind;
+
+ memset(req_vector, 0, sizeof(req_vector));
+ memset(rsp_vector, 0, sizeof(rsp_vector));
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->length = c_args->fop_length;
+ local->compound_args = c_args;
+
+ rsphdr_iobref = iobref_new();
+ if (rsphdr_iobref == NULL) {
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsphdr_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsphdr_iobuf == NULL) {
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsphdr_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsphdr_iobuf);
+ rsphdr_count = 1;
+ iobref_add(rsphdr_iobref, rsphdr_iobuf);
+ iobuf_unref(rsphdr_iobuf);
+ rsphdr_iobuf = NULL;
+
+ req.compound_fop_enum = c_args->fop_enum;
+ req.compound_req_array.compound_req_array_len = c_args->fop_length;
+ req.compound_version = 0;
+ if (xdata) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req.xdata.xdata_val),
+ req.xdata.xdata_len, op_errno, unwind);
+ }
+
+ req.compound_req_array.compound_req_array_val = GF_CALLOC(
+ local->length, sizeof(compound_req), gf_client_mt_compound_req_t);
+
+ if (!req.compound_req_array.compound_req_array_val) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ for (i = 0; i < local->length; i++) {
+ ret = client_handle_fop_requirements(
+ this, frame, &req, local, &req_iobref, &rsp_iobref, req_vector,
+ rsp_vector, &req_count, &rsp_count, &c_args->req_list[i],
+ c_args->enum_list[i], i);
+ if (ret) {
+ op_errno = ret;
+ goto unwind;
}
+ }
- for (i = 0; i < local->length; i++) {
- ret = client_handle_fop_requirements (this, frame,
- &req, local,
- &req_iobref, &rsp_iobref,
- req_vector,
- rsp_vector, &req_count,
- &rsp_count,
- &c_args->req_list[i],
- c_args->enum_list[i],
- i);
- if (ret) {
- op_errno = ret;
- goto unwind;
- }
- }
+ local->iobref = rsp_iobref;
+ rsp_iobref = NULL;
- local->iobref = rsp_iobref;
- rsp_iobref = NULL;
+ ret = client_submit_compound_request(
+ this, &req, frame, conf->fops, GFS3_OP_COMPOUND, client3_3_compound_cbk,
+ req_vector, req_count, req_iobref, rsphdr, rsphdr_count, rsp_vector,
+ rsp_count, local->iobref, (xdrproc_t)xdr_gfs3_compound_req);
- ret = client_submit_compound_request (this, &req, frame, conf->fops,
- GFS3_OP_COMPOUND, client3_3_compound_cbk,
- req_vector, req_count, req_iobref,
- rsphdr, rsphdr_count,
- rsp_vector, rsp_count,
- local->iobref,
- (xdrproc_t) xdr_gfs3_compound_req);
+ GF_FREE(req.xdata.xdata_val);
- GF_FREE (req.xdata.xdata_val);
+ iobref_unref(rsphdr_iobref);
- iobref_unref (rsphdr_iobref);
-
- compound_request_cleanup (&req);
- return 0;
+ compound_request_cleanup(&req);
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (compound, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(compound, frame, -1, op_errno, NULL, NULL);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- if (rsphdr_iobref)
- iobref_unref (rsphdr_iobref);
+ if (rsphdr_iobref)
+ iobref_unref(rsphdr_iobref);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- compound_request_cleanup (&req);
- return 0;
+ compound_request_cleanup(&req);
+ return 0;
}
static int32_t
-client3_3_getactivelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_getactivelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_getactivelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- if (!gf_uuid_is_null (args->loc->inode->gfid))
- memcpy (req.gfid, args->loc->inode->gfid, 16);
- else
- memcpy (req.gfid, args->loc->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.gfid)),
- unwind, op_errno, EINVAL);
- conf = this->private;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_GETACTIVELK,
- client3_3_getactivelk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_getactivelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_getactivelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ if (!gf_uuid_is_null(args->loc->inode->gfid))
+ memcpy(req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy(req.gfid, args->loc->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req.gfid)),
+ unwind, op_errno, EINVAL);
+ conf = this->private;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, args->xdata, (&req.xdata.xdata_val),
+ req.xdata.xdata_len, op_errno, unwind);
+
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_GETACTIVELK, client3_3_getactivelk_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_getactivelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.xdata_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (getactivelk, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(getactivelk, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- return 0;
+ return 0;
}
static int32_t
-client3_3_setactivelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client3_3_setactivelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_setactivelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_setactivelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- if (!(args->loc && args->loc->inode && args->locklist))
- goto unwind;
+ args = data;
+ if (!(args->loc && args->loc->inode && args->locklist))
+ goto unwind;
- if (!gf_uuid_is_null (args->loc->inode->gfid))
- memcpy (req.gfid, args->loc->inode->gfid, 16);
- else
- memcpy (req.gfid, args->loc->gfid, 16);
+ if (!gf_uuid_is_null(args->loc->inode->gfid))
+ memcpy(req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy(req.gfid, args->loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.gfid)),
- unwind, op_errno, EINVAL);
- conf = this->private;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req.gfid)),
+ unwind, op_errno, EINVAL);
+ conf = this->private;
- GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
+ GF_PROTOCOL_DICT_SERIALIZE(this, args->xdata, (&req.xdata.xdata_val),
+ req.xdata.xdata_len, op_errno, unwind);
- ret = serialize_req_locklist (args->locklist, &req);
+ ret = serialize_req_locklist(args->locklist, &req);
- if (ret)
- goto unwind;
+ if (ret)
+ goto unwind;
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETACTIVELK, client3_3_setactivelk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_setactivelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_SETACTIVELK, client3_3_setactivelk_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_setactivelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ clnt_setactivelk_req_cleanup(&req);
- clnt_setactivelk_req_cleanup (&req);
+ GF_FREE(req.xdata.xdata_val);
- GF_FREE (req.xdata.xdata_val);
-
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setactivelk, frame, -1, op_errno, NULL);
+ CLIENT_STACK_UNWIND(setactivelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.xdata_val);
+ GF_FREE(req.xdata.xdata_val);
- clnt_setactivelk_req_cleanup (&req);
+ clnt_setactivelk_req_cleanup(&req);
- return 0;
+ return 0;
}
-
/* Table Specific to FOPS */
rpc_clnt_procedure_t clnt3_3_fop_actors[GF_FOP_MAXVALUE] = {
- [GF_FOP_NULL] = { "NULL", NULL},
- [GF_FOP_STAT] = { "STAT", client3_3_stat },
- [GF_FOP_READLINK] = { "READLINK", client3_3_readlink },
- [GF_FOP_MKNOD] = { "MKNOD", client3_3_mknod },
- [GF_FOP_MKDIR] = { "MKDIR", client3_3_mkdir },
- [GF_FOP_UNLINK] = { "UNLINK", client3_3_unlink },
- [GF_FOP_RMDIR] = { "RMDIR", client3_3_rmdir },
- [GF_FOP_SYMLINK] = { "SYMLINK", client3_3_symlink },
- [GF_FOP_RENAME] = { "RENAME", client3_3_rename },
- [GF_FOP_LINK] = { "LINK", client3_3_link },
- [GF_FOP_TRUNCATE] = { "TRUNCATE", client3_3_truncate },
- [GF_FOP_OPEN] = { "OPEN", client3_3_open },
- [GF_FOP_READ] = { "READ", client3_3_readv },
- [GF_FOP_WRITE] = { "WRITE", client3_3_writev },
- [GF_FOP_STATFS] = { "STATFS", client3_3_statfs },
- [GF_FOP_FLUSH] = { "FLUSH", client3_3_flush },
- [GF_FOP_FSYNC] = { "FSYNC", client3_3_fsync },
- [GF_FOP_SETXATTR] = { "SETXATTR", client3_3_setxattr },
- [GF_FOP_GETXATTR] = { "GETXATTR", client3_3_getxattr },
- [GF_FOP_REMOVEXATTR] = { "REMOVEXATTR", client3_3_removexattr },
- [GF_FOP_OPENDIR] = { "OPENDIR", client3_3_opendir },
- [GF_FOP_FSYNCDIR] = { "FSYNCDIR", client3_3_fsyncdir },
- [GF_FOP_ACCESS] = { "ACCESS", client3_3_access },
- [GF_FOP_CREATE] = { "CREATE", client3_3_create },
- [GF_FOP_FTRUNCATE] = { "FTRUNCATE", client3_3_ftruncate },
- [GF_FOP_FSTAT] = { "FSTAT", client3_3_fstat },
- [GF_FOP_LK] = { "LK", client3_3_lk },
- [GF_FOP_LOOKUP] = { "LOOKUP", client3_3_lookup },
- [GF_FOP_READDIR] = { "READDIR", client3_3_readdir },
- [GF_FOP_INODELK] = { "INODELK", client3_3_inodelk },
- [GF_FOP_FINODELK] = { "FINODELK", client3_3_finodelk },
- [GF_FOP_ENTRYLK] = { "ENTRYLK", client3_3_entrylk },
- [GF_FOP_FENTRYLK] = { "FENTRYLK", client3_3_fentrylk },
- [GF_FOP_XATTROP] = { "XATTROP", client3_3_xattrop },
- [GF_FOP_FXATTROP] = { "FXATTROP", client3_3_fxattrop },
- [GF_FOP_FGETXATTR] = { "FGETXATTR", client3_3_fgetxattr },
- [GF_FOP_FSETXATTR] = { "FSETXATTR", client3_3_fsetxattr },
- [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client3_3_rchecksum },
- [GF_FOP_SETATTR] = { "SETATTR", client3_3_setattr },
- [GF_FOP_FSETATTR] = { "FSETATTR", client3_3_fsetattr },
- [GF_FOP_READDIRP] = { "READDIRP", client3_3_readdirp },
- [GF_FOP_FALLOCATE] = { "FALLOCATE", client3_3_fallocate },
- [GF_FOP_DISCARD] = { "DISCARD", client3_3_discard },
- [GF_FOP_ZEROFILL] = { "ZEROFILL", client3_3_zerofill},
- [GF_FOP_RELEASE] = { "RELEASE", client3_3_release },
- [GF_FOP_RELEASEDIR] = { "RELEASEDIR", client3_3_releasedir },
- [GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec },
- [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client3_3_fremovexattr },
- [GF_FOP_IPC] = { "IPC", client3_3_ipc },
- [GF_FOP_SEEK] = { "SEEK", client3_3_seek },
- [GF_FOP_LEASE] = { "LEASE", client3_3_lease },
- [GF_FOP_GETACTIVELK] = { "GETACTIVELK", client3_3_getactivelk},
- [GF_FOP_SETACTIVELK] = { "SETACTIVELK", client3_3_setactivelk},
- [GF_FOP_COMPOUND] = { "COMPOUND", client3_3_compound },
+ [GF_FOP_NULL] = {"NULL", NULL},
+ [GF_FOP_STAT] = {"STAT", client3_3_stat},
+ [GF_FOP_READLINK] = {"READLINK", client3_3_readlink},
+ [GF_FOP_MKNOD] = {"MKNOD", client3_3_mknod},
+ [GF_FOP_MKDIR] = {"MKDIR", client3_3_mkdir},
+ [GF_FOP_UNLINK] = {"UNLINK", client3_3_unlink},
+ [GF_FOP_RMDIR] = {"RMDIR", client3_3_rmdir},
+ [GF_FOP_SYMLINK] = {"SYMLINK", client3_3_symlink},
+ [GF_FOP_RENAME] = {"RENAME", client3_3_rename},
+ [GF_FOP_LINK] = {"LINK", client3_3_link},
+ [GF_FOP_TRUNCATE] = {"TRUNCATE", client3_3_truncate},
+ [GF_FOP_OPEN] = {"OPEN", client3_3_open},
+ [GF_FOP_READ] = {"READ", client3_3_readv},
+ [GF_FOP_WRITE] = {"WRITE", client3_3_writev},
+ [GF_FOP_STATFS] = {"STATFS", client3_3_statfs},
+ [GF_FOP_FLUSH] = {"FLUSH", client3_3_flush},
+ [GF_FOP_FSYNC] = {"FSYNC", client3_3_fsync},
+ [GF_FOP_SETXATTR] = {"SETXATTR", client3_3_setxattr},
+ [GF_FOP_GETXATTR] = {"GETXATTR", client3_3_getxattr},
+ [GF_FOP_REMOVEXATTR] = {"REMOVEXATTR", client3_3_removexattr},
+ [GF_FOP_OPENDIR] = {"OPENDIR", client3_3_opendir},
+ [GF_FOP_FSYNCDIR] = {"FSYNCDIR", client3_3_fsyncdir},
+ [GF_FOP_ACCESS] = {"ACCESS", client3_3_access},
+ [GF_FOP_CREATE] = {"CREATE", client3_3_create},
+ [GF_FOP_FTRUNCATE] = {"FTRUNCATE", client3_3_ftruncate},
+ [GF_FOP_FSTAT] = {"FSTAT", client3_3_fstat},
+ [GF_FOP_LK] = {"LK", client3_3_lk},
+ [GF_FOP_LOOKUP] = {"LOOKUP", client3_3_lookup},
+ [GF_FOP_READDIR] = {"READDIR", client3_3_readdir},
+ [GF_FOP_INODELK] = {"INODELK", client3_3_inodelk},
+ [GF_FOP_FINODELK] = {"FINODELK", client3_3_finodelk},
+ [GF_FOP_ENTRYLK] = {"ENTRYLK", client3_3_entrylk},
+ [GF_FOP_FENTRYLK] = {"FENTRYLK", client3_3_fentrylk},
+ [GF_FOP_XATTROP] = {"XATTROP", client3_3_xattrop},
+ [GF_FOP_FXATTROP] = {"FXATTROP", client3_3_fxattrop},
+ [GF_FOP_FGETXATTR] = {"FGETXATTR", client3_3_fgetxattr},
+ [GF_FOP_FSETXATTR] = {"FSETXATTR", client3_3_fsetxattr},
+ [GF_FOP_RCHECKSUM] = {"RCHECKSUM", client3_3_rchecksum},
+ [GF_FOP_SETATTR] = {"SETATTR", client3_3_setattr},
+ [GF_FOP_FSETATTR] = {"FSETATTR", client3_3_fsetattr},
+ [GF_FOP_READDIRP] = {"READDIRP", client3_3_readdirp},
+ [GF_FOP_FALLOCATE] = {"FALLOCATE", client3_3_fallocate},
+ [GF_FOP_DISCARD] = {"DISCARD", client3_3_discard},
+ [GF_FOP_ZEROFILL] = {"ZEROFILL", client3_3_zerofill},
+ [GF_FOP_RELEASE] = {"RELEASE", client3_3_release},
+ [GF_FOP_RELEASEDIR] = {"RELEASEDIR", client3_3_releasedir},
+ [GF_FOP_GETSPEC] = {"GETSPEC", client3_getspec},
+ [GF_FOP_FREMOVEXATTR] = {"FREMOVEXATTR", client3_3_fremovexattr},
+ [GF_FOP_IPC] = {"IPC", client3_3_ipc},
+ [GF_FOP_SEEK] = {"SEEK", client3_3_seek},
+ [GF_FOP_LEASE] = {"LEASE", client3_3_lease},
+ [GF_FOP_GETACTIVELK] = {"GETACTIVELK", client3_3_getactivelk},
+ [GF_FOP_SETACTIVELK] = {"SETACTIVELK", client3_3_setactivelk},
+ [GF_FOP_COMPOUND] = {"COMPOUND", client3_3_compound},
};
/* Used From RPC-CLNT library to log proper name of procedure based on number */
char *clnt3_3_fop_names[GFS3_OP_MAXVALUE] = {
- [GFS3_OP_NULL] = "NULL",
- [GFS3_OP_STAT] = "STAT",
- [GFS3_OP_READLINK] = "READLINK",
- [GFS3_OP_MKNOD] = "MKNOD",
- [GFS3_OP_MKDIR] = "MKDIR",
- [GFS3_OP_UNLINK] = "UNLINK",
- [GFS3_OP_RMDIR] = "RMDIR",
- [GFS3_OP_SYMLINK] = "SYMLINK",
- [GFS3_OP_RENAME] = "RENAME",
- [GFS3_OP_LINK] = "LINK",
- [GFS3_OP_TRUNCATE] = "TRUNCATE",
- [GFS3_OP_OPEN] = "OPEN",
- [GFS3_OP_READ] = "READ",
- [GFS3_OP_WRITE] = "WRITE",
- [GFS3_OP_STATFS] = "STATFS",
- [GFS3_OP_FLUSH] = "FLUSH",
- [GFS3_OP_FSYNC] = "FSYNC",
- [GFS3_OP_SETXATTR] = "SETXATTR",
- [GFS3_OP_GETXATTR] = "GETXATTR",
- [GFS3_OP_REMOVEXATTR] = "REMOVEXATTR",
- [GFS3_OP_OPENDIR] = "OPENDIR",
- [GFS3_OP_FSYNCDIR] = "FSYNCDIR",
- [GFS3_OP_ACCESS] = "ACCESS",
- [GFS3_OP_CREATE] = "CREATE",
- [GFS3_OP_FTRUNCATE] = "FTRUNCATE",
- [GFS3_OP_FSTAT] = "FSTAT",
- [GFS3_OP_LK] = "LK",
- [GFS3_OP_LOOKUP] = "LOOKUP",
- [GFS3_OP_READDIR] = "READDIR",
- [GFS3_OP_INODELK] = "INODELK",
- [GFS3_OP_FINODELK] = "FINODELK",
- [GFS3_OP_ENTRYLK] = "ENTRYLK",
- [GFS3_OP_FENTRYLK] = "FENTRYLK",
- [GFS3_OP_XATTROP] = "XATTROP",
- [GFS3_OP_FXATTROP] = "FXATTROP",
- [GFS3_OP_FGETXATTR] = "FGETXATTR",
- [GFS3_OP_FSETXATTR] = "FSETXATTR",
- [GFS3_OP_RCHECKSUM] = "RCHECKSUM",
- [GFS3_OP_SETATTR] = "SETATTR",
- [GFS3_OP_FSETATTR] = "FSETATTR",
- [GFS3_OP_READDIRP] = "READDIRP",
- [GFS3_OP_RELEASE] = "RELEASE",
- [GFS3_OP_RELEASEDIR] = "RELEASEDIR",
- [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR",
- [GFS3_OP_FALLOCATE] = "FALLOCATE",
- [GFS3_OP_DISCARD] = "DISCARD",
- [GFS3_OP_ZEROFILL] = "ZEROFILL",
- [GFS3_OP_IPC] = "IPC",
- [GFS3_OP_SEEK] = "SEEK",
- [GFS3_OP_LEASE] = "LEASE",
- [GFS3_OP_GETACTIVELK] = "GETACTIVELK",
- [GFS3_OP_SETACTIVELK] = "SETACTIVELK",
- [GFS3_OP_COMPOUND] = "COMPOUND",
+ [GFS3_OP_NULL] = "NULL",
+ [GFS3_OP_STAT] = "STAT",
+ [GFS3_OP_READLINK] = "READLINK",
+ [GFS3_OP_MKNOD] = "MKNOD",
+ [GFS3_OP_MKDIR] = "MKDIR",
+ [GFS3_OP_UNLINK] = "UNLINK",
+ [GFS3_OP_RMDIR] = "RMDIR",
+ [GFS3_OP_SYMLINK] = "SYMLINK",
+ [GFS3_OP_RENAME] = "RENAME",
+ [GFS3_OP_LINK] = "LINK",
+ [GFS3_OP_TRUNCATE] = "TRUNCATE",
+ [GFS3_OP_OPEN] = "OPEN",
+ [GFS3_OP_READ] = "READ",
+ [GFS3_OP_WRITE] = "WRITE",
+ [GFS3_OP_STATFS] = "STATFS",
+ [GFS3_OP_FLUSH] = "FLUSH",
+ [GFS3_OP_FSYNC] = "FSYNC",
+ [GFS3_OP_SETXATTR] = "SETXATTR",
+ [GFS3_OP_GETXATTR] = "GETXATTR",
+ [GFS3_OP_REMOVEXATTR] = "REMOVEXATTR",
+ [GFS3_OP_OPENDIR] = "OPENDIR",
+ [GFS3_OP_FSYNCDIR] = "FSYNCDIR",
+ [GFS3_OP_ACCESS] = "ACCESS",
+ [GFS3_OP_CREATE] = "CREATE",
+ [GFS3_OP_FTRUNCATE] = "FTRUNCATE",
+ [GFS3_OP_FSTAT] = "FSTAT",
+ [GFS3_OP_LK] = "LK",
+ [GFS3_OP_LOOKUP] = "LOOKUP",
+ [GFS3_OP_READDIR] = "READDIR",
+ [GFS3_OP_INODELK] = "INODELK",
+ [GFS3_OP_FINODELK] = "FINODELK",
+ [GFS3_OP_ENTRYLK] = "ENTRYLK",
+ [GFS3_OP_FENTRYLK] = "FENTRYLK",
+ [GFS3_OP_XATTROP] = "XATTROP",
+ [GFS3_OP_FXATTROP] = "FXATTROP",
+ [GFS3_OP_FGETXATTR] = "FGETXATTR",
+ [GFS3_OP_FSETXATTR] = "FSETXATTR",
+ [GFS3_OP_RCHECKSUM] = "RCHECKSUM",
+ [GFS3_OP_SETATTR] = "SETATTR",
+ [GFS3_OP_FSETATTR] = "FSETATTR",
+ [GFS3_OP_READDIRP] = "READDIRP",
+ [GFS3_OP_RELEASE] = "RELEASE",
+ [GFS3_OP_RELEASEDIR] = "RELEASEDIR",
+ [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR",
+ [GFS3_OP_FALLOCATE] = "FALLOCATE",
+ [GFS3_OP_DISCARD] = "DISCARD",
+ [GFS3_OP_ZEROFILL] = "ZEROFILL",
+ [GFS3_OP_IPC] = "IPC",
+ [GFS3_OP_SEEK] = "SEEK",
+ [GFS3_OP_LEASE] = "LEASE",
+ [GFS3_OP_GETACTIVELK] = "GETACTIVELK",
+ [GFS3_OP_SETACTIVELK] = "SETACTIVELK",
+ [GFS3_OP_COMPOUND] = "COMPOUND",
};
rpc_clnt_prog_t clnt3_3_fop_prog = {
- .progname = "GlusterFS 3.3",
- .prognum = GLUSTER_FOP_PROGRAM,
- .progver = GLUSTER_FOP_VERSION,
- .numproc = GLUSTER_FOP_PROCCNT,
- .proctable = clnt3_3_fop_actors,
- .procnames = clnt3_3_fop_names,
+ .progname = "GlusterFS 3.3",
+ .prognum = GLUSTER_FOP_PROGRAM,
+ .progver = GLUSTER_FOP_VERSION,
+ .numproc = GLUSTER_FOP_PROCCNT,
+ .proctable = clnt3_3_fop_actors,
+ .procnames = clnt3_3_fop_names,
};
diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c
index 6dd3a916f6a..55a9fd04a6a 100644
--- a/xlators/protocol/client/src/client-rpc-fops_v2.c
+++ b/xlators/protocol/client/src/client-rpc-fops_v2.c
@@ -19,5867 +19,5994 @@
#include "compound-fop-utils.h"
extern int32_t
-client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
+client3_getspec(call_frame_t *frame, xlator_t *this, void *data);
extern int32_t
-client3_3_getxattr (call_frame_t *frame, xlator_t *this, void *data);
+client3_3_getxattr(call_frame_t *frame, xlator_t *this, void *data);
int
-client4_0_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_3iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_3iatt (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- /* no need to print the gfid, because it will be null,
- * since symlink operation failed.
- */
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: (%s to %s)",
- local->loc.path, local->loc2.path);
- }
- }
-
- CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode, &stbuf,
- &preparent, &postparent, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ /* no need to print the gfid, because it will be null,
+ * since symlink operation failed.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: (%s to %s)", local->loc.path,
+ local->loc2.path);
+ }
+ }
+
+ CLIENT_STACK_UNWIND(symlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
-
int
-client4_0_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_3iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
-
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_3iatt (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKNOD,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
-
- CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
+
+ CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_3iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_3iatt (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKDIR,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
-
- CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
-
-
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
+
+ CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- int ret = 0;
- gfx_open_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- fd = local->fd;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- local->flags, rsp.fd, 0);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ int ret = 0;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ fd = local->fd;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
+ local->flags, rsp.fd, 0);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
+ }
- ret = xdr_to_dict (&rsp.xdata, &xdata);
+ ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_OPEN,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s (%s)", local->loc.path,
+ loc_gfid_utoa(&local->loc));
+ }
- CLIENT_STACK_UNWIND (open, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, xdata);
+ CLIENT_STACK_UNWIND(open, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_stat_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_stat_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt iatt = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_iatt (this, &rsp, &iatt, &xdata);
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt iatt = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_iatt(this, &rsp, &iatt, &xdata);
out:
- if (rsp.op_ret == -1) {
- /* stale filehandles are possible during normal operations, no
- * need to spam the logs with these */
- if (rsp.op_errno == ESTALE) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s",
- strerror (gf_error_to_errno
- (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ /* stale filehandles are possible during normal operations, no
+ * need to spam the logs with these */
+ if (rsp.op_errno == ESTALE) {
+ gf_msg_debug(this->name, 0, "remote operation failed: %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
}
+ }
- CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &iatt, xdata);
+ CLIENT_STACK_UNWIND(stat, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &iatt, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_readlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_readlink_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt iatt = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_readlink_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
- gfx_stat_to_iattx (&rsp.buf, &iatt);
-
- ret = xdr_to_dict (&rsp.xdata, &xdata);
+ gfx_readlink_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt iatt = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readlink_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+ gfx_stat_to_iattx(&rsp.buf, &iatt);
+
+ ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror
- (gf_error_to_errno (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), rsp.path,
- &iatt, xdata);
+ CLIENT_STACK_UNWIND(readlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.path, &iatt,
+ xdata);
- /* This is allocated by the libc while decoding RPC msg */
- /* Hence no 'GF_FREE', but just 'free' */
- free (rsp.path);
+ /* This is allocated by the libc while decoding RPC msg */
+ /* Hence no 'GF_FREE', but just 'free' */
+ free(rsp.path);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_unlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_2iatt_rsp rsp = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &preparent, &postparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror
- (gf_error_to_errno (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &preparent,
- &postparent, xdata);
-
+ CLIENT_STACK_UNWIND(unlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &preparent,
+ &postparent, xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ return 0;
}
int
-client4_0_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &preparent, &postparent,
- &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &preparent, &postparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
}
- CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &preparent,
- &postparent, xdata);
+ }
+ CLIENT_STACK_UNWIND(rmdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &preparent,
+ &postparent, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat,
- &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
-
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(truncate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
-
int
-client4_0_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_statfs_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct statvfs statfs = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_statfs_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- gf_statfs_to_statfs (&rsp.statfs, &statfs);
- }
- ret = xdr_to_dict (&rsp.xdata, &xdata);
+ gfx_statfs_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct statvfs statfs = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_statfs_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ gf_statfs_to_statfs(&rsp.statfs, &statfs);
+ }
+ ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &statfs, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(statfs, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &statfs, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_writev_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
- if (ret < 0)
- goto out;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else if (rsp.op_ret >= 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (writev, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else if (rsp.op_ret >= 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(writev, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_flush_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
-
- frame = myframe;
- this = THIS;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+
+ frame = myframe;
+ this = THIS;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0, "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_FLUSH,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (flush, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(flush, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat,
- &xdata);
- if (ret < 0)
- goto out;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsync, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_setxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- int op_errno = EINVAL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ int op_errno = EINVAL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (rsp.op_ret == -1) {
- if (op_errno == ENOTSUP) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (rsp.op_ret == -1) {
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata);
+ CLIENT_STACK_UNWIND(setxattr, frame, rsp.op_ret, op_errno, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_getxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_dict_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- int op_errno = EINVAL;
- int ret = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = gf_error_to_errno (rsp.op_errno);
- ret = client_post_common_dict (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ int op_errno = EINVAL;
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ ret = client_post_common_dict(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- if ((op_errno == ENOTSUP) || (op_errno == ENODATA) ||
- (op_errno == ESTALE) || (op_errno == ENOENT)) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s. Path: %s "
- "(%s). Key: %s", strerror (op_errno),
- local->loc.path,
- loc_gfid_utoa (&local->loc),
- (local->name) ? local->name : "(null)");
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed. Path: %s (%s). Key: %s",
- local->loc.path,
- loc_gfid_utoa (&local->loc),
- (local->name) ? local->name : "(null)");
- }
+ if (rsp.op_ret == -1) {
+ if ((op_errno == ENOTSUP) || (op_errno == ENODATA) ||
+ (op_errno == ESTALE) || (op_errno == ENOENT)) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed: %s. Path: %s "
+ "(%s). Key: %s",
+ strerror(op_errno), local->loc.path,
+ loc_gfid_utoa(&local->loc),
+ (local->name) ? local->name : "(null)");
} else {
- /* This is required as many places, `if (ret)` is checked
- for syncop_getxattr() */
- gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d",
- rsp.op_ret);
- rsp.op_ret = 0;
- }
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed. Path: %s (%s). Key: %s",
+ local->loc.path, loc_gfid_utoa(&local->loc),
+ (local->name) ? local->name : "(null)");
+ }
+ } else {
+ /* This is required as many places, `if (ret)` is checked
+ for syncop_getxattr() */
+ gf_msg_debug(this->name, 0, "resetting op_ret to 0 from %d",
+ rsp.op_ret);
+ rsp.op_ret = 0;
+ }
- CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata);
+ CLIENT_STACK_UNWIND(getxattr, frame, rsp.op_ret, op_errno, dict, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client4_0_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fgetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_dict_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- int ret = 0;
- int op_errno = EINVAL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = gf_error_to_errno (rsp.op_errno);
- ret = client_post_common_dict (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ int ret = 0;
+ int op_errno = EINVAL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ ret = client_post_common_dict(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- if ((op_errno == ENOTSUP) || (op_errno == ERANGE) ||
- (op_errno == ENODATA) || (op_errno == ENOENT)) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s",
- strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ if (rsp.op_ret == -1) {
+ if ((op_errno == ENOTSUP) || (op_errno == ERANGE) ||
+ (op_errno == ENODATA) || (op_errno == ENOENT)) {
+ gf_msg_debug(this->name, 0, "remote operation failed: %s",
+ strerror(op_errno));
} else {
- /* This is required as many places, `if (ret)` is checked
- for syncop_fgetxattr() */
- gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d",
- rsp.op_ret);
- rsp.op_ret = 0;
- }
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
+ }
+ } else {
+ /* This is required as many places, `if (ret)` is checked
+ for syncop_fgetxattr() */
+ gf_msg_debug(this->name, 0, "resetting op_ret to 0 from %d",
+ rsp.op_ret);
+ rsp.op_ret = 0;
+ }
- CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata);
+ CLIENT_STACK_UNWIND(fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client4_0_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_removexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- gf_loglevel_t loglevel = GF_LOG_NONE;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ gf_loglevel_t loglevel = GF_LOG_NONE;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- /* EPERM/EACCESS is returned some times in case of selinux
- attributes, or other system attributes which may not be
- possible to remove from an user process is encountered.
- we can't treat it as an error */
- if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno) ||
- (EPERM == rsp.op_errno) || (EACCES == rsp.op_errno))
- loglevel = GF_LOG_DEBUG;
- else
- loglevel = GF_LOG_WARNING;
-
- gf_msg (this->name, loglevel,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ /* EPERM/EACCESS is returned some times in case of selinux
+ attributes, or other system attributes which may not be
+ possible to remove from an user process is encountered.
+ we can't treat it as an error */
+ if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno) ||
+ (EPERM == rsp.op_errno) || (EACCES == rsp.op_errno))
+ loglevel = GF_LOG_DEBUG;
+ else
+ loglevel = GF_LOG_WARNING;
- CLIENT_STACK_UNWIND (removexattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ gf_msg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- if (xdata)
- dict_unref (xdata);
+ CLIENT_STACK_UNWIND(removexattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
+
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fremovexattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsyncdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_access_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (access, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(access, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat,
- &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(ftruncate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_iatt (this, &rsp, &stat, &xdata);
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_iatt(this, &rsp, &stat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &stat, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fstat, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &stat, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_INODELK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
- CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(inodelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_FINODELK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- } else if (rsp.op_ret == 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (finodelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ } else if (rsp.op_ret == 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(finodelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(entrylk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (fentrylk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(fentrylk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- gfx_common_dict_rsp rsp = {0,};
- int ret = 0;
- int op_errno = EINVAL;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- op_errno = rsp.op_errno;
- ret = client_post_common_dict (this, &rsp, &dict, &xdata);
- if (ret) {
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int op_errno = EINVAL;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ op_errno = rsp.op_errno;
+ ret = client_post_common_dict(this, &rsp, &dict, &xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_XATTROP, op_errno),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed. "
- "Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- } else {
- /* This is required as many places, `if (ret)` is checked
- for syncop_xattrop() */
- gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d",
- rsp.op_ret);
- rsp.op_ret = 0;
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. "
+ "Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ } else {
+ /* This is required as many places, `if (ret)` is checked
+ for syncop_xattrop() */
+ gf_msg_debug(this->name, 0, "resetting op_ret to 0 from %d",
+ rsp.op_ret);
+ rsp.op_ret = 0;
+ }
- CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret,
- gf_error_to_errno (op_errno), dict, xdata);
+ CLIENT_STACK_UNWIND(xattrop, frame, rsp.op_ret, gf_error_to_errno(op_errno),
+ dict, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return 0;
+ return 0;
}
int
-client4_0_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- dict_t *dict = NULL;
- dict_t *xdata = NULL;
- gfx_common_dict_rsp rsp = {0,};
- int ret = 0;
- int op_errno = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
- op_errno = rsp.op_errno;
- ret = client_post_common_dict (this, &rsp, &dict, &xdata);
- if (ret) {
- rsp.op_ret = -1;
- op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ dict_t *dict = NULL;
+ dict_t *xdata = NULL;
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int op_errno = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ goto out;
+ }
+ op_errno = rsp.op_errno;
+ ret = client_post_common_dict(this, &rsp, &dict, &xdata);
+ if (ret) {
+ rsp.op_ret = -1;
+ op_errno = -ret;
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else {
- /* This is required as many places, `if (ret)` is checked
- for syncop_fxattrop() */
- gf_msg_debug (this->name, 0, "resetting op_ret to 0 from %d",
- rsp.op_ret);
- rsp.op_ret = 0;
-
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else {
+ /* This is required as many places, `if (ret)` is checked
+ for syncop_fxattrop() */
+ gf_msg_debug(this->name, 0, "resetting op_ret to 0 from %d",
+ rsp.op_ret);
+ rsp.op_ret = 0;
- CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret,
- gf_error_to_errno (op_errno), dict, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
- if (dict)
- dict_unref (dict);
+ CLIENT_STACK_UNWIND(fxattrop, frame, rsp.op_ret,
+ gf_error_to_errno(op_errno), dict, xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ if (dict)
+ dict_unref(dict);
+
+ return 0;
}
int
-client4_0_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_fsetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- int op_errno = EINVAL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ int op_errno = EINVAL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (rsp.op_ret == -1) {
- if (op_errno == ENOTSUP) {
- gf_msg_debug (this->name, 0, "remote operation failed:"
- " %s", strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed");
- }
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (rsp.op_ret == -1) {
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(this->name, 0,
+ "remote operation failed:"
+ " %s",
+ strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed");
}
+ }
- CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata);
+ CLIENT_STACK_UNWIND(fsetxattr, frame, rsp.op_ret, op_errno, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count,
+client4_0_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_2iatt_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
- if (ret < 0)
- goto out;
+ call_frame_t *frame = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
+ if (ret < 0)
+ goto out;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fallocate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fallocate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
client4_0_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (discard, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(discard, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
client4_0_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_2iatt_rsp rsp = {0,};
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (zerofill, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(zerofill, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (ipc, frame,
- rsp.op_ret, gf_error_to_errno (rsp.op_errno),
- xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(ipc, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
+ xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client4_0_seek_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gfx_seek_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfx_seek_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ struct gfx_seek_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_seek_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (seek, frame,
- rsp.op_ret, gf_error_to_errno (rsp.op_errno),
- rsp.offset, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(seek, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.offset, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(setattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
+client4_0_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt prestat = {0,};
- struct iatt poststat = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_2iatt (this, &rsp, &prestat, &poststat, &xdata);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &prestat,
- &poststat, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(fsetattr, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
+ xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- inode_t *inode = NULL;
- struct iatt stbuf = {0, };
- struct iatt preparent = {0, };
- struct iatt postparent = {0, };
- int32_t ret = -1;
- clnt_local_t *local = NULL;
- gfx_create_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
- fd = local->fd;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_create_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_post_create_v2 (this, &rsp, &stbuf,
- &preparent, &postparent,
- local, &xdata);
- if (ret < 0)
- goto out;
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- local->flags, rsp.fd, 0);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ inode_t *inode = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int32_t ret = -1;
+ clnt_local_t *local = NULL;
+ gfx_create_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+ fd = local->fd;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_create_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_post_create_v2(this, &rsp, &stbuf, &preparent, &postparent,
+ local, &xdata);
+ if (ret < 0)
+ goto out;
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
+ local->flags, rsp.fd, 0);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
-
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed. Path: %s",
+ local->loc.path);
+ }
- CLIENT_STACK_UNWIND (create, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(create, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, inode, &stbuf,
+ &preparent, &postparent, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_lease_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gf_lease lease = {0,};
- gfx_lease_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- gf_msg (this->name, GF_LOG_ERROR, ENOTCONN,
- PC_MSG_REMOTE_OP_FAILED, "Lease fop failed");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_lease_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_lease_v2 (this, &rsp, &lease, &xdata);
+ call_frame_t *frame = NULL;
+ struct gf_lease lease = {
+ 0,
+ };
+ gfx_lease_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED,
+ "Lease fop failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lease_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_lease_v2(this, &rsp, &lease, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (lease, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &lease, xdata);
+ CLIENT_STACK_UNWIND(lease, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &lease, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct gf_flock lock = {0,};
- gfx_lk_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_lk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret >= 0) {
- ret = client_post_lk_v2 (this, &rsp, &lock, &xdata);
- if (ret < 0)
- goto out;
- }
+ call_frame_t *frame = NULL;
+ struct gf_flock lock = {
+ 0,
+ };
+ gfx_lk_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lk_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret >= 0) {
+ ret = client_post_lk_v2(this, &rsp, &lock, &xdata);
+ if (ret < 0)
+ goto out;
+ }
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (lk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &lock, xdata);
+ CLIENT_STACK_UNWIND(lk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
+ &lock, xdata);
- free (rsp.flock.lk_owner.lk_owner_val);
+ free(rsp.flock.lk_owner.lk_owner_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_readdir_rsp rsp = {0,};
- int32_t ret = 0;
- clnt_local_t *local = NULL;
- gf_dirent_t entries;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- INIT_LIST_HEAD (&entries.list);
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_readdir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readdir_v2 (this, &rsp, &entries, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_readdir_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ clnt_local_t *local = NULL;
+ gf_dirent_t entries;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readdir_v2(this, &rsp, &entries, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: remote_fd = %d",
- local->cmd);
- }
- CLIENT_STACK_UNWIND (readdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &entries, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed: remote_fd = %d", local->cmd);
+ }
+ CLIENT_STACK_UNWIND(readdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &entries, xdata);
- if (rsp.op_ret != -1) {
- gf_dirent_free (&entries);
- }
+ if (rsp.op_ret != -1) {
+ gf_dirent_free(&entries);
+ }
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- clnt_readdir_rsp_cleanup_v2 (&rsp);
+ clnt_readdir_rsp_cleanup_v2(&rsp);
- return 0;
+ return 0;
}
int
-client4_0_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_readdirp_rsp rsp = {0,};
- int32_t ret = 0;
- clnt_local_t *local = NULL;
- gf_dirent_t entries;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- INIT_LIST_HEAD (&entries.list);
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_readdirp_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readdirp_v2 (this, &rsp, local->fd, &entries, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_readdirp_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ clnt_local_t *local = NULL;
+ gf_dirent_t entries;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdirp_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readdirp_v2(this, &rsp, local->fd, &entries, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (readdirp, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &entries, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(readdirp, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &entries, xdata);
- if (rsp.op_ret != -1) {
- gf_dirent_free (&entries);
- }
+ if (rsp.op_ret != -1) {
+ gf_dirent_free(&entries);
+ }
+ if (xdata)
+ dict_unref(xdata);
- if (xdata)
- dict_unref (xdata);
+ clnt_readdirp_rsp_cleanup_v2(&rsp);
- clnt_readdirp_rsp_cleanup_v2 (&rsp);
-
- return 0;
+ return 0;
}
int
-client4_0_rename_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_rename_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preoldparent = {0,};
- struct iatt postoldparent = {0,};
- struct iatt prenewparent = {0,};
- struct iatt postnewparent = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_rename_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- client_post_rename_v2 (this, &rsp, &stbuf, &preoldparent,
- &postoldparent, &prenewparent,
- &postnewparent, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_rename_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preoldparent = {
+ 0,
+ };
+ struct iatt postoldparent = {
+ 0,
+ };
+ struct iatt prenewparent = {
+ 0,
+ };
+ struct iatt postnewparent = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rename_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ client_post_rename_v2(this, &rsp, &stbuf, &preoldparent, &postoldparent,
+ &prenewparent, &postnewparent, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- &stbuf, &preoldparent, &postoldparent,
- &prenewparent, &postnewparent, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(rename, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &stbuf, &preoldparent,
+ &postoldparent, &prenewparent, &postnewparent, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_link_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_3iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_common_3iatt (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: (%s -> %s)",
- local->loc.path, local->loc2.path);
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed: (%s -> %s)", local->loc.path,
+ local->loc2.path);
}
+ }
- CLIENT_STACK_UNWIND (link, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(link, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- int ret = 0;
- gfx_open_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- fd = local->fd;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- /* open and opendir are two operations dealing with same thing,
- but separated by fop number only */
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- 0, rsp.fd, 1);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ int ret = 0;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ fd = local->fd;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ /* open and opendir are two operations dealing with same thing,
+ but separated by fop number only */
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc, 0,
+ rsp.fd, 1);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
+ }
- ret = xdr_to_dict (&rsp.xdata, &xdata);
+ ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed."
- " Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
- CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed."
+ " Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ }
+ CLIENT_STACK_UNWIND(opendir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
-
int
-client4_0_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_2iatt_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- int ret = 0;
- struct iatt stbuf = {0,};
- struct iatt postparent = {0,};
- int op_errno = EINVAL;
- dict_t *xdata = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- /* Preserve the op_errno received from the server */
- op_errno = gf_error_to_errno (rsp.op_errno);
-
- ret = client_post_common_2iatt (this, &rsp, &stbuf, &postparent, &xdata);
- if (ret < 0) {
- /* Don't change the op_errno if the fop failed on server */
- if (rsp.op_ret == 0)
- op_errno = rsp.op_errno;
- rsp.op_ret = -1;
- goto out;
- }
-
- if (rsp.op_ret < 0)
- goto out;
-
- if ((!gf_uuid_is_null (inode->gfid))
- && (gf_uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) {
- gf_msg_debug (frame->this->name, 0,
- "gfid changed for %s", local->loc.path);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ int ret = 0;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int op_errno = EINVAL;
+ dict_t *xdata = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ /* Preserve the op_errno received from the server */
+ op_errno = gf_error_to_errno(rsp.op_errno);
+
+ ret = client_post_common_2iatt(this, &rsp, &stbuf, &postparent, &xdata);
+ if (ret < 0) {
+ /* Don't change the op_errno if the fop failed on server */
+ if (rsp.op_ret == 0)
+ op_errno = rsp.op_errno;
+ rsp.op_ret = -1;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0)
+ goto out;
+
+ if ((!gf_uuid_is_null(inode->gfid)) &&
+ (gf_uuid_compare(stbuf.ia_gfid, inode->gfid) != 0)) {
+ gf_msg_debug(frame->this->name, 0, "gfid changed for %s",
+ local->loc.path);
+
+ rsp.op_ret = -1;
+ op_errno = ESTALE;
+ if (xdata)
+ ret = dict_set_int32(xdata, "gfid-changed", 1);
- rsp.op_ret = -1;
- op_errno = ESTALE;
- if (xdata)
- ret = dict_set_int32 (xdata, "gfid-changed", 1);
+ goto out;
+ }
- goto out;
- }
-
- rsp.op_ret = 0;
+ rsp.op_ret = 0;
out:
- /* Restore the correct op_errno to rsp.op_errno */
- rsp.op_errno = op_errno;
- if (rsp.op_ret == -1) {
- /* any error other than ENOENT */
- if (!(local->loc.name && rsp.op_errno == ENOENT) &&
- !(rsp.op_errno == ESTALE))
- gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED, "remote operation "
- "failed. Path: %s (%s)",
- local->loc.path,
- loc_gfid_utoa (&local->loc));
- else
- gf_msg_trace (this->name, 0, "not found on remote "
- "node");
-
- }
-
- CLIENT_STACK_UNWIND (lookup, frame, rsp.op_ret, rsp.op_errno, inode,
- &stbuf, xdata, &postparent);
-
- if (xdata)
- dict_unref (xdata);
+ /* Restore the correct op_errno to rsp.op_errno */
+ rsp.op_errno = op_errno;
+ if (rsp.op_ret == -1) {
+ /* any error other than ENOENT */
+ if (!(local->loc.name && rsp.op_errno == ENOENT) &&
+ !(rsp.op_errno == ESTALE))
+ gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation "
+ "failed. Path: %s (%s)",
+ local->loc.path, loc_gfid_utoa(&local->loc));
+ else
+ gf_msg_trace(this->name, 0,
+ "not found on remote "
+ "node");
+ }
+ CLIENT_STACK_UNWIND(lookup, frame, rsp.op_ret, rsp.op_errno, inode, &stbuf,
+ xdata, &postparent);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client4_0_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- struct iobref *iobref = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- struct iatt stat = {0,};
- gfx_read_rsp rsp = {0,};
- int ret = 0, rspcount = 0;
- clnt_local_t *local = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- memset (vector, 0, sizeof (vector));
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_read_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_readv_v2 (this, &rsp, &iobref, req->rsp_iobref,
- &stat, vector, &req->rsp[1],
- &rspcount, &xdata);
+ call_frame_t *frame = NULL;
+ struct iobref *iobref = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iatt stat = {
+ 0,
+ };
+ gfx_read_rsp rsp = {
+ 0,
+ };
+ int ret = 0, rspcount = 0;
+ clnt_local_t *local = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ memset(vector, 0, sizeof(vector));
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_read_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_readv_v2(this, &rsp, &iobref, req->rsp_iobref, &stat,
+ vector, &req->rsp[1], &rspcount, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- } else if (rsp.op_ret >= 0) {
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- }
- CLIENT_STACK_UNWIND (readv, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), vector, rspcount,
- &stat, iobref, xdata);
-
-
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ } else if (rsp.op_ret >= 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ }
+ CLIENT_STACK_UNWIND(readv, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), vector, rspcount,
+ &stat, iobref, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-client4_0_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
+ call_frame_t *frame = NULL;
- frame = myframe;
- STACK_DESTROY (frame->root);
- return 0;
+ frame = myframe;
+ STACK_DESTROY(frame->root);
+ return 0;
}
int
-client4_0_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
+ call_frame_t *frame = NULL;
- frame = myframe;
- STACK_DESTROY (frame->root);
- return 0;
+ frame = myframe;
+ STACK_DESTROY(frame->root);
+ return 0;
}
int
-client4_0_getactivelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_getactivelk_rsp rsp = {0,};
- int32_t ret = 0;
- lock_migration_info_t locklist;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_getactivelk_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- INIT_LIST_HEAD (&locklist.list);
-
- if (rsp.op_ret > 0) {
- clnt_unserialize_rsp_locklist_v2 (this, &rsp, &locklist);
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_getactivelk_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ lock_migration_info_t locklist;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_getactivelk_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ INIT_LIST_HEAD(&locklist.list);
+
+ if (rsp.op_ret > 0) {
+ clnt_unserialize_rsp_locklist_v2(this, &rsp, &locklist);
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (getactivelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &locklist,
- xdata);
- if (xdata)
- dict_unref (xdata);
+ CLIENT_STACK_UNWIND(getactivelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &locklist, xdata);
+ if (xdata)
+ dict_unref(xdata);
- clnt_getactivelk_rsp_cleanup_v2 (&rsp);
+ clnt_getactivelk_rsp_cleanup_v2(&rsp);
- return 0;
+ return 0;
}
int
-client4_0_setactivelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_common_rsp rsp = {0,};
- int32_t ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int32_t ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (setactivelk, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), xdata);
+ CLIENT_STACK_UNWIND(setactivelk, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_releasedir (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_releasedir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- gf_boolean_t destroy = _gf_false;
-
- if (!this || !data)
- goto out;
-
- args = data;
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_del_ctx (args->fd, this);
- if (fdctx != NULL) {
- remote_fd = fdctx->remote_fd;
-
- /* fdctx->remote_fd == -1 indicates a reopen attempt
- in progress. Just mark ->released = 1 and let
- reopen_cbk handle releasing
- */
-
- if (remote_fd == -1) {
- fdctx->released = 1;
- } else {
- list_del_init (&fdctx->sfd_pos);
- destroy = _gf_true;
- }
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
+ gf_boolean_t destroy = _gf_false;
+
+ if (!this || !data)
+ goto out;
+
+ args = data;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_del_ctx(args->fd, this);
+ if (fdctx != NULL) {
+ remote_fd = fdctx->remote_fd;
+
+ /* fdctx->remote_fd == -1 indicates a reopen attempt
+ in progress. Just mark ->released = 1 and let
+ reopen_cbk handle releasing
+ */
+
+ if (remote_fd == -1) {
+ fdctx->released = 1;
+ } else {
+ list_del_init(&fdctx->sfd_pos);
+ destroy = _gf_true;
+ }
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
out:
- return 0;
+ return 0;
}
int32_t
-client4_0_release (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_release(call_frame_t *frame, xlator_t *this, void *data)
{
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_args_t *args = NULL;
- gf_boolean_t destroy = _gf_false;
-
- if (!this || !data)
- goto out;
-
- args = data;
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_del_ctx (args->fd, this);
- if (fdctx != NULL) {
- remote_fd = fdctx->remote_fd;
-
- /* fdctx->remote_fd == -1 indicates a reopen attempt
- in progress. Just mark ->released = 1 and let
- reopen_cbk handle releasing
- */
- if (remote_fd == -1) {
- fdctx->released = 1;
- } else {
- list_del_init (&fdctx->sfd_pos);
- destroy = _gf_true;
- }
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_args_t *args = NULL;
+ gf_boolean_t destroy = _gf_false;
+
+ if (!this || !data)
+ goto out;
+
+ args = data;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_del_ctx(args->fd, this);
+ if (fdctx != NULL) {
+ remote_fd = fdctx->remote_fd;
+
+ /* fdctx->remote_fd == -1 indicates a reopen attempt
+ in progress. Just mark ->released = 1 and let
+ reopen_cbk handle releasing
+ */
+ if (remote_fd == -1) {
+ fdctx->released = 1;
+ } else {
+ list_del_init(&fdctx->sfd_pos);
+ destroy = _gf_true;
+ }
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
out:
- return 0;
+ return 0;
}
-
int32_t
-client4_0_lookup (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- clnt_args_t *args = NULL;
- gfx_lookup_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- data_t *content = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- int count = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- memset (vector, 0, sizeof (vector));
-
- conf = this->private;
- args = data;
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- if (args->xdata) {
- content = dict_get (args->xdata, GF_CONTENT_KEY);
- if (content != NULL) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This change very much depends on quick-read
- changes */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- iobref_add (rsp_iobref, rsp_iobuf);
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
- }
- }
-
- ret = client_pre_lookup_v2 (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_LOOKUP, client4_0_lookup_cbk,
- NULL, rsphdr, count,
- NULL, 0, local->iobref,
- (xdrproc_t)xdr_gfx_lookup_req);
-
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ clnt_args_t *args = NULL;
+ gfx_lookup_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ data_t *content = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ int count = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ memset(vector, 0, sizeof(vector));
+
+ conf = this->private;
+ args = data;
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ if (args->xdata) {
+ content = dict_get(args->xdata, GF_CONTENT_KEY);
+ if (content != NULL) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ /* This change very much depends on quick-read
+ changes */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
+
+ iobref_add(rsp_iobref, rsp_iobuf);
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
+ }
+
+ ret = client_pre_lookup_v2(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LOOKUP,
+ client4_0_lookup_cbk, NULL, rsphdr, count, NULL,
+ 0, local->iobref,
+ (xdrproc_t)xdr_gfx_lookup_req);
+
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL,
- NULL);
+ CLIENT_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- return 0;
+ return 0;
}
int32_t
-client4_0_stat (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_stat(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_stat_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_stat_v2 (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_STAT, client4_0_stat_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_stat_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_stat_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_stat_v2(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STAT,
+ client4_0_stat_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_stat_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(stat, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_truncate (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_truncate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_truncate_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_truncate_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_truncate_v2 (this, &req, args->loc, args->offset,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_TRUNCATE,
- client4_0_truncate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_truncate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_truncate_v2(this, &req, args->loc, args->offset,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_TRUNCATE,
+ client4_0_truncate_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_truncate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(truncate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_ftruncate (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_ftruncate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_ftruncate_req req = {{0,},};
- int op_errno = EINVAL;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_ftruncate_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = EINVAL;
+ int ret = 0;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
+ args = data;
- conf = this->private;
+ conf = this->private;
- ret = client_pre_ftruncate_v2 (this, &req, args->fd, args->offset,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FTRUNCATE,
- client4_0_ftruncate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_ftruncate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_ftruncate_v2(this, &req, args->fd, args->offset,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FTRUNCATE, client4_0_ftruncate_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_ftruncate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(ftruncate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_access (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_access(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_access_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
-
- ret = client_pre_access_v2 (this, &req, args->loc, args->mask,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ACCESS,
- client4_0_access_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_access_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_access_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ ret = client_pre_access_v2(this, &req, args->loc, args->mask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ACCESS,
+ client4_0_access_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_access_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (access, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(access, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_readlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_readlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_readlink_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_readlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ clnt_local_t *local = NULL;
- args = data;
+ if (!frame || !this || !data)
+ goto unwind;
- conf = this->private;
+ args = data;
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
+ conf = this->private;
- frame->local = local;
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
- ret = client_pre_readlink_v2 (this, &req, args->loc, args->size,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ frame->local = local;
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READLINK,
- client4_0_readlink_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_readlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_readlink_v2(this, &req, args->loc, args->size,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READLINK,
+ client4_0_readlink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_readlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(readlink, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_unlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_unlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_unlink_req req = {{0,},};
- int ret = 0;
- int op_errno = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_unlink_v2 (this, &req, args->loc, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_UNLINK,
- client4_0_unlink_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_unlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_unlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_unlink_v2(this, &req, args->loc, args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_UNLINK,
+ client4_0_unlink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_unlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(unlink, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_rmdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_rmdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_rmdir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_rmdir_v2 (this, &req, args->loc, args->flags,
- args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RMDIR, client4_0_rmdir_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_rmdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_rmdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_rmdir_v2(this, &req, args->loc, args->flags, args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RMDIR,
+ client4_0_rmdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_rmdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(rmdir, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_symlink (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_symlink(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_symlink_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- if (!(args->loc && args->loc->parent))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- local->loc2.path = gf_strdup (args->linkname);
-
- ret = client_pre_symlink_v2 (this, &req, args->loc,
- args->linkname, args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SYMLINK, client4_0_symlink_cbk,
- NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfx_symlink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_symlink_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ local->loc2.path = gf_strdup(args->linkname);
+
+ ret = client_pre_symlink_v2(this, &req, args->loc, args->linkname,
+ args->umask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SYMLINK,
+ client4_0_symlink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_symlink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(symlink, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_rename (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_rename(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_rename_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_rename_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_rename_v2 (this, &req, args->oldloc, args->newloc,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RENAME, client4_0_rename_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_rename_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_rename_v2(this, &req, args->oldloc, args->newloc,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RENAME,
+ client4_0_rename_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_rename_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ CLIENT_STACK_UNWIND(rename, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_link (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_link(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_link_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- ret = client_pre_link_v2 (this, &req, args->oldloc, args->newloc,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- loc_copy (&local->loc, args->oldloc);
- loc_path (&local->loc, NULL);
- loc_copy (&local->loc2, args->newloc);
- loc_path (&local->loc2, NULL);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_LINK, client4_0_link_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_link_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_link_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ ret = client_pre_link_v2(this, &req, args->oldloc, args->newloc,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ loc_copy(&local->loc, args->oldloc);
+ loc_path(&local->loc, NULL);
+ loc_copy(&local->loc2, args->newloc);
+ loc_path(&local->loc2, NULL);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LINK,
+ client4_0_link_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_link_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(link, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_mknod (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_mknod(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_mknod_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_mknod_v2 (this, &req, args->loc,
- args->mode, args->rdev, args->umask,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_MKNOD, client4_0_mknod_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_mknod_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_mknod_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_mknod_v2(this, &req, args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKNOD,
+ client4_0_mknod_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_mknod_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(mknod, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_mkdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_mkdir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- if (!args->xdata || !dict_get (args->xdata, "gfid-req")) {
- op_errno = EPERM;
- gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_GFID_NULL, "mkdir: %s is received "
- "without gfid-req %p", args->loc->path,
- args->xdata);
- goto unwind;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- if (!(args->loc && args->loc->parent))
- goto unwind;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_mkdir_v2 (this, &req, args->loc, args->mode,
- args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_MKDIR, client4_0_mkdir_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_mkdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_mkdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ if (!args->xdata || !dict_get(args->xdata, "gfid-req")) {
+ op_errno = EPERM;
+ gf_msg_callingfn(this->name, GF_LOG_WARNING, op_errno, PC_MSG_GFID_NULL,
+ "mkdir: %s is received "
+ "without gfid-req %p",
+ args->loc->path, args->xdata);
+ goto unwind;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_mkdir_v2(this, &req, args->loc, args->mode, args->umask,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKDIR,
+ client4_0_mkdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_mkdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL);
+ CLIENT_STACK_UNWIND(mkdir, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_create (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_create(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_create_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- local->flags = args->flags;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_create_v2 (this, &req, args->loc,
- args->fd, args->mode,
- args->flags, args->umask, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_CREATE, client4_0_create_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_create_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_create_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ local->flags = args->flags;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_create_v2(this, &req, args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_CREATE,
+ client4_0_create_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_create_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ CLIENT_STACK_UNWIND(create, frame, -1, op_errno, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_open (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_open(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_open_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->flags = args->flags;
-
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_open_v2 (this, &req, args->loc, args->fd, args->flags,
- args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client4_0_open_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_open_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->flags = args->flags;
+
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_open_v2(this, &req, args->loc, args->fd, args->flags,
+ args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client4_0_open_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(open, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_readv (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_readv(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- gfx_read_req req = {{0,},};
- int ret = 0;
- struct iovec rsp_vec = {0, };
- struct iobuf *rsp_iobuf = NULL;
- struct iobref *rsp_iobref = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_readv_v2 (this, &req, args->fd, args->size,
- args->offset, args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- local = frame->local;
-
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- iobref_add (rsp_iobref, rsp_iobuf);
- rsp_vec.iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vec.iov_len = iobuf_pagesize (rsp_iobuf);
- local->iobref = rsp_iobref;
- iobuf_unref (rsp_iobuf);
- rsp_iobref = NULL;
- rsp_iobuf = NULL;
-
- if (args->size > rsp_vec.iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size (%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vec.iov_len);
- op_errno = EINVAL;
- goto unwind;
- }
-
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READ, client4_0_readv_cbk, NULL,
- NULL, 0, &rsp_vec, 1,
- local->iobref,
- (xdrproc_t)xdr_gfx_read_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ gfx_read_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ struct iovec rsp_vec = {
+ 0,
+ };
+ struct iobuf *rsp_iobuf = NULL;
+ struct iobref *rsp_iobref = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_readv_v2(this, &req, args->fd, args->size, args->offset,
+ args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ local = frame->local;
+
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ iobref_add(rsp_iobref, rsp_iobuf);
+ rsp_vec.iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vec.iov_len = iobuf_pagesize(rsp_iobuf);
+ local->iobref = rsp_iobref;
+ iobuf_unref(rsp_iobuf);
+ rsp_iobref = NULL;
+ rsp_iobuf = NULL;
+
+ if (args->size > rsp_vec.iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size (%lu)",
+ (unsigned long)args->size, (unsigned long)rsp_vec.iov_len);
+ op_errno = EINVAL;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READ,
+ client4_0_readv_cbk, NULL, NULL, 0, &rsp_vec, 1,
+ local->iobref, (xdrproc_t)xdr_gfx_read_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- if (rsp_iobuf)
- iobuf_unref (rsp_iobuf);
+ if (rsp_iobuf)
+ iobuf_unref(rsp_iobuf);
- CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_writev (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_writev(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_write_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_writev_v2 (this, &req, args->fd, args->size,
- args->offset, args->flags, &args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_WRITE, client4_0_writev_cbk,
- args->iobref, args->vector, args->count,
- NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_write_req);
- if (ret) {
- /*
- * If the lower layers fail to submit a request, they'll also
- * do the unwind for us (see rpc_clnt_submit), so don't unwind
- * here in such cases.
- */
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_write_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_writev_v2(this, &req, args->fd, args->size, args->offset,
+ args->flags, &args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_WRITE,
+ client4_0_writev_cbk, args->iobref,
+ args->vector, args->count, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_write_req);
+ if (ret) {
+ /*
+ * If the lower layers fail to submit a request, they'll also
+ * do the unwind for us (see rpc_clnt_submit), so don't unwind
+ * here in such cases.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(writev, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_flush (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_flush(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_flush_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- ret = client_pre_flush_v2 (this, &req, args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FLUSH, client4_0_flush_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_flush_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfx_flush_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ ret = client_pre_flush_v2(this, &req, args->fd, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FLUSH,
+ client4_0_flush_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_flush_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (flush, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(flush, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fsync (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fsync(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_fsync_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = 0;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsync_v2 (this, &req, args->fd, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSYNC, client4_0_fsync_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fsync_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
-
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfx_fsync_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = 0;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fsync_v2(this, &req, args->fd, args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNC,
+ client4_0_fsync_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fsync_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fsync, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fstat (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fstat(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_fstat_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ gfx_fstat_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_fstat_v2 (this, &req, args->fd, args->xdata);
+ ret = client_pre_fstat_v2(this, &req, args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSTAT, client4_0_fstat_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fstat_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSTAT,
+ client4_0_fstat_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fstat_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fstat, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_opendir (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_opendir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_opendir_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_opendir_v2 (this, &req, args->loc, args->fd,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR, client4_0_opendir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_opendir_v2(this, &req, args->loc, args->fd, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client4_0_opendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(opendir, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fsyncdir (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_fsyncdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fsyncdir_req req = {{0,},};
- int ret = 0;
- int32_t op_errno = ESTALE;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fsyncdir_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int32_t op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_fsyncdir_v2 (this, &req, args->fd, args->flags,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSYNCDIR, client4_0_fsyncdir_cbk,
- NULL, NULL, 0,
- NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fsyncdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_fsyncdir_v2(this, &req, args->fd, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR,
+ client4_0_fsyncdir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fsyncdir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fsyncdir, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_statfs (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_statfs(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_statfs_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_statfs_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
+ args = data;
- conf = this->private;
+ conf = this->private;
- ret = client_pre_statfs_v2 (this, &req, args->loc, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_STATFS, client4_0_statfs_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_statfs_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_pre_statfs_v2(this, &req, args->loc, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STATFS,
+ client4_0_statfs_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_statfs_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(statfs, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_setxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_setxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_setxattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_setxattr_v2 (this, &req, args->loc, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETXATTR, client4_0_setxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_setxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
- GF_FREE (req.dict.pairs.pairs_val);
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_setxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_setxattr_v2(this, &req, args->loc, args->xattr,
+ args->flags, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETXATTR,
+ client4_0_setxattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_setxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ GF_FREE(req.dict.pairs.pairs_val);
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL);
- GF_FREE (req.dict.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(setxattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fsetxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fsetxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fsetxattr_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fsetxattr_v2 (this, &req, args->fd, args->flags,
- args->xattr, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSETXATTR, client4_0_fsetxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fsetxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fsetxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fsetxattr_v2(this, &req, args->fd, args->flags,
+ args->xattr, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FSETXATTR, client4_0_fsetxattr_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_fsetxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL);
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fsetxattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_fgetxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fgetxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fgetxattr_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- ret = client_pre_fgetxattr_v2 (this, &req, args->fd, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FGETXATTR,
- client4_0_fgetxattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fgetxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fgetxattr_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+ clnt_local_t *local = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ ret = client_pre_fgetxattr_v2(this, &req, args->fd, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FGETXATTR, client4_0_fgetxattr_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_fgetxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(fgetxattr, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_getxattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_getxattr_req req = {{0,},};
- dict_t *dict = NULL;
- int ret = 0;
- int32_t op_ret = -1;
- int op_errno = ESTALE;
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data) {
- op_errno = 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_getxattr_req req = {
+ {
+ 0,
+ },
+ };
+ dict_t *dict = NULL;
+ int ret = 0;
+ int32_t op_ret = -1;
+ int op_errno = ESTALE;
+ clnt_local_t *local = NULL;
+
+ if (!frame || !this || !data) {
+ op_errno = 0;
+ goto unwind;
+ }
+ args = data;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ if (args->name)
+ local->name = gf_strdup(args->name);
+
+ conf = this->private;
+
+ if (args && args->name) {
+ if (is_client_dump_locks_cmd((char *)args->name)) {
+ dict = dict_new();
+
+ if (!dict) {
+ op_errno = ENOMEM;
goto unwind;
- }
- args = data;
+ }
- local = mem_get0 (this->local_pool);
- if (!local) {
+ ret = client_dump_locks((char *)args->name, args->loc->inode, dict);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Client dump "
+ "locks failed");
op_errno = ENOMEM;
goto unwind;
- }
+ }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- if (args->name)
- local->name = gf_strdup (args->name);
-
- conf = this->private;
-
- if (args && args->name) {
- if (is_client_dump_locks_cmd ((char *)args->name)) {
- dict = dict_new ();
-
- if (!dict) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- ret = client_dump_locks ((char *)args->name,
- args->loc->inode,
- dict);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Client dump "
- "locks failed");
- op_errno = ENOMEM;
- goto unwind;
- }
-
- GF_ASSERT (dict);
- op_ret = 0;
- op_errno = 0;
- goto unwind;
- }
- }
-
- ret = client_pre_getxattr_v2 (this, &req, args->loc, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_GETXATTR,
- client4_0_getxattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_getxattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ GF_ASSERT(dict);
+ op_ret = 0;
+ op_errno = 0;
+ goto unwind;
}
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_getxattr_v2(this, &req, args->loc, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETXATTR,
+ client4_0_getxattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_getxattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL);
+ CLIENT_STACK_UNWIND(getxattr, frame, op_ret, op_errno, dict, NULL);
- if (dict) {
- dict_unref(dict);
- }
+ if (dict) {
+ dict_unref(dict);
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_xattrop (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_xattrop(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_xattrop_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_xattrop_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+ clnt_local_t *local = NULL;
- args = data;
+ if (!frame || !this || !data)
+ goto unwind;
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
+ args = data;
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
- conf = this->private;
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
- ret = client_pre_xattrop_v2 (this, &req, args->loc, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_XATTROP,
- client4_0_xattrop_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_xattrop_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+ conf = this->private;
- return 0;
+ ret = client_pre_xattrop_v2(this, &req, args->loc, args->xattr, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_XATTROP,
+ client4_0_xattrop_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_xattrop_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(xattrop, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fxattrop (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fxattrop(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fxattrop_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fxattrop_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- args = data;
- conf = this->private;
+ if (!frame || !this || !data)
+ goto unwind;
- ret = client_pre_fxattrop_v2 (this, &req, args->fd, args->xattr,
- args->flags, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FXATTROP,
- client4_0_fxattrop_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fxattrop_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ args = data;
+ conf = this->private;
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_fxattrop_v2(this, &req, args->fd, args->xattr, args->flags,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FXATTROP,
+ client4_0_fxattrop_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fxattrop_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(fxattrop, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.dict.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.dict.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_removexattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_removexattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_removexattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_removexattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- ret = client_pre_removexattr_v2 (this, &req, args->loc, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_REMOVEXATTR,
- client4_0_removexattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_removexattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (!frame || !this || !data)
+ goto unwind;
- GF_FREE (req.xdata.pairs.pairs_val);
+ args = data;
+ conf = this->private;
- return 0;
+ ret = client_pre_removexattr_v2(this, &req, args->loc, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_REMOVEXATTR, client4_0_removexattr_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_removexattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(removexattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_fremovexattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fremovexattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_fremovexattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_fremovexattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- conf = this->private;
+ if (!frame || !this || !data)
+ goto unwind;
- ret = client_pre_fremovexattr_v2 (this, &req, args->fd, args->name,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FREMOVEXATTR,
- client4_0_fremovexattr_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fremovexattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ args = data;
- GF_FREE (req.xdata.pairs.pairs_val);
+ conf = this->private;
- return 0;
+ ret = client_pre_fremovexattr_v2(this, &req, args->fd, args->name,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FREMOVEXATTR,
+ client4_0_fremovexattr_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfx_fremovexattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fremovexattr, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_lease (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_lease(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_lease_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- GF_VALIDATE_OR_GOTO ("client", this, unwind);
- GF_VALIDATE_OR_GOTO (this->name, frame, unwind);
- GF_VALIDATE_OR_GOTO (this->name, data, unwind);
-
- args = data;
- conf = this->private;
-
- ret = client_pre_lease_v2 (this, &req, args->loc, args->lease,
- args->xdata);
- if (ret < 0) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LEASE,
- client4_0_lease_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_lease_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfx_lease_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ GF_VALIDATE_OR_GOTO("client", this, unwind);
+ GF_VALIDATE_OR_GOTO(this->name, frame, unwind);
+ GF_VALIDATE_OR_GOTO(this->name, data, unwind);
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_lease_v2(this, &req, args->loc, args->lease, args->xdata);
+ if (ret < 0) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LEASE,
+ client4_0_lease_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_lease_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lease, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(lease, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_lk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_lk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_lk_req req = {{0,},};
- int32_t gf_cmd = 0;
- clnt_local_t *local = NULL;
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- ret = client_cmd_to_gf_cmd (args->cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto unwind;
- }
-
- local->owner = frame->root->lk_owner;
- local->cmd = args->cmd;
- local->fd = fd_ref (args->fd);
-
- ret = client_pre_lk_v2 (this, &req, args->cmd, args->flock,
- args->fd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LK,
- client4_0_lk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_lk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ gfx_lk_req req = {
+ {
+ 0,
+ },
+ };
+ int32_t gf_cmd = 0;
+ clnt_local_t *local = NULL;
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ ret = client_cmd_to_gf_cmd(args->cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto unwind;
+ }
+
+ local->owner = frame->root->lk_owner;
+ local->cmd = args->cmd;
+ local->fd = fd_ref(args->fd);
+
+ ret = client_pre_lk_v2(this, &req, args->cmd, args->flock, args->fd,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LK,
+ client4_0_lk_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_lk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(lk, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_inodelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_inodelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_inodelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_inodelk_v2 (this, &req, args->loc, args->cmd,
- args->flock, args->volume, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_INODELK,
- client4_0_inodelk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_inodelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_inodelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_inodelk_v2(this, &req, args->loc, args->cmd, args->flock,
+ args->volume, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_INODELK,
+ client4_0_inodelk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_inodelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(inodelk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_finodelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_finodelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_finodelk_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_finodelk_v2 (this, &req, args->fd,
- args->cmd, args->flock, args->volume,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_fd_fop_prepare_local (frame, args->fd, req.fd);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FINODELK,
- client4_0_finodelk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_finodelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
- return 0;
+ clnt_args_t *args = NULL;
+ gfx_finodelk_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_finodelk_v2(this, &req, args->fd, args->cmd, args->flock,
+ args->volume, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FINODELK,
+ client4_0_finodelk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_finodelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(finodelk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_entrylk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_entrylk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_entrylk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
-
- conf = this->private;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_entrylk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- ret = client_pre_entrylk_v2 (this, &req, args->loc, args->cmd_entrylk,
- args->type, args->volume, args->basename,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (!frame || !this || !data)
+ goto unwind;
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ENTRYLK,
- client4_0_entrylk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_entrylk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ args = data;
- GF_FREE (req.xdata.pairs.pairs_val);
+ conf = this->private;
- return 0;
+ ret = client_pre_entrylk_v2(this, &req, args->loc, args->cmd_entrylk,
+ args->type, args->volume, args->basename,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ENTRYLK,
+ client4_0_entrylk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_entrylk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(entrylk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
-
int32_t
-client4_0_fentrylk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_fentrylk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_fentrylk_req req = {{0,},};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
+ clnt_args_t *args = NULL;
+ gfx_fentrylk_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
- ret = client_pre_fentrylk_v2 (this, &req, args->fd, args->cmd_entrylk,
- args->type, args->volume, args->basename,
- args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FENTRYLK,
- client4_0_fentrylk_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fentrylk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (!frame || !this || !data)
+ goto unwind;
- GF_FREE (req.xdata.pairs.pairs_val);
+ args = data;
+ conf = this->private;
- return 0;
+ ret = client_pre_fentrylk_v2(this, &req, args->fd, args->cmd_entrylk,
+ args->type, args->volume, args->basename,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FENTRYLK,
+ client4_0_fentrylk_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fentrylk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fentrylk, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_readdir (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- gfx_readdir_req req = {{0,},};
- gfx_readdir_rsp rsp = {0, };
- clnt_local_t *local = NULL;
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- int readdir_rsp_size = 0;
-
- if (!frame || !this || !data)
- goto unwind;
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ gfx_readdir_req req = {
+ {
+ 0,
+ },
+ };
+ gfx_readdir_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ int readdir_rsp_size = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ readdir_rsp_size = xdr_sizeof((xdrproc_t)xdr_gfx_readdir_rsp, &rsp) +
+ args->size;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->cmd = remote_fd;
+
+ if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE +
+ GLUSTERFS_RDMA_MAX_HEADER_SIZE) > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
- args = data;
- conf = this->private;
+ /* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
- readdir_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfx_readdir_rsp, &rsp)
- + args->size;
+ iobref_add(rsp_iobref, rsp_iobuf);
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->cmd = remote_fd;
-
- if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE + GLUSTERFS_RDMA_MAX_HEADER_SIZE)
- > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This iobuf will live for only receiving the response,
- so not harmful */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- iobref_add (rsp_iobref, rsp_iobuf);
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
- }
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
- ret = client_pre_readdir_v2 (this, &req, args->fd, args->size,
- args->offset, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ ret = client_pre_readdir_v2(this, &req, args->fd, args->size, args->offset,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READDIR,
- client4_0_readdir_cbk, NULL,
- rsphdr, count,
- NULL, 0, rsp_iobref,
- (xdrproc_t)xdr_gfx_readdir_req);
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIR,
+ client4_0_readdir_cbk, NULL, rsphdr, count,
+ NULL, 0, rsp_iobref,
+ (xdrproc_t)xdr_gfx_readdir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(readdir, frame, -1, op_errno, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_readdirp (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- gfx_readdirp_req req = {{0,},};
- gfx_readdirp_rsp rsp = {0,};
- clnt_conf_t *conf = NULL;
- int op_errno = ESTALE;
- int ret = 0;
- int count = 0;
- int readdirp_rsp_size = 0;
- struct iobref *rsp_iobref = NULL;
- struct iobuf *rsp_iobuf = NULL;
- struct iovec *rsphdr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
+ clnt_args_t *args = NULL;
+ gfx_readdirp_req req = {
+ {
+ 0,
+ },
+ };
+ gfx_readdirp_rsp rsp = {
+ 0,
+ };
+ clnt_conf_t *conf = NULL;
+ int op_errno = ESTALE;
+ int ret = 0;
+ int count = 0;
+ int readdirp_rsp_size = 0;
+ struct iobref *rsp_iobref = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iovec *rsphdr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ clnt_local_t *local = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ ret = client_pre_readdirp_v2(this, &req, args->fd, args->size, args->offset,
+ args->xdata);
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_pre_readdirp_v2 (this, &req, args->fd, args->size,
- args->offset, args->xdata);
+ readdirp_rsp_size = xdr_sizeof((xdrproc_t)xdr_gfx_readdirp_rsp, &rsp) +
+ args->size;
- if (ret) {
- op_errno = -ret;
- goto unwind;
+ if ((readdirp_rsp_size + GLUSTERFS_RPC_REPLY_SIZE +
+ GLUSTERFS_RDMA_MAX_HEADER_SIZE) > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
+ rsp_iobref = iobref_new();
+ if (rsp_iobref == NULL) {
+ goto unwind;
}
- readdirp_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfx_readdirp_rsp, &rsp)
- + args->size;
-
- if ((readdirp_rsp_size + GLUSTERFS_RPC_REPLY_SIZE
- + GLUSTERFS_RDMA_MAX_HEADER_SIZE)
- > (GLUSTERFS_RDMA_INLINE_THRESHOLD)) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- /* This iobuf will live for only receiving the response,
- so not harmful */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsp_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
- count = 1;
- local->iobref = rsp_iobref;
- iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- rsp_iobref = NULL;
+ /* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
+ rsp_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
}
- local->fd = fd_ref (args->fd);
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ iobref_add(rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_READDIRP,
- client4_0_readdirp_cbk, NULL,
- rsphdr, count, NULL,
- 0, rsp_iobref,
- (xdrproc_t)xdr_gfx_readdirp_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ local->fd = fd_ref(args->fd);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIRP,
+ client4_0_readdirp_cbk, NULL, rsphdr, count,
+ NULL, 0, rsp_iobref,
+ (xdrproc_t)xdr_gfx_readdirp_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL);
- return 0;
+ CLIENT_STACK_UNWIND(readdirp, frame, -1, op_errno, NULL, NULL);
+ return 0;
}
-
int32_t
-client4_0_setattr (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_setattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_setattr_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_setattr_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_setattr_v2 (this, &req, args->loc, args->valid,
- args->stbuf, args->xdata);
+ ret = client_pre_setattr_v2(this, &req, args->loc, args->valid, args->stbuf,
+ args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETATTR,
- client4_0_setattr_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_setattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETATTR,
+ client4_0_setattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_setattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(setattr, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
client4_0_fallocate(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fallocate_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- ret = client_pre_fallocate_v2 (this, &req, args->fd, args->flags,
- args->offset, args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FALLOCATE,
- client4_0_fallocate_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fallocate_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fallocate_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ ret = client_pre_fallocate_v2(this, &req, args->fd, args->flags,
+ args->offset, args->size, args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_FALLOCATE, client4_0_fallocate_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_fallocate_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fallocate, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fallocate, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
client4_0_discard(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_discard_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_discard_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
-
- ret = client_pre_discard_v2 (this, &req, args->fd, args->offset,
- args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ args = data;
+ conf = this->private;
+ ret = client_pre_discard_v2(this, &req, args->fd, args->offset, args->size,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_DISCARD, client4_0_discard_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_discard_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_DISCARD,
+ client4_0_discard_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_discard_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(discard, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(discard, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
client4_0_zerofill(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_zerofill_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_zerofill_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- if (!this || !data)
- goto unwind;
+ if (!this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_zerofill_v2 (this, &req, args->fd, args->offset,
- args->size, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ ret = client_pre_zerofill_v2(this, &req, args->fd, args->offset, args->size,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_ZEROFILL, client4_0_zerofill_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_zerofill_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ZEROFILL,
+ client4_0_zerofill_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_zerofill_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(zerofill, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(zerofill, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_ipc (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_ipc(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_ipc_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_ipc_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- if (!this || !data)
- goto unwind;
+ if (!this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_ipc_v2 (this, &req, args->cmd, args->xdata);
+ ret = client_pre_ipc_v2(this, &req, args->cmd, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_IPC, client4_0_ipc_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_ipc_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_IPC,
+ client4_0_ipc_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_ipc_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_seek (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_seek(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- struct gfx_seek_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ struct gfx_seek_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- if (!this || !data)
- goto unwind;
+ if (!this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_seek_v2 (this, &req, args->fd,
- args->offset, args->what, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
+ ret = client_pre_seek_v2(this, &req, args->fd, args->offset, args->what,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_SEEK, client4_0_seek_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_seek_req);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SEEK,
+ client4_0_seek_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_seek_req);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(ipc, frame, -1, op_errno, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int32_t
-client4_0_getactivelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_getactivelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_getactivelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- if (!gf_uuid_is_null (args->loc->inode->gfid))
- memcpy (req.gfid, args->loc->inode->gfid, 16);
- else
- memcpy (req.gfid, args->loc->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.gfid)),
- unwind, op_errno, EINVAL);
- conf = this->private;
-
- dict_to_xdr (args->xdata, &req.xdata);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_GETACTIVELK,
- client4_0_getactivelk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_getactivelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_getactivelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ if (!gf_uuid_is_null(args->loc->inode->gfid))
+ memcpy(req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy(req.gfid, args->loc->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req.gfid)),
+ unwind, op_errno, EINVAL);
+ conf = this->private;
+
+ dict_to_xdr(args->xdata, &req.xdata);
+
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_GETACTIVELK, client4_0_getactivelk_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_getactivelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (getactivelk, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(getactivelk, frame, -1, op_errno, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_setactivelk (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_setactivelk(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_setactivelk_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_setactivelk_req req = {
+ {
+ 0,
+ },
+ };
+ int ret = 0;
+ int op_errno = ESTALE;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- if (!(args->loc && args->loc->inode && args->locklist))
- goto unwind;
+ args = data;
+ if (!(args->loc && args->loc->inode && args->locklist))
+ goto unwind;
- if (!gf_uuid_is_null (args->loc->inode->gfid))
- memcpy (req.gfid, args->loc->inode->gfid, 16);
- else
- memcpy (req.gfid, args->loc->gfid, 16);
+ if (!gf_uuid_is_null(args->loc->inode->gfid))
+ memcpy(req.gfid, args->loc->inode->gfid, 16);
+ else
+ memcpy(req.gfid, args->loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.gfid)),
- unwind, op_errno, EINVAL);
- conf = this->private;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req.gfid)),
+ unwind, op_errno, EINVAL);
+ conf = this->private;
- dict_to_xdr (args->xdata, &req.xdata);
- ret = serialize_req_locklist_v2 (args->locklist, &req);
+ dict_to_xdr(args->xdata, &req.xdata);
+ ret = serialize_req_locklist_v2(args->locklist, &req);
- if (ret)
- goto unwind;
+ if (ret)
+ goto unwind;
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_SETACTIVELK, client4_0_setactivelk_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_setactivelk_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_SETACTIVELK, client4_0_setactivelk_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_setactivelk_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+ clnt_setactivelk_req_cleanup_v2(&req);
- clnt_setactivelk_req_cleanup_v2 (&req);
+ GF_FREE(req.xdata.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (setactivelk, frame, -1, op_errno, NULL);
+ CLIENT_STACK_UNWIND(setactivelk, frame, -1, op_errno, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- clnt_setactivelk_req_cleanup_v2 (&req);
+ clnt_setactivelk_req_cleanup_v2(&req);
- return 0;
+ return 0;
}
-
int
-client4_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfx_rchecksum_rsp rsp = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_rchecksum_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
+ call_frame_t *frame = NULL;
+ gfx_rchecksum_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rchecksum_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- rsp.weak_checksum,
- (uint8_t *)rsp.strong_checksum.strong_checksum_val,
- xdata);
+ CLIENT_STACK_UNWIND(rchecksum, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), rsp.weak_checksum,
+ (uint8_t *)rsp.strong_checksum.strong_checksum_val,
+ xdata);
- if (rsp.strong_checksum.strong_checksum_val) {
- /* This is allocated by the libc while decoding RPC msg */
- /* Hence no 'GF_FREE', but just 'free' */
- free (rsp.strong_checksum.strong_checksum_val);
- }
+ if (rsp.strong_checksum.strong_checksum_val) {
+ /* This is allocated by the libc while decoding RPC msg */
+ /* Hence no 'GF_FREE', but just 'free' */
+ free(rsp.strong_checksum.strong_checksum_val);
+ }
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int32_t
-client4_namelink_cbk (struct rpc_req *req,
- struct iovec *iov, int count, void *myframe)
+client4_namelink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = 0;
- struct iatt prebuf = {0,};
- struct iatt postbuf = {0,};
- dict_t *xdata = NULL;
- call_frame_t *frame = NULL;
- gfx_common_2iatt_rsp rsp = {0,};
-
- frame = myframe;
-
- if (req->rpc_status == -1) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret != -1) {
- gfx_stat_to_iattx (&rsp.prestat, &prebuf);
- gfx_stat_to_iattx (&rsp.poststat, &postbuf);
- }
-
- xdr_to_dict (&rsp.xdata, &xdata);
- out:
- CLIENT_STACK_UNWIND (namelink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- &prebuf, &postbuf, xdata);
- if (xdata)
- dict_unref (xdata);
- return 0;
+ int32_t ret = 0;
+ struct iatt prebuf = {
+ 0,
+ };
+ struct iatt postbuf = {
+ 0,
+ };
+ dict_t *xdata = NULL;
+ call_frame_t *frame = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+
+ frame = myframe;
+
+ if (req->rpc_status == -1) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret != -1) {
+ gfx_stat_to_iattx(&rsp.prestat, &prebuf);
+ gfx_stat_to_iattx(&rsp.poststat, &postbuf);
+ }
+
+ xdr_to_dict(&rsp.xdata, &xdata);
+out:
+ CLIENT_STACK_UNWIND(namelink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &prebuf, &postbuf,
+ xdata);
+ if (xdata)
+ dict_unref(xdata);
+ return 0;
}
int32_t
-client4_icreate_cbk (struct rpc_req *req,
- struct iovec *iov, int count, void *myframe)
+client4_icreate_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = 0;
- inode_t *inode = NULL;
- clnt_local_t *local = NULL;
- struct iatt stbuf = {0,};
- dict_t *xdata = NULL;
- call_frame_t *frame = NULL;
- gfx_common_iatt_rsp rsp = {0,};
-
- frame = myframe;
- local = frame->local;
-
- inode = local->loc.inode;
-
- if (req->rpc_status == -1) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
- if (ret < 0) {
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret != -1)
- gfx_stat_to_iattx (&rsp.stat, &stbuf);
-
- xdr_to_dict (&rsp.xdata, &xdata);
- out:
- CLIENT_STACK_UNWIND (icreate, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno),
- inode, &stbuf, xdata);
- if (xdata)
- dict_unref (xdata);
- return 0;
+ int32_t ret = 0;
+ inode_t *inode = NULL;
+ clnt_local_t *local = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ dict_t *xdata = NULL;
+ call_frame_t *frame = NULL;
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
+
+ frame = myframe;
+ local = frame->local;
+
+ inode = local->loc.inode;
+
+ if (req->rpc_status == -1) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret != -1)
+ gfx_stat_to_iattx(&rsp.stat, &stbuf);
+
+ xdr_to_dict(&rsp.xdata, &xdata);
+out:
+ CLIENT_STACK_UNWIND(icreate, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf, xdata);
+ if (xdata)
+ dict_unref(xdata);
+ return 0;
}
int
-client4_0_put_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_put_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_common_3iatt_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
- struct iatt stbuf = {0, };
- struct iatt preparent = {0, };
- struct iatt postparent = {0, };
- inode_t *inode = NULL;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
-
- if (-1 != rsp.op_ret) {
- ret = client_post_common_3iatt (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
- if (ret < 0)
- goto out;
- }
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ inode_t *inode = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &preparent,
+ &postparent, &xdata);
+ if (ret < 0)
+ goto out;
+ }
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
- CLIENT_STACK_UNWIND (put, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode, &stbuf,
- &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(put, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
+ inode, &stbuf, &preparent, &postparent, xdata);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int32_t
-client4_0_namelink (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_namelink(call_frame_t *frame, xlator_t *this, void *data)
{
- int32_t ret = 0;
- int32_t op_errno = EINVAL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfx_namelink_req req = {{0,},};
+ int32_t ret = 0;
+ int32_t op_errno = EINVAL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfx_namelink_req req = {
+ {
+ 0,
+ },
+ };
- GF_ASSERT (frame);
+ GF_ASSERT(frame);
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- if (!(args->loc && args->loc->parent))
- goto unwind;
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
- if (!gf_uuid_is_null (args->loc->parent->gfid))
- memcpy (req.pargfid, args->loc->parent->gfid, sizeof (uuid_t));
- else
- memcpy (req.pargfid, args->loc->pargfid, sizeof (uuid_t));
+ if (!gf_uuid_is_null(args->loc->parent->gfid))
+ memcpy(req.pargfid, args->loc->parent->gfid, sizeof(uuid_t));
+ else
+ memcpy(req.pargfid, args->loc->pargfid, sizeof(uuid_t));
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req.pargfid)),
- unwind, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req.pargfid)),
+ unwind, op_errno, EINVAL);
- req.bname = (char *)args->loc->name;
+ req.bname = (char *)args->loc->name;
- dict_to_xdr (args->xdata, &req.xdata);
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_NAMELINK, client4_namelink_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_namelink_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
+ dict_to_xdr(args->xdata, &req.xdata);
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_NAMELINK,
+ client4_namelink_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_namelink_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
- GF_FREE (req.xdata.pairs.pairs_val);
- return 0;
+ GF_FREE(req.xdata.pairs.pairs_val);
+ return 0;
- unwind:
- CLIENT_STACK_UNWIND (namelink, frame, -1, op_errno, NULL, NULL, NULL);
- return 0;
+unwind:
+ CLIENT_STACK_UNWIND(namelink, frame, -1, op_errno, NULL, NULL, NULL);
+ return 0;
}
int32_t
-client4_0_icreate (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_icreate(call_frame_t *frame, xlator_t *this, void *data)
{
- int32_t ret = 0;
- int32_t op_errno = EINVAL;
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- clnt_local_t *local = NULL;
- gfx_icreate_req req = {{0,},};
-
- GF_ASSERT (frame);
-
- args = data;
- conf = this->private;
-
- if (!(args->loc && args->loc->inode))
- goto unwind;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
-
- req.mode = args->mode;
- memcpy (req.gfid, args->loc->gfid, sizeof (uuid_t));
-
- op_errno = ESTALE;
- dict_to_xdr (args->xdata, &req.xdata);
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_ICREATE, client4_icreate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_icreate_req);
- if (ret)
- goto free_reqdata;
- GF_FREE (req.xdata.pairs.pairs_val);
- return 0;
-
- free_reqdata:
- GF_FREE (req.xdata.pairs.pairs_val);
- unwind:
- CLIENT_STACK_UNWIND (icreate, frame,
- -1, op_errno, NULL, NULL, NULL);
- return 0;
+ int32_t ret = 0;
+ int32_t op_errno = EINVAL;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ clnt_local_t *local = NULL;
+ gfx_icreate_req req = {
+ {
+ 0,
+ },
+ };
+
+ GF_ASSERT(frame);
+
+ args = data;
+ conf = this->private;
+
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+
+ req.mode = args->mode;
+ memcpy(req.gfid, args->loc->gfid, sizeof(uuid_t));
+
+ op_errno = ESTALE;
+ dict_to_xdr(args->xdata, &req.xdata);
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ICREATE,
+ client4_icreate_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_icreate_req);
+ if (ret)
+ goto free_reqdata;
+ GF_FREE(req.xdata.pairs.pairs_val);
+ return 0;
+
+free_reqdata:
+ GF_FREE(req.xdata.pairs.pairs_val);
+unwind:
+ CLIENT_STACK_UNWIND(icreate, frame, -1, op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int32_t
-client4_0_put (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_put(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_put_req req = {{0,},};
- int op_errno = ESTALE;
- int ret = 0;
- clnt_local_t *local = NULL;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- loc_copy (&local->loc, args->loc);
- loc_path (&local->loc, NULL);
-
- ret = client_pre_put_v2 (this, &req, args->loc, args->mode, args->umask,
- args->flags, args->size, args->offset,
- args->xattr, args->xdata);
-
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_PUT, client4_0_put_cbk,
- args->iobref, args->vector, args->count,
- NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_put_req);
- if (ret) {
- /*
- * If the lower layers fail to submit a request, they'll also
- * do the unwind for us (see rpc_clnt_submit), so don't unwind
- * here in such cases.
- */
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- return 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_put_req req = {
+ {
+ 0,
+ },
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+ clnt_local_t *local = NULL;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ loc_copy(&local->loc, args->loc);
+ loc_path(&local->loc, NULL);
+
+ ret = client_pre_put_v2(this, &req, args->loc, args->mode, args->umask,
+ args->flags, args->size, args->offset, args->xattr,
+ args->xdata);
+
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_PUT,
+ client4_0_put_cbk, args->iobref, args->vector,
+ args->count, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_put_req);
+ if (ret) {
+ /*
+ * If the lower layers fail to submit a request, they'll also
+ * do the unwind for us (see rpc_clnt_submit), so don't unwind
+ * here in such cases.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (put, frame, -1, op_errno, NULL, NULL, NULL, NULL,
- NULL);
- return 0;
+ CLIENT_STACK_UNWIND(put, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
int32_t
-client4_0_fsetattr (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- clnt_conf_t *conf = NULL;
- gfx_fsetattr_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
+ clnt_args_t *args = NULL;
+ clnt_conf_t *conf = NULL;
+ gfx_fsetattr_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
- if (!frame || !this || !data)
- goto unwind;
+ if (!frame || !this || !data)
+ goto unwind;
- args = data;
- conf = this->private;
+ args = data;
+ conf = this->private;
- ret = client_pre_fsetattr_v2 (this, &req, args->fd, args->valid,
- args->stbuf, args->xdata);
- if (ret) {
- op_errno = -ret;
- goto unwind;
- }
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_FSETATTR,
- client4_0_fsetattr_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fsetattr_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ ret = client_pre_fsetattr_v2(this, &req, args->fd, args->valid, args->stbuf,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR,
+ client4_0_fsetattr_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_fsetattr_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int32_t
-client4_0_rchecksum (call_frame_t *frame, xlator_t *this,
- void *data)
+client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
- clnt_conf_t *conf = NULL;
- gfx_rchecksum_req req = {{0},};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
-
- CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, unwind);
-
- req.len = args->len;
- req.offset = args->offset;
- req.fd = remote_fd;
- memcpy (req.gfid, args->fd->inode->gfid, 16);
-
- dict_to_xdr (args->xdata, &req.xdata);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RCHECKSUM,
- client4_rchecksum_cbk, NULL,
- NULL, 0, NULL,
- 0, NULL,
- (xdrproc_t)xdr_gfx_rchecksum_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
- }
-
- GF_FREE (req.xdata.pairs.pairs_val);
-
- return 0;
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
+ clnt_conf_t *conf = NULL;
+ gfx_rchecksum_req req = {
+ {0},
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+
+ CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno,
+ unwind);
+
+ req.len = args->len;
+ req.offset = args->offset;
+ req.fd = remote_fd;
+ memcpy(req.gfid, args->fd->inode->gfid, 16);
+
+ dict_to_xdr(args->xdata, &req.xdata);
+
+ ret = client_submit_request(
+ this, &req, frame, conf->fops, GFS3_OP_RCHECKSUM, client4_rchecksum_cbk,
+ NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfx_rchecksum_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+ "failed to send the fop");
+ }
+
+ GF_FREE(req.xdata.pairs.pairs_val);
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL);
- GF_FREE (req.xdata.pairs.pairs_val);
+ CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL);
+ GF_FREE(req.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-client4_0_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_compound_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfx_compound_rsp rsp = {0,};
- compound_args_cbk_t *args_cbk = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
- int i = 0;
- int length = 0;
- int ret = -1;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_compound_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- length = local->length;
-
- xdr_to_dict (&rsp.xdata, &xdata);
-
- args_cbk = compound_args_cbk_alloc (length, xdata);
- if (!args_cbk) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOMEM;
- goto out;
- }
-
- /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
- for (i = 0; i < args_cbk->fop_length; i++) {
- ret = client_process_response_v2 (frame, this, req, &rsp,
- args_cbk, i);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
-
+ gfx_compound_rsp rsp = {
+ 0,
+ };
+ compound_args_cbk_t *args_cbk = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+ int i = 0;
+ int length = 0;
+ int ret = -1;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_compound_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ length = local->length;
+
+ xdr_to_dict(&rsp.xdata, &xdata);
+
+ args_cbk = compound_args_cbk_alloc(length, xdata);
+ if (!args_cbk) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOMEM;
+ goto out;
+ }
+
+ /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
+ for (i = 0; i < args_cbk->fop_length; i++) {
+ ret = client_process_response_v2(frame, this, req, &rsp, args_cbk, i);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
- rsp.op_ret = 0;
+ }
+ rsp.op_ret = 0;
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
- CLIENT_STACK_UNWIND (compound, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), args_cbk, xdata);
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ }
+ CLIENT_STACK_UNWIND(compound, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), args_cbk, xdata);
- client_compound_rsp_cleanup_v2 (&rsp, length);
- free (rsp.compound_rsp_array.compound_rsp_array_val);
+ client_compound_rsp_cleanup_v2(&rsp, length);
+ free(rsp.compound_rsp_array.compound_rsp_array_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- compound_args_cbk_cleanup (args_cbk);
- return 0;
+ compound_args_cbk_cleanup(args_cbk);
+ return 0;
}
-
/* Brief explanation of gfs3_compound_req structure :
* 1) It consists of version of compounding.
* 2) A compound-fop enum, new enum for compound fops
@@ -5892,253 +6019,251 @@ out:
*/
int32_t
-client4_0_compound (call_frame_t *frame, xlator_t *this, void *data)
+client4_0_compound(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- compound_args_t *c_args = data;
- gfx_compound_req req = {0,};
- clnt_local_t *local = NULL;
- int op_errno = ENOMEM;
- int ret = 0;
- int i = 0;
- int rsp_count = 0;
- struct iovec rsp_vector[MAX_IOVEC] = {{0}, };
- struct iovec req_vector[MAX_IOVEC] = {{0}, };
- struct iovec vector[MAX_IOVEC] = {{0}, };
- struct iovec *rsphdr = NULL;
- struct iobref *req_iobref = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobref *rsphdr_iobref = NULL;
- struct iobuf *rsphdr_iobuf = NULL;
- int rsphdr_count = 0;
- int req_count = 0;
- dict_t *xdata = c_args->xdata;
-
- GF_ASSERT (frame);
-
- if (!this)
- goto unwind;
-
- memset (req_vector, 0, sizeof (req_vector));
- memset (rsp_vector, 0, sizeof (rsp_vector));
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->length = c_args->fop_length;
- local->compound_args = c_args;
-
- rsphdr_iobref = iobref_new ();
- if (rsphdr_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsphdr_iobuf = iobuf_get (this->ctx->iobuf_pool);
- if (rsphdr_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr (rsphdr_iobuf);
- rsphdr->iov_len = iobuf_pagesize (rsphdr_iobuf);
- rsphdr_count = 1;
- iobref_add (rsphdr_iobref, rsphdr_iobuf);
- iobuf_unref (rsphdr_iobuf);
- rsphdr_iobuf = NULL;
-
- req.compound_fop_enum = c_args->fop_enum;
- req.compound_req_array.compound_req_array_len = c_args->fop_length;
- req.compound_version = 0;
- dict_to_xdr (xdata, &req.xdata);
-
- req.compound_req_array.compound_req_array_val = GF_CALLOC (local->length,
- sizeof (compound_req_v2),
- gf_client_mt_compound_req_t);
-
- if (!req.compound_req_array.compound_req_array_val) {
- op_errno = ENOMEM;
- goto unwind;
+ clnt_conf_t *conf = NULL;
+ compound_args_t *c_args = data;
+ gfx_compound_req req = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ int op_errno = ENOMEM;
+ int ret = 0;
+ int i = 0;
+ int rsp_count = 0;
+ struct iovec rsp_vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec req_vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ struct iovec *rsphdr = NULL;
+ struct iobref *req_iobref = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iobref *rsphdr_iobref = NULL;
+ struct iobuf *rsphdr_iobuf = NULL;
+ int rsphdr_count = 0;
+ int req_count = 0;
+ dict_t *xdata = c_args->xdata;
+
+ GF_ASSERT(frame);
+
+ if (!this)
+ goto unwind;
+
+ memset(req_vector, 0, sizeof(req_vector));
+ memset(rsp_vector, 0, sizeof(rsp_vector));
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+ frame->local = local;
+
+ local->length = c_args->fop_length;
+ local->compound_args = c_args;
+
+ rsphdr_iobref = iobref_new();
+ if (rsphdr_iobref == NULL) {
+ goto unwind;
+ }
+
+ /* TODO: what is the size we should send ? */
+ rsphdr_iobuf = iobuf_get(this->ctx->iobuf_pool);
+ if (rsphdr_iobuf == NULL) {
+ goto unwind;
+ }
+
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr(rsphdr_iobuf);
+ rsphdr->iov_len = iobuf_pagesize(rsphdr_iobuf);
+ rsphdr_count = 1;
+ iobref_add(rsphdr_iobref, rsphdr_iobuf);
+ iobuf_unref(rsphdr_iobuf);
+ rsphdr_iobuf = NULL;
+
+ req.compound_fop_enum = c_args->fop_enum;
+ req.compound_req_array.compound_req_array_len = c_args->fop_length;
+ req.compound_version = 0;
+ dict_to_xdr(xdata, &req.xdata);
+
+ req.compound_req_array.compound_req_array_val = GF_CALLOC(
+ local->length, sizeof(compound_req_v2), gf_client_mt_compound_req_t);
+
+ if (!req.compound_req_array.compound_req_array_val) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ for (i = 0; i < local->length; i++) {
+ ret = client_handle_fop_requirements_v2(
+ this, frame, &req, local, &req_iobref, &rsp_iobref, req_vector,
+ rsp_vector, &req_count, &rsp_count, &c_args->req_list[i],
+ c_args->enum_list[i], i);
+ if (ret) {
+ op_errno = ret;
+ goto unwind;
}
+ }
- for (i = 0; i < local->length; i++) {
- ret = client_handle_fop_requirements_v2 (this, frame,
- &req, local,
- &req_iobref, &rsp_iobref,
- req_vector,
- rsp_vector, &req_count,
- &rsp_count,
- &c_args->req_list[i],
- c_args->enum_list[i],
- i);
- if (ret) {
- op_errno = ret;
- goto unwind;
- }
- }
+ local->iobref = rsp_iobref;
+ rsp_iobref = NULL;
- local->iobref = rsp_iobref;
- rsp_iobref = NULL;
+ ret = client_submit_compound_request(
+ this, &req, frame, conf->fops, GFS3_OP_COMPOUND, client4_0_compound_cbk,
+ req_vector, req_count, req_iobref, rsphdr, rsphdr_count, rsp_vector,
+ rsp_count, local->iobref, (xdrproc_t)xdr_gfx_compound_req);
- ret = client_submit_compound_request (this, &req, frame, conf->fops,
- GFS3_OP_COMPOUND, client4_0_compound_cbk,
- req_vector, req_count, req_iobref,
- rsphdr, rsphdr_count,
- rsp_vector, rsp_count,
- local->iobref,
- (xdrproc_t) xdr_gfx_compound_req);
+ GF_FREE(req.xdata.pairs.pairs_val);
- GF_FREE (req.xdata.pairs.pairs_val);
+ iobref_unref(rsphdr_iobref);
- iobref_unref (rsphdr_iobref);
-
- compound_request_cleanup_v2 (&req);
- return 0;
+ compound_request_cleanup_v2(&req);
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (compound, frame, -1, op_errno, NULL, NULL);
+ CLIENT_STACK_UNWIND(compound, frame, -1, op_errno, NULL, NULL);
- if (rsp_iobref)
- iobref_unref (rsp_iobref);
+ if (rsp_iobref)
+ iobref_unref(rsp_iobref);
- if (rsphdr_iobref)
- iobref_unref (rsphdr_iobref);
+ if (rsphdr_iobref)
+ iobref_unref(rsphdr_iobref);
- GF_FREE (req.xdata.pairs.pairs_val);
+ GF_FREE(req.xdata.pairs.pairs_val);
- compound_request_cleanup_v2 (&req);
- return 0;
+ compound_request_cleanup_v2(&req);
+ return 0;
}
/* Used From RPC-CLNT library to log proper name of procedure based on number */
char *clnt4_0_fop_names[GFS3_OP_MAXVALUE] = {
- [GFS3_OP_NULL] = "NULL",
- [GFS3_OP_STAT] = "STAT",
- [GFS3_OP_READLINK] = "READLINK",
- [GFS3_OP_MKNOD] = "MKNOD",
- [GFS3_OP_MKDIR] = "MKDIR",
- [GFS3_OP_UNLINK] = "UNLINK",
- [GFS3_OP_RMDIR] = "RMDIR",
- [GFS3_OP_SYMLINK] = "SYMLINK",
- [GFS3_OP_RENAME] = "RENAME",
- [GFS3_OP_LINK] = "LINK",
- [GFS3_OP_TRUNCATE] = "TRUNCATE",
- [GFS3_OP_OPEN] = "OPEN",
- [GFS3_OP_READ] = "READ",
- [GFS3_OP_WRITE] = "WRITE",
- [GFS3_OP_STATFS] = "STATFS",
- [GFS3_OP_FLUSH] = "FLUSH",
- [GFS3_OP_FSYNC] = "FSYNC",
- [GFS3_OP_SETXATTR] = "SETXATTR",
- [GFS3_OP_GETXATTR] = "GETXATTR",
- [GFS3_OP_REMOVEXATTR] = "REMOVEXATTR",
- [GFS3_OP_OPENDIR] = "OPENDIR",
- [GFS3_OP_FSYNCDIR] = "FSYNCDIR",
- [GFS3_OP_ACCESS] = "ACCESS",
- [GFS3_OP_CREATE] = "CREATE",
- [GFS3_OP_FTRUNCATE] = "FTRUNCATE",
- [GFS3_OP_FSTAT] = "FSTAT",
- [GFS3_OP_LK] = "LK",
- [GFS3_OP_LOOKUP] = "LOOKUP",
- [GFS3_OP_READDIR] = "READDIR",
- [GFS3_OP_INODELK] = "INODELK",
- [GFS3_OP_FINODELK] = "FINODELK",
- [GFS3_OP_ENTRYLK] = "ENTRYLK",
- [GFS3_OP_FENTRYLK] = "FENTRYLK",
- [GFS3_OP_XATTROP] = "XATTROP",
- [GFS3_OP_FXATTROP] = "FXATTROP",
- [GFS3_OP_FGETXATTR] = "FGETXATTR",
- [GFS3_OP_FSETXATTR] = "FSETXATTR",
- [GFS3_OP_RCHECKSUM] = "RCHECKSUM",
- [GFS3_OP_SETATTR] = "SETATTR",
- [GFS3_OP_FSETATTR] = "FSETATTR",
- [GFS3_OP_READDIRP] = "READDIRP",
- [GFS3_OP_RELEASE] = "RELEASE",
- [GFS3_OP_RELEASEDIR] = "RELEASEDIR",
- [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR",
- [GFS3_OP_FALLOCATE] = "FALLOCATE",
- [GFS3_OP_DISCARD] = "DISCARD",
- [GFS3_OP_ZEROFILL] = "ZEROFILL",
- [GFS3_OP_IPC] = "IPC",
- [GFS3_OP_SEEK] = "SEEK",
- [GFS3_OP_LEASE] = "LEASE",
- [GFS3_OP_GETACTIVELK] = "GETACTIVELK",
- [GFS3_OP_SETACTIVELK] = "SETACTIVELK",
- [GFS3_OP_COMPOUND] = "COMPOUND",
- [GFS3_OP_ICREATE] = "ICREATE",
- [GFS3_OP_NAMELINK] = "NAMELINK",
+ [GFS3_OP_NULL] = "NULL",
+ [GFS3_OP_STAT] = "STAT",
+ [GFS3_OP_READLINK] = "READLINK",
+ [GFS3_OP_MKNOD] = "MKNOD",
+ [GFS3_OP_MKDIR] = "MKDIR",
+ [GFS3_OP_UNLINK] = "UNLINK",
+ [GFS3_OP_RMDIR] = "RMDIR",
+ [GFS3_OP_SYMLINK] = "SYMLINK",
+ [GFS3_OP_RENAME] = "RENAME",
+ [GFS3_OP_LINK] = "LINK",
+ [GFS3_OP_TRUNCATE] = "TRUNCATE",
+ [GFS3_OP_OPEN] = "OPEN",
+ [GFS3_OP_READ] = "READ",
+ [GFS3_OP_WRITE] = "WRITE",
+ [GFS3_OP_STATFS] = "STATFS",
+ [GFS3_OP_FLUSH] = "FLUSH",
+ [GFS3_OP_FSYNC] = "FSYNC",
+ [GFS3_OP_SETXATTR] = "SETXATTR",
+ [GFS3_OP_GETXATTR] = "GETXATTR",
+ [GFS3_OP_REMOVEXATTR] = "REMOVEXATTR",
+ [GFS3_OP_OPENDIR] = "OPENDIR",
+ [GFS3_OP_FSYNCDIR] = "FSYNCDIR",
+ [GFS3_OP_ACCESS] = "ACCESS",
+ [GFS3_OP_CREATE] = "CREATE",
+ [GFS3_OP_FTRUNCATE] = "FTRUNCATE",
+ [GFS3_OP_FSTAT] = "FSTAT",
+ [GFS3_OP_LK] = "LK",
+ [GFS3_OP_LOOKUP] = "LOOKUP",
+ [GFS3_OP_READDIR] = "READDIR",
+ [GFS3_OP_INODELK] = "INODELK",
+ [GFS3_OP_FINODELK] = "FINODELK",
+ [GFS3_OP_ENTRYLK] = "ENTRYLK",
+ [GFS3_OP_FENTRYLK] = "FENTRYLK",
+ [GFS3_OP_XATTROP] = "XATTROP",
+ [GFS3_OP_FXATTROP] = "FXATTROP",
+ [GFS3_OP_FGETXATTR] = "FGETXATTR",
+ [GFS3_OP_FSETXATTR] = "FSETXATTR",
+ [GFS3_OP_RCHECKSUM] = "RCHECKSUM",
+ [GFS3_OP_SETATTR] = "SETATTR",
+ [GFS3_OP_FSETATTR] = "FSETATTR",
+ [GFS3_OP_READDIRP] = "READDIRP",
+ [GFS3_OP_RELEASE] = "RELEASE",
+ [GFS3_OP_RELEASEDIR] = "RELEASEDIR",
+ [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR",
+ [GFS3_OP_FALLOCATE] = "FALLOCATE",
+ [GFS3_OP_DISCARD] = "DISCARD",
+ [GFS3_OP_ZEROFILL] = "ZEROFILL",
+ [GFS3_OP_IPC] = "IPC",
+ [GFS3_OP_SEEK] = "SEEK",
+ [GFS3_OP_LEASE] = "LEASE",
+ [GFS3_OP_GETACTIVELK] = "GETACTIVELK",
+ [GFS3_OP_SETACTIVELK] = "SETACTIVELK",
+ [GFS3_OP_COMPOUND] = "COMPOUND",
+ [GFS3_OP_ICREATE] = "ICREATE",
+ [GFS3_OP_NAMELINK] = "NAMELINK",
};
rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = {
- [GF_FOP_NULL] = { "NULL", NULL},
- [GF_FOP_STAT] = { "STAT", client4_0_stat },
- [GF_FOP_READLINK] = { "READLINK", client4_0_readlink },
- [GF_FOP_MKNOD] = { "MKNOD", client4_0_mknod },
- [GF_FOP_MKDIR] = { "MKDIR", client4_0_mkdir },
- [GF_FOP_UNLINK] = { "UNLINK", client4_0_unlink },
- [GF_FOP_RMDIR] = { "RMDIR", client4_0_rmdir },
- [GF_FOP_SYMLINK] = { "SYMLINK", client4_0_symlink },
- [GF_FOP_RENAME] = { "RENAME", client4_0_rename },
- [GF_FOP_LINK] = { "LINK", client4_0_link },
- [GF_FOP_TRUNCATE] = { "TRUNCATE", client4_0_truncate },
- [GF_FOP_OPEN] = { "OPEN", client4_0_open },
- [GF_FOP_READ] = { "READ", client4_0_readv },
- [GF_FOP_WRITE] = { "WRITE", client4_0_writev },
- [GF_FOP_STATFS] = { "STATFS", client4_0_statfs },
- [GF_FOP_FLUSH] = { "FLUSH", client4_0_flush },
- [GF_FOP_FSYNC] = { "FSYNC", client4_0_fsync },
- [GF_FOP_GETXATTR] = { "GETXATTR", client4_0_getxattr },
- [GF_FOP_SETXATTR] = { "SETXATTR", client4_0_setxattr },
- [GF_FOP_REMOVEXATTR] = { "REMOVEXATTR", client4_0_removexattr },
- [GF_FOP_OPENDIR] = { "OPENDIR", client4_0_opendir },
- [GF_FOP_FSYNCDIR] = { "FSYNCDIR", client4_0_fsyncdir },
- [GF_FOP_ACCESS] = { "ACCESS", client4_0_access },
- [GF_FOP_CREATE] = { "CREATE", client4_0_create },
- [GF_FOP_FTRUNCATE] = { "FTRUNCATE", client4_0_ftruncate },
- [GF_FOP_FSTAT] = { "FSTAT", client4_0_fstat },
- [GF_FOP_LK] = { "LK", client4_0_lk },
- [GF_FOP_LOOKUP] = { "LOOKUP", client4_0_lookup },
- [GF_FOP_READDIR] = { "READDIR", client4_0_readdir },
- [GF_FOP_INODELK] = { "INODELK", client4_0_inodelk },
- [GF_FOP_FINODELK] = { "FINODELK", client4_0_finodelk },
- [GF_FOP_ENTRYLK] = { "ENTRYLK", client4_0_entrylk },
- [GF_FOP_FENTRYLK] = { "FENTRYLK", client4_0_fentrylk },
- [GF_FOP_XATTROP] = { "XATTROP", client4_0_xattrop },
- [GF_FOP_FXATTROP] = { "FXATTROP", client4_0_fxattrop },
- [GF_FOP_FGETXATTR] = { "FGETXATTR", client4_0_fgetxattr },
- [GF_FOP_FSETXATTR] = { "FSETXATTR", client4_0_fsetxattr },
- [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client4_0_rchecksum },
- [GF_FOP_SETATTR] = { "SETATTR", client4_0_setattr },
- [GF_FOP_FSETATTR] = { "FSETATTR", client4_0_fsetattr },
- [GF_FOP_READDIRP] = { "READDIRP", client4_0_readdirp },
- [GF_FOP_FALLOCATE] = { "FALLOCATE", client4_0_fallocate },
- [GF_FOP_DISCARD] = { "DISCARD", client4_0_discard },
- [GF_FOP_ZEROFILL] = { "ZEROFILL", client4_0_zerofill},
- [GF_FOP_RELEASE] = { "RELEASE", client4_0_release },
- [GF_FOP_RELEASEDIR] = { "RELEASEDIR", client4_0_releasedir },
- [GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec },
- [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client4_0_fremovexattr },
- [GF_FOP_IPC] = { "IPC", client4_0_ipc },
- [GF_FOP_SEEK] = { "SEEK", client4_0_seek },
- [GF_FOP_LEASE] = { "LEASE", client4_0_lease },
- [GF_FOP_GETACTIVELK] = { "GETACTIVELK", client4_0_getactivelk },
- [GF_FOP_SETACTIVELK] = { "SETACTIVELK", client4_0_setactivelk },
- [GF_FOP_COMPOUND] = { "COMPOUND", client4_0_compound },
- [GF_FOP_ICREATE] = { "ICREATE", client4_0_icreate },
- [GF_FOP_NAMELINK] = { "NAMELINK", client4_0_namelink },
+ [GF_FOP_NULL] = {"NULL", NULL},
+ [GF_FOP_STAT] = {"STAT", client4_0_stat},
+ [GF_FOP_READLINK] = {"READLINK", client4_0_readlink},
+ [GF_FOP_MKNOD] = {"MKNOD", client4_0_mknod},
+ [GF_FOP_MKDIR] = {"MKDIR", client4_0_mkdir},
+ [GF_FOP_UNLINK] = {"UNLINK", client4_0_unlink},
+ [GF_FOP_RMDIR] = {"RMDIR", client4_0_rmdir},
+ [GF_FOP_SYMLINK] = {"SYMLINK", client4_0_symlink},
+ [GF_FOP_RENAME] = {"RENAME", client4_0_rename},
+ [GF_FOP_LINK] = {"LINK", client4_0_link},
+ [GF_FOP_TRUNCATE] = {"TRUNCATE", client4_0_truncate},
+ [GF_FOP_OPEN] = {"OPEN", client4_0_open},
+ [GF_FOP_READ] = {"READ", client4_0_readv},
+ [GF_FOP_WRITE] = {"WRITE", client4_0_writev},
+ [GF_FOP_STATFS] = {"STATFS", client4_0_statfs},
+ [GF_FOP_FLUSH] = {"FLUSH", client4_0_flush},
+ [GF_FOP_FSYNC] = {"FSYNC", client4_0_fsync},
+ [GF_FOP_GETXATTR] = {"GETXATTR", client4_0_getxattr},
+ [GF_FOP_SETXATTR] = {"SETXATTR", client4_0_setxattr},
+ [GF_FOP_REMOVEXATTR] = {"REMOVEXATTR", client4_0_removexattr},
+ [GF_FOP_OPENDIR] = {"OPENDIR", client4_0_opendir},
+ [GF_FOP_FSYNCDIR] = {"FSYNCDIR", client4_0_fsyncdir},
+ [GF_FOP_ACCESS] = {"ACCESS", client4_0_access},
+ [GF_FOP_CREATE] = {"CREATE", client4_0_create},
+ [GF_FOP_FTRUNCATE] = {"FTRUNCATE", client4_0_ftruncate},
+ [GF_FOP_FSTAT] = {"FSTAT", client4_0_fstat},
+ [GF_FOP_LK] = {"LK", client4_0_lk},
+ [GF_FOP_LOOKUP] = {"LOOKUP", client4_0_lookup},
+ [GF_FOP_READDIR] = {"READDIR", client4_0_readdir},
+ [GF_FOP_INODELK] = {"INODELK", client4_0_inodelk},
+ [GF_FOP_FINODELK] = {"FINODELK", client4_0_finodelk},
+ [GF_FOP_ENTRYLK] = {"ENTRYLK", client4_0_entrylk},
+ [GF_FOP_FENTRYLK] = {"FENTRYLK", client4_0_fentrylk},
+ [GF_FOP_XATTROP] = {"XATTROP", client4_0_xattrop},
+ [GF_FOP_FXATTROP] = {"FXATTROP", client4_0_fxattrop},
+ [GF_FOP_FGETXATTR] = {"FGETXATTR", client4_0_fgetxattr},
+ [GF_FOP_FSETXATTR] = {"FSETXATTR", client4_0_fsetxattr},
+ [GF_FOP_RCHECKSUM] = {"RCHECKSUM", client4_0_rchecksum},
+ [GF_FOP_SETATTR] = {"SETATTR", client4_0_setattr},
+ [GF_FOP_FSETATTR] = {"FSETATTR", client4_0_fsetattr},
+ [GF_FOP_READDIRP] = {"READDIRP", client4_0_readdirp},
+ [GF_FOP_FALLOCATE] = {"FALLOCATE", client4_0_fallocate},
+ [GF_FOP_DISCARD] = {"DISCARD", client4_0_discard},
+ [GF_FOP_ZEROFILL] = {"ZEROFILL", client4_0_zerofill},
+ [GF_FOP_RELEASE] = {"RELEASE", client4_0_release},
+ [GF_FOP_RELEASEDIR] = {"RELEASEDIR", client4_0_releasedir},
+ [GF_FOP_GETSPEC] = {"GETSPEC", client3_getspec},
+ [GF_FOP_FREMOVEXATTR] = {"FREMOVEXATTR", client4_0_fremovexattr},
+ [GF_FOP_IPC] = {"IPC", client4_0_ipc},
+ [GF_FOP_SEEK] = {"SEEK", client4_0_seek},
+ [GF_FOP_LEASE] = {"LEASE", client4_0_lease},
+ [GF_FOP_GETACTIVELK] = {"GETACTIVELK", client4_0_getactivelk},
+ [GF_FOP_SETACTIVELK] = {"SETACTIVELK", client4_0_setactivelk},
+ [GF_FOP_COMPOUND] = {"COMPOUND", client4_0_compound},
+ [GF_FOP_ICREATE] = {"ICREATE", client4_0_icreate},
+ [GF_FOP_NAMELINK] = {"NAMELINK", client4_0_namelink},
};
-
rpc_clnt_prog_t clnt4_0_fop_prog = {
- .progname = "GlusterFS 4.x v1",
- .prognum = GLUSTER_FOP_PROGRAM,
- .progver = GLUSTER_FOP_VERSION_v2,
- .numproc = GLUSTER_FOP_PROCCNT,
- .proctable = clnt4_0_fop_actors,
- .procnames = clnt4_0_fop_names,
+ .progname = "GlusterFS 4.x v1",
+ .prognum = GLUSTER_FOP_PROGRAM,
+ .progver = GLUSTER_FOP_VERSION_v2,
+ .numproc = GLUSTER_FOP_PROCCNT,
+ .proctable = clnt4_0_fop_actors,
+ .procnames = clnt4_0_fop_names,
};
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index cd30ed9637f..ffb0a6df656 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -8,7 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
#include "client.h"
#include "xlator.h"
#include "defaults.h"
@@ -25,2970 +24,2960 @@ extern rpc_clnt_prog_t clnt_handshake_prog;
extern rpc_clnt_prog_t clnt_dump_prog;
extern struct rpcclnt_cb_program gluster_cbk_prog;
-int client_handshake (xlator_t *this, struct rpc_clnt *rpc);
-int client_init_rpc (xlator_t *this);
-int client_destroy_rpc (xlator_t *this);
-int client_mark_fd_bad (xlator_t *this);
+int
+client_handshake(xlator_t *this, struct rpc_clnt *rpc);
+int
+client_init_rpc(xlator_t *this);
+int
+client_destroy_rpc(xlator_t *this);
+int
+client_mark_fd_bad(xlator_t *this);
static void
-client_filter_o_direct (clnt_conf_t *conf, int32_t *flags)
+client_filter_o_direct(clnt_conf_t *conf, int32_t *flags)
{
- if (conf->filter_o_direct)
- *flags = (*flags & ~O_DIRECT);
+ if (conf->filter_o_direct)
+ *flags = (*flags & ~O_DIRECT);
}
static int
-client_fini_complete (xlator_t *this)
+client_fini_complete(xlator_t *this)
{
- GF_VALIDATE_OR_GOTO (this->name, this->private, out);
+ GF_VALIDATE_OR_GOTO(this->name, this->private, out);
- clnt_conf_t *conf = this->private;
+ clnt_conf_t *conf = this->private;
- if (!conf->destroy)
- return 0;
+ if (!conf->destroy)
+ return 0;
- this->private = NULL;
+ this->private = NULL;
- pthread_spin_destroy (&conf->fd_lock);
- pthread_mutex_destroy (&conf->lock);
- GF_FREE (conf);
+ pthread_spin_destroy(&conf->fd_lock);
+ pthread_mutex_destroy(&conf->lock);
+ GF_FREE(conf);
out:
- return 0;
+ return 0;
}
int
-client_notify_dispatch_uniq (xlator_t *this, int32_t event, void *data, ...)
+client_notify_dispatch_uniq(xlator_t *this, int32_t event, void *data, ...)
{
- clnt_conf_t *conf = this->private;
+ clnt_conf_t *conf = this->private;
- if (conf->last_sent_event == event)
- return 0;
+ if (conf->last_sent_event == event)
+ return 0;
- return client_notify_dispatch (this, event, data);
+ return client_notify_dispatch(this, event, data);
}
int
-client_notify_dispatch (xlator_t *this, int32_t event, void *data, ...)
-{
- int ret = -1;
- glusterfs_ctx_t *ctx = this->ctx;
- clnt_conf_t *conf = this->private;
-
- pthread_mutex_lock (&ctx->notify_lock);
- {
- while (ctx->notifying)
- pthread_cond_wait (&ctx->notify_cond,
- &ctx->notify_lock);
- ctx->notifying = 1;
- }
- pthread_mutex_unlock (&ctx->notify_lock);
-
- /* We assume that all translators in the graph handle notification
- * events in sequence.
- * */
- ret = default_notify (this, event, data);
-
- /* NB (Even) with MT-epoll and EPOLLET|EPOLLONESHOT we are guaranteed
- * that there would be atmost one poller thread executing this
- * notification function. This allows us to update last_sent_event
- * without explicit synchronization. See epoll(7).
- */
- conf->last_sent_event = event;
-
- pthread_mutex_lock (&ctx->notify_lock);
- {
- ctx->notifying = 0;
- pthread_cond_signal (&ctx->notify_cond);
- }
- pthread_mutex_unlock (&ctx->notify_lock);
-
- return ret;
+client_notify_dispatch(xlator_t *this, int32_t event, void *data, ...)
+{
+ int ret = -1;
+ glusterfs_ctx_t *ctx = this->ctx;
+ clnt_conf_t *conf = this->private;
+
+ pthread_mutex_lock(&ctx->notify_lock);
+ {
+ while (ctx->notifying)
+ pthread_cond_wait(&ctx->notify_cond, &ctx->notify_lock);
+ ctx->notifying = 1;
+ }
+ pthread_mutex_unlock(&ctx->notify_lock);
+
+ /* We assume that all translators in the graph handle notification
+ * events in sequence.
+ * */
+ ret = default_notify(this, event, data);
+
+ /* NB (Even) with MT-epoll and EPOLLET|EPOLLONESHOT we are guaranteed
+ * that there would be atmost one poller thread executing this
+ * notification function. This allows us to update last_sent_event
+ * without explicit synchronization. See epoll(7).
+ */
+ conf->last_sent_event = event;
+
+ pthread_mutex_lock(&ctx->notify_lock);
+ {
+ ctx->notifying = 0;
+ pthread_cond_signal(&ctx->notify_cond);
+ }
+ pthread_mutex_unlock(&ctx->notify_lock);
+
+ return ret;
}
int32_t
-client_type_to_gf_type (short l_type)
+client_type_to_gf_type(short l_type)
{
- int32_t gf_type = GF_LK_EOL;
+ int32_t gf_type = GF_LK_EOL;
- switch (l_type) {
+ switch (l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- return gf_type;
+ return gf_type;
}
int
-client_submit_request (xlator_t *this, void *req, call_frame_t *frame,
- rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn,
- struct iobref *iobref, struct iovec *payload,
- int payloadcnt, struct iovec *rsp_payload,
- int rsp_payload_count, struct iobref *rsp_iobref,
- xdrproc_t xdrproc)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- struct iovec iov = {0, };
- struct iobuf *iobuf = NULL;
- int count = 0;
- struct iobref *new_iobref = NULL;
- ssize_t xdr_size = 0;
- struct rpc_req rpcreq = {0, };
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, prog, out);
- GF_VALIDATE_OR_GOTO (this->name, frame, out);
-
- conf = this->private;
-
- /* If 'setvolume' is not successful, we should not send frames to
- server, mean time we should be able to send 'DUMP' and 'SETVOLUME'
- call itself even if its not connected */
- if (!(conf->connected ||
- ((prog->prognum == GLUSTER_DUMP_PROGRAM) ||
- (prog->prognum == GLUSTER_PMAP_PROGRAM) ||
- ((prog->prognum == GLUSTER_HNDSK_PROGRAM) &&
- (procnum == GF_HNDSK_SETVOLUME))))) {
- /* This particular error captured/logged in
- functions calling this */
- gf_msg_debug (this->name, 0,
- "connection in disconnected state");
- goto out;
- }
-
- if (req && xdrproc) {
- xdr_size = xdr_sizeof (xdrproc, req);
- iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size);
- if (!iobuf) {
- goto out;
- }
-
- new_iobref = iobref_new ();
- if (!new_iobref) {
- goto out;
- }
+client_submit_request(xlator_t *this, void *req, call_frame_t *frame,
+ rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn,
+ struct iobref *iobref, struct iovec *payload,
+ int payloadcnt, struct iovec *rsp_payload,
+ int rsp_payload_count, struct iobref *rsp_iobref,
+ xdrproc_t xdrproc)
+{
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ struct iovec iov = {
+ 0,
+ };
+ struct iobuf *iobuf = NULL;
+ int count = 0;
+ struct iobref *new_iobref = NULL;
+ ssize_t xdr_size = 0;
+ struct rpc_req rpcreq = {
+ 0,
+ };
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, prog, out);
+ GF_VALIDATE_OR_GOTO(this->name, frame, out);
+
+ conf = this->private;
+
+ /* If 'setvolume' is not successful, we should not send frames to
+ server, mean time we should be able to send 'DUMP' and 'SETVOLUME'
+ call itself even if its not connected */
+ if (!(conf->connected || ((prog->prognum == GLUSTER_DUMP_PROGRAM) ||
+ (prog->prognum == GLUSTER_PMAP_PROGRAM) ||
+ ((prog->prognum == GLUSTER_HNDSK_PROGRAM) &&
+ (procnum == GF_HNDSK_SETVOLUME))))) {
+ /* This particular error captured/logged in
+ functions calling this */
+ gf_msg_debug(this->name, 0, "connection in disconnected state");
+ goto out;
+ }
+
+ if (req && xdrproc) {
+ xdr_size = xdr_sizeof(xdrproc, req);
+ iobuf = iobuf_get2(this->ctx->iobuf_pool, xdr_size);
+ if (!iobuf) {
+ goto out;
+ }
- if (iobref != NULL) {
- ret = iobref_merge (new_iobref, iobref);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY, "cannot merge "
- "iobref passed from caller into "
- "new_iobref");
- }
- }
+ new_iobref = iobref_new();
+ if (!new_iobref) {
+ goto out;
+ }
- ret = iobref_add (new_iobref, iobuf);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY, "cannot add iobuf into "
- "iobref");
- goto out;
- }
+ if (iobref != NULL) {
+ ret = iobref_merge(new_iobref, iobref);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "cannot merge "
+ "iobref passed from caller into "
+ "new_iobref");
+ }
+ }
- iov.iov_base = iobuf->ptr;
- iov.iov_len = iobuf_size (iobuf);
-
- /* Create the xdr payload */
- ret = xdr_serialize_generic (iov, req, xdrproc);
- if (ret == -1) {
- /* callingfn so that, we can get to know which xdr
- function was called */
- gf_log_callingfn (this->name, GF_LOG_WARNING,
- "XDR payload creation failed");
- goto out;
- }
- iov.iov_len = ret;
- count = 1;
+ ret = iobref_add(new_iobref, iobuf);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "cannot add iobuf into "
+ "iobref");
+ goto out;
}
- /* do not send all groups if they are resolved server-side */
- if (!conf->send_gids) {
- if (frame->root->ngrps <= SMALL_GROUP_COUNT) {
- frame->root->groups_small[0] = frame->root->gid;
- frame->root->groups = frame->root->groups_small;
- }
- frame->root->ngrps = 1;
+ iov.iov_base = iobuf->ptr;
+ iov.iov_len = iobuf_size(iobuf);
+
+ /* Create the xdr payload */
+ ret = xdr_serialize_generic(iov, req, xdrproc);
+ if (ret == -1) {
+ /* callingfn so that, we can get to know which xdr
+ function was called */
+ gf_log_callingfn(this->name, GF_LOG_WARNING,
+ "XDR payload creation failed");
+ goto out;
}
+ iov.iov_len = ret;
+ count = 1;
+ }
+
+ /* do not send all groups if they are resolved server-side */
+ if (!conf->send_gids) {
+ if (frame->root->ngrps <= SMALL_GROUP_COUNT) {
+ frame->root->groups_small[0] = frame->root->gid;
+ frame->root->groups = frame->root->groups_small;
+ }
+ frame->root->ngrps = 1;
+ }
- /* Send the msg */
- ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count,
- payload, payloadcnt, new_iobref, frame,
- payload, payloadcnt, rsp_payload,
- rsp_payload_count, rsp_iobref);
+ /* Send the msg */
+ ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count, payload,
+ payloadcnt, new_iobref, frame, payload, payloadcnt,
+ rsp_payload, rsp_payload_count, rsp_iobref);
- if (ret < 0) {
- gf_msg_debug (this->name, 0, "rpc_clnt_submit failed");
- }
+ if (ret < 0) {
+ gf_msg_debug(this->name, 0, "rpc_clnt_submit failed");
+ }
- ret = 0;
+ ret = 0;
- if (new_iobref)
- iobref_unref (new_iobref);
+ if (new_iobref)
+ iobref_unref(new_iobref);
- if (iobuf)
- iobuf_unref (iobuf);
+ if (iobuf)
+ iobuf_unref(iobuf);
- return ret;
+ return ret;
out:
- rpcreq.rpc_status = -1;
+ rpcreq.rpc_status = -1;
- cbkfn (&rpcreq, NULL, 0, frame);
+ cbkfn(&rpcreq, NULL, 0, frame);
- if (new_iobref)
- iobref_unref (new_iobref);
+ if (new_iobref)
+ iobref_unref(new_iobref);
- if (iobuf)
- iobuf_unref (iobuf);
+ if (iobuf)
+ iobuf_unref(iobuf);
- return ret;
+ return ret;
}
-
int
-client_submit_compound_request (xlator_t *this, void *req, call_frame_t *frame,
- rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn,
- struct iovec *req_payload, int req_count,
- struct iobref *iobref, struct iovec *rsphdr,
- int rsphdr_count, struct iovec *rsp_payload,
- int rsp_payload_count, struct iobref *rsp_iobref,
- xdrproc_t xdrproc)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- struct iovec iov = {0, };
- struct iobuf *iobuf = NULL;
- int count = 0;
- struct iobref *new_iobref = NULL;
- ssize_t xdr_size = 0;
- struct rpc_req rpcreq = {0, };
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, prog, out);
- GF_VALIDATE_OR_GOTO (this->name, frame, out);
-
- conf = this->private;
-
- /* If 'setvolume' is not successful, we should not send frames to
- * server
- */
-
- if (!conf->connected) {
- gf_msg_debug (this->name, 0,
- "connection in disconnected state");
- goto out;
+client_submit_compound_request(xlator_t *this, void *req, call_frame_t *frame,
+ rpc_clnt_prog_t *prog, int procnum,
+ fop_cbk_fn_t cbkfn, struct iovec *req_payload,
+ int req_count, struct iobref *iobref,
+ struct iovec *rsphdr, int rsphdr_count,
+ struct iovec *rsp_payload, int rsp_payload_count,
+ struct iobref *rsp_iobref, xdrproc_t xdrproc)
+{
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ struct iovec iov = {
+ 0,
+ };
+ struct iobuf *iobuf = NULL;
+ int count = 0;
+ struct iobref *new_iobref = NULL;
+ ssize_t xdr_size = 0;
+ struct rpc_req rpcreq = {
+ 0,
+ };
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, prog, out);
+ GF_VALIDATE_OR_GOTO(this->name, frame, out);
+
+ conf = this->private;
+
+ /* If 'setvolume' is not successful, we should not send frames to
+ * server
+ */
+
+ if (!conf->connected) {
+ gf_msg_debug(this->name, 0, "connection in disconnected state");
+ goto out;
+ }
+
+ if (req && xdrproc) {
+ xdr_size = xdr_sizeof(xdrproc, req);
+ iobuf = iobuf_get2(this->ctx->iobuf_pool, xdr_size);
+ if (!iobuf) {
+ goto out;
+ };
+
+ new_iobref = iobref_new();
+ if (!new_iobref) {
+ goto out;
}
- if (req && xdrproc) {
- xdr_size = xdr_sizeof (xdrproc, req);
- iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size);
- if (!iobuf) {
- goto out;
- };
-
- new_iobref = iobref_new ();
- if (!new_iobref) {
- goto out;
- }
-
- if (iobref != NULL) {
- ret = iobref_merge (new_iobref, iobref);
- if (ret != 0) {
- goto out;
- }
- }
-
- ret = iobref_add (new_iobref, iobuf);
- if (ret != 0) {
- goto out;
- }
+ if (iobref != NULL) {
+ ret = iobref_merge(new_iobref, iobref);
+ if (ret != 0) {
+ goto out;
+ }
+ }
- iov.iov_base = iobuf->ptr;
- iov.iov_len = iobuf_size (iobuf);
-
- /* Create the xdr payload */
- ret = xdr_serialize_generic (iov, req, xdrproc);
- if (ret == -1) {
- /* callingfn so that, we can get to know which xdr
- function was called */
- gf_log_callingfn (this->name, GF_LOG_WARNING,
- "XDR payload creation failed");
- goto out;
- }
- iov.iov_len = ret;
- count = 1;
+ ret = iobref_add(new_iobref, iobuf);
+ if (ret != 0) {
+ goto out;
}
- /* do not send all groups if they are resolved server-side */
- if (!conf->send_gids) {
- if (frame->root->ngrps <= SMALL_GROUP_COUNT) {
- frame->root->groups_small[0] = frame->root->gid;
- frame->root->groups = frame->root->groups_small;
- }
- frame->root->ngrps = 1;
+ iov.iov_base = iobuf->ptr;
+ iov.iov_len = iobuf_size(iobuf);
+
+ /* Create the xdr payload */
+ ret = xdr_serialize_generic(iov, req, xdrproc);
+ if (ret == -1) {
+ /* callingfn so that, we can get to know which xdr
+ function was called */
+ gf_log_callingfn(this->name, GF_LOG_WARNING,
+ "XDR payload creation failed");
+ goto out;
+ }
+ iov.iov_len = ret;
+ count = 1;
+ }
+
+ /* do not send all groups if they are resolved server-side */
+ if (!conf->send_gids) {
+ if (frame->root->ngrps <= SMALL_GROUP_COUNT) {
+ frame->root->groups_small[0] = frame->root->gid;
+ frame->root->groups = frame->root->groups_small;
}
+ frame->root->ngrps = 1;
+ }
- /* Send the msg */
- ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count,
- req_payload, req_count, new_iobref, frame,
- rsphdr, rsphdr_count,
- rsp_payload, rsp_payload_count, rsp_iobref);
+ /* Send the msg */
+ ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count,
+ req_payload, req_count, new_iobref, frame, rsphdr,
+ rsphdr_count, rsp_payload, rsp_payload_count,
+ rsp_iobref);
- if (ret < 0) {
- gf_msg_debug (this->name, 0, "rpc_clnt_submit failed");
- }
+ if (ret < 0) {
+ gf_msg_debug(this->name, 0, "rpc_clnt_submit failed");
+ }
- ret = 0;
+ ret = 0;
- if (new_iobref)
- iobref_unref (new_iobref);
+ if (new_iobref)
+ iobref_unref(new_iobref);
- if (iobuf)
- iobuf_unref (iobuf);
+ if (iobuf)
+ iobuf_unref(iobuf);
- return ret;
+ return ret;
out:
- rpcreq.rpc_status = -1;
+ rpcreq.rpc_status = -1;
- cbkfn (&rpcreq, NULL, 0, frame);
+ cbkfn(&rpcreq, NULL, 0, frame);
- if (new_iobref)
- iobref_unref (new_iobref);
+ if (new_iobref)
+ iobref_unref(new_iobref);
- if (iobuf)
- iobuf_unref (iobuf);
+ if (iobuf)
+ iobuf_unref(iobuf);
- return 0;
+ return 0;
}
int32_t
-client_forget (xlator_t *this, inode_t *inode)
+client_forget(xlator_t *this, inode_t *inode)
{
- /* Nothing here */
- return 0;
+ /* Nothing here */
+ return 0;
}
int32_t
-client_releasedir (xlator_t *this, fd_t *fd)
+client_releasedir(xlator_t *this, fd_t *fd)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
+ args.fd = fd;
- proc = &conf->fops->proctable[GF_FOP_RELEASEDIR];
- if (proc->fn) {
- ret = proc->fn (NULL, this, &args);
- }
+ proc = &conf->fops->proctable[GF_FOP_RELEASEDIR];
+ if (proc->fn) {
+ ret = proc->fn(NULL, this, &args);
+ }
out:
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_DIR_OP_FAILED, "releasedir fop failed");
- return 0;
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DIR_OP_FAILED,
+ "releasedir fop failed");
+ return 0;
}
int32_t
-client_release (xlator_t *this, fd_t *fd)
+client_release(xlator_t *this, fd_t *fd)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- proc = &conf->fops->proctable[GF_FOP_RELEASE];
- if (proc->fn) {
- ret = proc->fn (NULL, this, &args);
- }
+ args.fd = fd;
+ proc = &conf->fops->proctable[GF_FOP_RELEASE];
+ if (proc->fn) {
+ ret = proc->fn(NULL, this, &args);
+ }
out:
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED,
- "release fop failed");
- return 0;
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED,
+ "release fop failed");
+ return 0;
}
-
int32_t
-client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
- dict_t *xdata)
+client_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_LOOKUP];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_LOOKUP];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- /* think of avoiding a missing frame */
- if (ret)
- STACK_UNWIND_STRICT (lookup, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL);
+ /* think of avoiding a missing frame */
+ if (ret)
+ STACK_UNWIND_STRICT(lookup, frame, -1, ENOTCONN, NULL, NULL, NULL,
+ NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
+client_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_STAT];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_STAT];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(stat, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
- off_t offset, dict_t *xdata)
+client_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.offset = offset;
- args.xdata = xdata;
+ args.loc = loc;
+ args.offset = offset;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_TRUNCATE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_TRUNCATE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(truncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
-
- return 0;
+ return 0;
}
-
int32_t
-client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
- off_t offset, dict_t *xdata)
+client_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.offset = offset;
- args.xdata = xdata;
+ args.fd = fd;
+ args.offset = offset;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FTRUNCATE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FTRUNCATE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_access (call_frame_t *frame, xlator_t *this, loc_t *loc,
- int32_t mask, dict_t *xdata)
+client_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.mask = mask;
- args.xdata = xdata;
+ args.loc = loc;
+ args.mask = mask;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_ACCESS];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_ACCESS];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(access, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
-
int32_t
-client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc,
- size_t size, dict_t *xdata)
+client_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.size = size;
- args.xdata = xdata;
+ args.loc = loc;
+ args.size = size;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_READLINK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_READLINK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(readlink, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
- dev_t rdev, mode_t umask, dict_t *xdata)
+client_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.mode = mode;
- args.rdev = rdev;
- args.umask = umask;
- args.xdata = xdata;
+ args.loc = loc;
+ args.mode = mode;
+ args.rdev = rdev;
+ args.umask = umask;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_MKNOD];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_MKNOD];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (mknod, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(mknod, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL);
- return 0;
+ return 0;
}
-
int
-client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode, mode_t umask, dict_t *xdata)
+client_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.mode = mode;
- args.umask = umask;
- args.xdata = xdata;
+ args.loc = loc;
+ args.mode = mode;
+ args.umask = umask;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_MKDIR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_MKDIR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (mkdir, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(mkdir, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc,
- int xflag, dict_t *xdata)
+client_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
- args.flags = xflag;
+ args.loc = loc;
+ args.xdata = xdata;
+ args.flags = xflag;
- proc = &conf->fops->proctable[GF_FOP_UNLINK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_UNLINK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (unlink, frame, -1, ENOTCONN,
- NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(unlink, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
-client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
- dict_t *xdata)
+client_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.flags = flags;
- args.xdata = xdata;
+ args.loc = loc;
+ args.flags = flags;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_RMDIR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_RMDIR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- /* think of avoiding a missing frame */
- if (ret)
- STACK_UNWIND_STRICT (rmdir, frame, -1, ENOTCONN,
- NULL, NULL, NULL);
+ /* think of avoiding a missing frame */
+ if (ret)
+ STACK_UNWIND_STRICT(rmdir, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
- loc_t *loc, mode_t umask, dict_t *xdata)
+client_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
+ loc_t *loc, mode_t umask, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.linkname = linkpath;
- args.loc = loc;
- args.umask = umask;
- args.xdata = xdata;
+ args.linkname = linkpath;
+ args.loc = loc;
+ args.umask = umask;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_SYMLINK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_SYMLINK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (symlink, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(symlink, frame, -1, ENOTCONN, NULL, NULL, NULL,
+ NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.oldloc = oldloc;
- args.newloc = newloc;
- args.xdata = xdata;
+ args.oldloc = oldloc;
+ args.newloc = newloc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_RENAME];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_RENAME];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (rename, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(rename, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.oldloc = oldloc;
- args.newloc = newloc;
- args.xdata = xdata;
+ args.oldloc = oldloc;
+ args.newloc = newloc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_LINK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_LINK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (link, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(link, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
- mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
+client_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
+ mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.mode = mode;
- args.fd = fd;
- args.umask = umask;
- args.xdata = xdata;
- args.flags = flags;
+ args.loc = loc;
+ args.mode = mode;
+ args.fd = fd;
+ args.umask = umask;
+ args.xdata = xdata;
+ args.flags = flags;
- client_filter_o_direct (conf, &args.flags);
+ client_filter_o_direct(conf, &args.flags);
- proc = &conf->fops->proctable[GF_FOP_CREATE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_CREATE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (create, frame, -1, ENOTCONN,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(create, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_open (call_frame_t *frame, xlator_t *this, loc_t *loc,
- int32_t flags, fd_t *fd, dict_t *xdata)
+client_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
+ fd_t *fd, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.fd = fd;
- args.xdata = xdata;
- args.flags = flags;
+ args.loc = loc;
+ args.fd = fd;
+ args.xdata = xdata;
+ args.flags = flags;
- client_filter_o_direct (conf, &args.flags);
+ client_filter_o_direct(conf, &args.flags);
- proc = &conf->fops->proctable[GF_FOP_OPEN];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_OPEN];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(open, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata)
+client_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.size = size;
- args.offset = offset;
- args.flags = flags;
- args.xdata = xdata;
+ args.fd = fd;
+ args.size = size;
+ args.offset = offset;
+ args.flags = flags;
+ args.xdata = xdata;
- client_filter_o_direct (conf, &args.flags);
+ client_filter_o_direct(conf, &args.flags);
- proc = &conf->fops->proctable[GF_FOP_READ];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_READ];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN,
- NULL, 0, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(readv, frame, -1, ENOTCONN, NULL, 0, NULL, NULL,
+ NULL);
- return 0;
+ return 0;
}
-
-
-
int32_t
-client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count, off_t off,
- uint32_t flags, struct iobref *iobref, dict_t *xdata)
+client_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct iovec *vector, int32_t count, off_t off, uint32_t flags,
+ struct iobref *iobref, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.vector = vector;
- args.count = count;
- args.offset = off;
- args.size = iov_length (vector, count);
- args.flags = flags;
- args.iobref = iobref;
- args.xdata = xdata;
+ args.fd = fd;
+ args.vector = vector;
+ args.count = count;
+ args.offset = off;
+ args.size = iov_length(vector, count);
+ args.flags = flags;
+ args.iobref = iobref;
+ args.xdata = xdata;
- client_filter_o_direct (conf, &args.flags);
+ client_filter_o_direct(conf, &args.flags);
- proc = &conf->fops->proctable[GF_FOP_WRITE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_WRITE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(writev, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
+client_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.xdata = xdata;
+ args.fd = fd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FLUSH];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FLUSH];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(flush, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.flags = flags;
- args.xdata = xdata;
+ args.fd = fd;
+ args.flags = flags;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FSYNC];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FSYNC];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fsync, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
+client_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.xdata = xdata;
+ args.fd = fd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FSTAT];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FSTAT];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fstat, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
- dict_t *xdata)
+client_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.fd = fd;
- args.xdata = xdata;
+ args.loc = loc;
+ args.fd = fd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_OPENDIR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_OPENDIR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(opendir, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata)
+client_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.flags = flags;
- args.xdata = xdata;
+ args.fd = fd;
+ args.flags = flags;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FSYNCDIR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FSYNCDIR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fsyncdir, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
+client_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_STATFS];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_STATFS];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(statfs, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
static gf_boolean_t
-is_client_rpc_init_command (dict_t *dict, xlator_t *this,
- char **value)
+is_client_rpc_init_command(dict_t *dict, xlator_t *this, char **value)
{
- gf_boolean_t ret = _gf_false;
- int dict_ret = -1;
+ gf_boolean_t ret = _gf_false;
+ int dict_ret = -1;
- dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT, value);
- if (dict_ret) {
- gf_msg_trace (this->name, 0, "key %s not present",
- CLIENT_CMD_CONNECT);
- goto out;
- }
+ dict_ret = dict_get_str(dict, CLIENT_CMD_CONNECT, value);
+ if (dict_ret) {
+ gf_msg_trace(this->name, 0, "key %s not present", CLIENT_CMD_CONNECT);
+ goto out;
+ }
- ret = _gf_true;
+ ret = _gf_true;
out:
- return ret;
-
+ return ret;
}
static gf_boolean_t
-is_client_rpc_destroy_command (dict_t *dict, xlator_t *this)
+is_client_rpc_destroy_command(dict_t *dict, xlator_t *this)
{
- gf_boolean_t ret = _gf_false;
- int dict_ret = -1;
- char *dummy = NULL;
+ gf_boolean_t ret = _gf_false;
+ int dict_ret = -1;
+ char *dummy = NULL;
- if (strncmp (this->name, "replace-brick", 13)) {
- gf_msg_trace (this->name, 0, "name is !replace-brick");
- goto out;
- }
+ if (strncmp(this->name, "replace-brick", 13)) {
+ gf_msg_trace(this->name, 0, "name is !replace-brick");
+ goto out;
+ }
- dict_ret = dict_get_str (dict, CLIENT_CMD_DISCONNECT, &dummy);
- if (dict_ret) {
- gf_msg_trace (this->name, 0, "key %s not present",
- CLIENT_CMD_DISCONNECT);
- goto out;
- }
+ dict_ret = dict_get_str(dict, CLIENT_CMD_DISCONNECT, &dummy);
+ if (dict_ret) {
+ gf_msg_trace(this->name, 0, "key %s not present",
+ CLIENT_CMD_DISCONNECT);
+ goto out;
+ }
- ret = _gf_true;
+ ret = _gf_true;
out:
- return ret;
-
+ return ret;
}
static int
-client_set_remote_options (char *value, xlator_t *this)
-{
- char *dup_value = NULL;
- char *host = NULL;
- char *subvol = NULL;
- char *host_dup = NULL;
- char *subvol_dup = NULL;
- char *remote_port_str = NULL;
- char *tmp = NULL;
- int remote_port = 0;
- int ret = 0;
-
- dup_value = gf_strdup (value);
- host = strtok_r (dup_value, ":", &tmp);
- subvol = strtok_r (NULL, ":", &tmp);
- remote_port_str = strtok_r (NULL, ":", &tmp);
-
- if (host) {
- host_dup = gf_strdup (host);
- if (!host_dup) {
- goto out;
- }
- ret = dict_set_dynstr (this->options, "remote-host", host_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
- }
+client_set_remote_options(char *value, xlator_t *this)
+{
+ char *dup_value = NULL;
+ char *host = NULL;
+ char *subvol = NULL;
+ char *host_dup = NULL;
+ char *subvol_dup = NULL;
+ char *remote_port_str = NULL;
+ char *tmp = NULL;
+ int remote_port = 0;
+ int ret = 0;
+
+ dup_value = gf_strdup(value);
+ host = strtok_r(dup_value, ":", &tmp);
+ subvol = strtok_r(NULL, ":", &tmp);
+ remote_port_str = strtok_r(NULL, ":", &tmp);
+
+ if (host) {
+ host_dup = gf_strdup(host);
+ if (!host_dup) {
+ goto out;
}
+ ret = dict_set_dynstr(this->options, "remote-host", host_dup);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
+ }
+ }
- if (subvol) {
- subvol_dup = gf_strdup (subvol);
- if (!subvol_dup) {
- goto out;
- }
+ if (subvol) {
+ subvol_dup = gf_strdup(subvol);
+ if (!subvol_dup) {
+ goto out;
+ }
- ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
- }
+ ret = dict_set_dynstr(this->options, "remote-subvolume", subvol_dup);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
}
+ }
- if (remote_port_str) {
- remote_port = atoi (remote_port_str);
+ if (remote_port_str) {
+ remote_port = atoi(remote_port_str);
- ret = dict_set_int32 (this->options, "remote-port",
- remote_port);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-port to %d", remote_port);
- goto out;
- }
+ ret = dict_set_int32(this->options, "remote-port", remote_port);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-port to %d", remote_port);
+ goto out;
}
+ }
- ret = 0;
+ ret = 0;
out:
- GF_FREE (dup_value);
+ GF_FREE(dup_value);
- return ret;
+ return ret;
}
-
int32_t
-client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
- int32_t flags, dict_t *xdata)
-{
- int ret = -1;
- int op_ret = -1;
- int op_errno = ENOTCONN;
- int need_unwind = 0;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
- char *value = NULL;
-
-
- if (is_client_rpc_init_command (dict, this, &value) == _gf_true) {
- GF_ASSERT (value);
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
- "client rpc init command");
- ret = client_set_remote_options (value, this);
- if (!ret) {
- op_ret = 0;
- op_errno = 0;
- }
- need_unwind = 1;
- goto out;
+client_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
+ int32_t flags, dict_t *xdata)
+{
+ int ret = -1;
+ int op_ret = -1;
+ int op_errno = ENOTCONN;
+ int need_unwind = 0;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+ char *value = NULL;
+
+ if (is_client_rpc_init_command(dict, this, &value) == _gf_true) {
+ GF_ASSERT(value);
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
+ "client rpc init command");
+ ret = client_set_remote_options(value, this);
+ if (!ret) {
+ op_ret = 0;
+ op_errno = 0;
}
-
- if (is_client_rpc_destroy_command (dict, this) == _gf_true) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY,
- "client rpc destroy command");
- ret = client_destroy_rpc (this);
- if (ret) {
- op_ret = 0;
- op_errno = 0;
- }
- need_unwind = 1;
- goto out;
- }
-
- conf = this->private;
- if (!conf || !conf->fops) {
- op_errno = ENOTCONN;
- need_unwind = 1;
- goto out;
+ need_unwind = 1;
+ goto out;
+ }
+
+ if (is_client_rpc_destroy_command(dict, this) == _gf_true) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY,
+ "client rpc destroy command");
+ ret = client_destroy_rpc(this);
+ if (ret) {
+ op_ret = 0;
+ op_errno = 0;
}
-
- args.loc = loc;
- args.xattr = dict;
- args.flags = flags;
- args.xdata = xdata;
-
- proc = &conf->fops->proctable[GF_FOP_SETXATTR];
- if (proc->fn) {
- ret = proc->fn (frame, this, &args);
- if (ret) {
- need_unwind = 1;
- }
+ need_unwind = 1;
+ goto out;
+ }
+
+ conf = this->private;
+ if (!conf || !conf->fops) {
+ op_errno = ENOTCONN;
+ need_unwind = 1;
+ goto out;
+ }
+
+ args.loc = loc;
+ args.xattr = dict;
+ args.flags = flags;
+ args.xdata = xdata;
+
+ proc = &conf->fops->proctable[GF_FOP_SETXATTR];
+ if (proc->fn) {
+ ret = proc->fn(frame, this, &args);
+ if (ret) {
+ need_unwind = 1;
}
+ }
out:
- if (need_unwind)
- STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL);
+ if (need_unwind)
+ STACK_UNWIND_STRICT(setxattr, frame, op_ret, op_errno, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- dict_t *dict, int32_t flags, dict_t *xdata)
+client_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
+ int32_t flags, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.xattr = dict;
- args.flags = flags;
- args.xdata = xdata;
+ args.fd = fd;
+ args.xattr = dict;
+ args.flags = flags;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FSETXATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FSETXATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fsetxattr, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
-
int32_t
-client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- const char *name, dict_t *xdata)
+client_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.name = name;
- args.xdata = xdata;
+ args.fd = fd;
+ args.name = name;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FGETXATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FGETXATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fgetxattr, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
- const char *name, dict_t *xdata)
+client_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.name = name;
- args.loc = loc;
- args.xdata = xdata;
+ args.name = name;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_GETXATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_GETXATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(getxattr, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
- gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
+client_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.flags = flags;
- args.xattr = dict;
- args.xdata = xdata;
+ args.loc = loc;
+ args.flags = flags;
+ args.xattr = dict;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_XATTROP];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_XATTROP];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(xattrop, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
- gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
+client_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.flags = flags;
- args.xattr = dict;
- args.xdata = xdata;
+ args.fd = fd;
+ args.flags = flags;
+ args.xattr = dict;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FXATTROP];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FXATTROP];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
- const char *name, dict_t *xdata)
+client_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.name = name;
- args.loc = loc;
- args.xdata = xdata;
+ args.name = name;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(removexattr, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
int32_t
-client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- const char *name, dict_t *xdata)
+client_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.name = name;
- args.fd = fd;
- args.xdata = xdata;
+ args.name = name;
+ args.fd = fd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fremovexattr, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
int32_t
-client_lease (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct gf_lease *lease, dict_t *xdata)
+client_lease(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.lease = lease;
- args.xdata = xdata;
+ args.loc = loc;
+ args.lease = lease;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_LEASE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_LEASE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(lk, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
- struct gf_flock *lock, dict_t *xdata)
+client_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
+ struct gf_flock *lock, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.cmd = cmd;
- args.flock = lock;
- args.xdata = xdata;
+ args.fd = fd;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_LK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_LK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(lk, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume,
- loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
+client_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
+ loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.cmd = cmd;
- args.flock = lock;
- args.volume = volume;
- args.xdata = xdata;
+ args.loc = loc;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.volume = volume;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_INODELK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_INODELK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(inodelk, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
- fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
+client_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
+ fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.cmd = cmd;
- args.flock = lock;
- args.volume = volume;
- args.xdata = xdata;
+ args.fd = fd;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.volume = volume;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FINODELK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FINODELK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(finodelk, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume,
- loc_t *loc, const char *basename, entrylk_cmd cmd,
- entrylk_type type, dict_t *xdata)
+client_entrylk(call_frame_t *frame, xlator_t *this, const char *volume,
+ loc_t *loc, const char *basename, entrylk_cmd cmd,
+ entrylk_type type, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.basename = basename;
- args.type = type;
- args.volume = volume;
- args.cmd_entrylk = cmd;
- args.xdata = xdata;
+ args.loc = loc;
+ args.basename = basename;
+ args.type = type;
+ args.volume = volume;
+ args.cmd_entrylk = cmd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_ENTRYLK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_ENTRYLK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(entrylk, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
-
int32_t
-client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume,
- fd_t *fd, const char *basename, entrylk_cmd cmd,
- entrylk_type type, dict_t *xdata)
+client_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume,
+ fd_t *fd, const char *basename, entrylk_cmd cmd,
+ entrylk_type type, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.basename = basename;
- args.type = type;
- args.volume = volume;
- args.cmd_entrylk = cmd;
- args.xdata = xdata;
+ args.fd = fd;
+ args.basename = basename;
+ args.type = type;
+ args.volume = volume;
+ args.cmd_entrylk = cmd;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FENTRYLK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FENTRYLK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- int32_t len, dict_t *xdata)
+client_rchecksum(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ int32_t len, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.offset = offset;
- args.len = len;
- args.xdata = xdata;
+ args.fd = fd;
+ args.offset = offset;
+ args.len = len;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_RCHECKSUM];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_RCHECKSUM];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
-client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t off, dict_t *xdata)
+client_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t off, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- if (off != 0)
- off = gf_dirent_orig_offset(this, off);
+ if (off != 0)
+ off = gf_dirent_orig_offset(this, off);
- args.fd = fd;
- args.size = size;
- args.offset = off;
- args.xdata = xdata;
+ args.fd = fd;
+ args.size = size;
+ args.offset = off;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_READDIR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_READDIR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(readdir, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t off, dict_t *dict)
+client_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t off, dict_t *dict)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- if (off != 0)
- off = gf_dirent_orig_offset(this, off);
+ if (off != 0)
+ off = gf_dirent_orig_offset(this, off);
- args.fd = fd;
- args.size = size;
- args.offset = off;
- args.xdata = dict;
+ args.fd = fd;
+ args.size = size;
+ args.offset = off;
+ args.xdata = dict;
- proc = &conf->fops->proctable[GF_FOP_READDIRP];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_READDIRP];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(readdirp, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct iatt *stbuf, int32_t valid, dict_t *xdata)
+client_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.stbuf = stbuf;
- args.valid = valid;
- args.xdata = xdata;
+ args.loc = loc;
+ args.stbuf = stbuf;
+ args.valid = valid;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_SETATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_SETATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(setattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
-client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iatt *stbuf, int32_t valid, dict_t *xdata)
+client_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
+ struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.stbuf = stbuf;
- args.valid = valid;
- args.xdata = xdata;
+ args.fd = fd;
+ args.stbuf = stbuf;
+ args.valid = valid;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FSETATTR];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FSETATTR];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
- off_t offset, size_t len, dict_t *xdata)
+ off_t offset, size_t len, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.flags = mode;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
+ args.fd = fd;
+ args.flags = mode;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_FALLOCATE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_FALLOCATE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (fallocate, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(fallocate, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- size_t len, dict_t *xdata)
+ size_t len, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
+ args.fd = fd;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_DISCARD];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_DISCARD];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT(discard, frame, -1, ENOTCONN, NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(discard, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- off_t len, dict_t *xdata)
+ off_t len, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
+ args.fd = fd;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_ZEROFILL];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_ZEROFILL];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT(zerofill, frame, -1, ENOTCONN,
- NULL, NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(zerofill, frame, -1, ENOTCONN, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
+client_ipc(call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.cmd = op;
- args.xdata = xdata;
+ args.cmd = op;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_IPC];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_IPC];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT(ipc, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(ipc, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- gf_seek_what_t what, dict_t *xdata)
+client_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.fd = fd;
- args.offset = offset;
- args.what = what;
- args.xdata = xdata;
+ args.fd = fd;
+ args.offset = offset;
+ args.what = what;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_SEEK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_SEEK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT(seek, frame, -1, ENOTCONN, 0, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(seek, frame, -1, ENOTCONN, 0, NULL);
- return 0;
+ return 0;
}
int32_t
-client_getactivelk (call_frame_t *frame, xlator_t *this, loc_t *loc,
- dict_t *xdata)
+client_getactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
-
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_GETACTIVELK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_GETACTIVELK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (getactivelk, frame, -1, ENOTCONN, NULL,
- NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(getactivelk, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
-client_setactivelk (call_frame_t *frame, xlator_t *this, loc_t *loc,
- lock_migration_info_t *locklist, dict_t *xdata)
+client_setactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
+ lock_migration_info_t *locklist, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
-
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
- args.locklist = locklist;
+ args.loc = loc;
+ args.xdata = xdata;
+ args.locklist = locklist;
- proc = &conf->fops->proctable[GF_FOP_SETACTIVELK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_SETACTIVELK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
out:
- if (ret)
- STACK_UNWIND_STRICT (setactivelk, frame, -1, ENOTCONN, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(setactivelk, frame, -1, ENOTCONN, NULL);
- return 0;
+ return 0;
}
int32_t
-client_getspec (call_frame_t *frame, xlator_t *this, const char *key,
- int32_t flags)
+client_getspec(call_frame_t *frame, xlator_t *this, const char *key,
+ int32_t flags)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
- conf = this->private;
- if (!conf || !conf->fops || !conf->handshake)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops || !conf->handshake)
+ goto out;
- args.name = key;
- args.flags = flags;
+ args.name = key;
+ args.flags = flags;
- /* For all other xlators, getspec is an fop, hence its in fops table */
- proc = &conf->fops->proctable[GF_FOP_GETSPEC];
- if (proc->fn) {
- /* But at protocol level, this is handshake */
- ret = proc->fn (frame, this, &args);
- }
+ /* For all other xlators, getspec is an fop, hence its in fops table */
+ proc = &conf->fops->proctable[GF_FOP_GETSPEC];
+ if (proc->fn) {
+ /* But at protocol level, this is handshake */
+ ret = proc->fn(frame, this, &args);
+ }
out:
- if (ret)
- STACK_UNWIND_STRICT (getspec, frame, -1, EINVAL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(getspec, frame, -1, EINVAL, NULL);
- return 0;
+ return 0;
}
-
int32_t
-client_compound (call_frame_t *frame, xlator_t *this,
- void *data, dict_t *xdata)
+client_compound(call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- compound_args_t *args = data;
- rpc_clnt_procedure_t *proc = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ compound_args_t *args = data;
+ rpc_clnt_procedure_t *proc = NULL;
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
- args->xdata = xdata;
+ args->xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_COMPOUND];
- if (proc->fn)
- ret = proc->fn (frame, this, args);
+ proc = &conf->fops->proctable[GF_FOP_COMPOUND];
+ if (proc->fn)
+ ret = proc->fn(frame, this, args);
out:
- if (ret)
- STACK_UNWIND_STRICT (compound, frame, -1, ENOTCONN,
- NULL, NULL);
+ if (ret)
+ STACK_UNWIND_STRICT(compound, frame, -1, ENOTCONN, NULL, NULL);
- return 0;
+ return 0;
}
int32_t
-client_namelink (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
+client_namelink(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int32_t ret = -1;
- clnt_conf_t *conf = NULL;
- clnt_args_t args = {0,};
- rpc_clnt_procedure_t *proc = NULL;
+ int32_t ret = -1;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+ rpc_clnt_procedure_t *proc = NULL;
- conf = this->private;
- if (!conf || !conf->fops || !conf->handshake)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops || !conf->handshake)
+ goto out;
- args.loc = loc;
- args.xdata = xdata;
+ args.loc = loc;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_NAMELINK];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_NAMELINK];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
- out:
- if (ret)
- STACK_UNWIND_STRICT (namelink, frame,
- -1, EINVAL, NULL, NULL, NULL);
- return 0;
+out:
+ if (ret)
+ STACK_UNWIND_STRICT(namelink, frame, -1, EINVAL, NULL, NULL, NULL);
+ return 0;
}
int32_t
-client_icreate (call_frame_t *frame,
- xlator_t *this, loc_t *loc, mode_t mode, dict_t *xdata)
+client_icreate(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ dict_t *xdata)
{
- int32_t ret = -1;
- clnt_conf_t *conf = NULL;
- clnt_args_t args = {0,};
- rpc_clnt_procedure_t *proc = NULL;
+ int32_t ret = -1;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+ rpc_clnt_procedure_t *proc = NULL;
- conf = this->private;
- if (!conf || !conf->fops || !conf->handshake)
- goto out;
+ conf = this->private;
+ if (!conf || !conf->fops || !conf->handshake)
+ goto out;
- args.loc = loc;
- args.mode = mode;
- args.xdata = xdata;
+ args.loc = loc;
+ args.mode = mode;
+ args.xdata = xdata;
- proc = &conf->fops->proctable[GF_FOP_ICREATE];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
+ proc = &conf->fops->proctable[GF_FOP_ICREATE];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
- out:
- if (ret)
- STACK_UNWIND_STRICT (icreate, frame,
- -1, EINVAL, NULL, NULL, NULL);
- return 0;
+out:
+ if (ret)
+ STACK_UNWIND_STRICT(icreate, frame, -1, EINVAL, NULL, NULL, NULL);
+ return 0;
}
int32_t
-client_put (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
- mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
- off_t off, struct iobref *iobref, dict_t *xattr, dict_t *xdata)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- rpc_clnt_procedure_t *proc = NULL;
- clnt_args_t args = {0,};
-
- conf = this->private;
- if (!conf || !conf->fops)
- goto out;
-
- args.loc = loc;
- args.mode = mode;
- args.umask = umask;
- args.flags = flags;
- args.vector = vector;
- args.count = count;
- args.offset = off;
- args.size = iov_length (vector, count);
- args.iobref = iobref;
- args.xattr = xattr;
- args.xdata = xdata;
-
- client_filter_o_direct (conf, &args.flags);
-
- proc = &conf->fops->proctable[GF_FOP_PUT];
- if (proc->fn)
- ret = proc->fn (frame, this, &args);
-out:
- if (ret)
- STACK_UNWIND_STRICT (put, frame, -1, ENOTCONN, NULL, NULL,
- NULL, NULL, NULL);
-
- return 0;
+client_put(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
+ mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
+ off_t off, struct iobref *iobref, dict_t *xattr, dict_t *xdata)
+{
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
+
+ args.loc = loc;
+ args.mode = mode;
+ args.umask = umask;
+ args.flags = flags;
+ args.vector = vector;
+ args.count = count;
+ args.offset = off;
+ args.size = iov_length(vector, count);
+ args.iobref = iobref;
+ args.xattr = xattr;
+ args.xdata = xdata;
+
+ client_filter_o_direct(conf, &args.flags);
+
+ proc = &conf->fops->proctable[GF_FOP_PUT];
+ if (proc->fn)
+ ret = proc->fn(frame, this, &args);
+out:
+ if (ret)
+ STACK_UNWIND_STRICT(put, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
+ NULL);
+
+ return 0;
}
int
-client_mark_fd_bad (xlator_t *this)
+client_mark_fd_bad(xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *tmp = NULL, *fdctx = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *tmp = NULL, *fdctx = NULL;
- conf = this->private;
+ conf = this->private;
- pthread_spin_lock (&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos)
{
- list_for_each_entry_safe (fdctx, tmp, &conf->saved_fds,
- sfd_pos) {
- fdctx->remote_fd = -1;
- }
+ fdctx->remote_fd = -1;
}
- pthread_spin_unlock (&conf->fd_lock);
+ }
+ pthread_spin_unlock(&conf->fd_lock);
- return 0;
+ return 0;
}
-
int
-client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
- void *data)
-{
- xlator_t *this = NULL;
- clnt_conf_t *conf = NULL;
- int ret = 0;
-
- this = mydata;
- if (!this || !this->private) {
- gf_msg ("client", GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
- (this != NULL) ?
- "private structure of the xlator is NULL":
- "xlator is NULL");
- goto out;
- }
-
- conf = this->private;
-
- switch (event) {
- case RPC_CLNT_PING:
- {
- ret = default_notify (this, GF_EVENT_CHILD_PING, data);
- if (ret)
- gf_log (this->name, GF_LOG_INFO,
- "CHILD_PING notify failed");
- conf->last_sent_event = GF_EVENT_CHILD_PING;
- break;
+client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
+ void *data)
+{
+ xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ this = mydata;
+ if (!this || !this->private) {
+ gf_msg("client", GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
+ (this != NULL) ? "private structure of the xlator is NULL"
+ : "xlator is NULL");
+ goto out;
+ }
+
+ conf = this->private;
+
+ switch (event) {
+ case RPC_CLNT_PING: {
+ ret = default_notify(this, GF_EVENT_CHILD_PING, data);
+ if (ret)
+ gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed");
+ conf->last_sent_event = GF_EVENT_CHILD_PING;
+ break;
}
- case RPC_CLNT_CONNECT:
- {
- conf->can_log_disconnect = 1;
- // connect happened, send 'get_supported_versions' mop
-
- gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT");
-
- ret = client_handshake (this, rpc);
- if (ret)
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_HANDSHAKE_RETURN, "handshake "
- "msg returned %d", ret);
- break;
+ case RPC_CLNT_CONNECT: {
+ conf->can_log_disconnect = 1;
+ // connect happened, send 'get_supported_versions' mop
+
+ gf_msg_debug(this->name, 0, "got RPC_CLNT_CONNECT");
+
+ ret = client_handshake(this, rpc);
+ if (ret)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_HANDSHAKE_RETURN,
+ "handshake "
+ "msg returned %d",
+ ret);
+ break;
}
case RPC_CLNT_DISCONNECT:
- gf_msg_debug (this->name, 0, "got RPC_CLNT_DISCONNECT");
-
- client_mark_fd_bad (this);
-
- if (!conf->skip_notify) {
- if (conf->can_log_disconnect) {
- if (!conf->disconnect_err_logged) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CLIENT_DISCONNECTED,
- "disconnected from %s. Client "
- "process will keep trying to "
- "connect to glusterd until "
- "brick's port is available",
- conf->rpc->conn.name);
- } else {
- gf_msg_debug (this->name, 0,
- "disconnected from %s. "
- "Client process will keep"
- " trying to connect to "
- "glusterd until brick's "
- "port is available",
- conf->rpc->conn.name);
- }
- if (conf->portmap_err_logged)
- conf->disconnect_err_logged = 1;
- }
- /* If the CHILD_DOWN event goes to parent xlator
- multiple times, the logic of parent xlator notify
- may get screwed up.. (eg. CHILD_MODIFIED event in
- replicate), hence make sure events which are passed
- to parent are genuine */
- ret = client_notify_dispatch_uniq (this,
- GF_EVENT_CHILD_DOWN,
- NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_DOWN_NOTIFY_FAILED,
- "CHILD_DOWN notify failed");
-
- } else {
- if (conf->can_log_disconnect)
- gf_msg_debug (this->name, 0,
- "disconnected (skipped notify)");
+ gf_msg_debug(this->name, 0, "got RPC_CLNT_DISCONNECT");
+
+ client_mark_fd_bad(this);
+
+ if (!conf->skip_notify) {
+ if (conf->can_log_disconnect) {
+ if (!conf->disconnect_err_logged) {
+ gf_msg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CLIENT_DISCONNECTED,
+ "disconnected from %s. Client "
+ "process will keep trying to "
+ "connect to glusterd until "
+ "brick's port is available",
+ conf->rpc->conn.name);
+ } else {
+ gf_msg_debug(this->name, 0,
+ "disconnected from %s. "
+ "Client process will keep"
+ " trying to connect to "
+ "glusterd until brick's "
+ "port is available",
+ conf->rpc->conn.name);
+ }
+ if (conf->portmap_err_logged)
+ conf->disconnect_err_logged = 1;
}
-
- conf->connected = 0;
- conf->can_log_disconnect = 0;
- conf->skip_notify = 0;
-
- if (conf->quick_reconnect) {
- conf->quick_reconnect = 0;
- rpc_clnt_cleanup_and_start (rpc);
-
- } else {
- rpc->conn.config.remote_port = 0;
- }
- break;
+ /* If the CHILD_DOWN event goes to parent xlator
+ multiple times, the logic of parent xlator notify
+ may get screwed up.. (eg. CHILD_MODIFIED event in
+ replicate), hence make sure events which are passed
+ to parent are genuine */
+ ret = client_notify_dispatch_uniq(this, GF_EVENT_CHILD_DOWN,
+ NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CHILD_DOWN_NOTIFY_FAILED,
+ "CHILD_DOWN notify failed");
+
+ } else {
+ if (conf->can_log_disconnect)
+ gf_msg_debug(this->name, 0,
+ "disconnected (skipped notify)");
+ }
+
+ conf->connected = 0;
+ conf->can_log_disconnect = 0;
+ conf->skip_notify = 0;
+
+ if (conf->quick_reconnect) {
+ conf->quick_reconnect = 0;
+ rpc_clnt_cleanup_and_start(rpc);
+
+ } else {
+ rpc->conn.config.remote_port = 0;
+ }
+ break;
case RPC_CLNT_DESTROY:
- ret = client_fini_complete (this);
- break;
+ ret = client_fini_complete(this);
+ break;
default:
- gf_msg_trace (this->name, 0,
- "got some other RPC event %d", event);
+ gf_msg_trace(this->name, 0, "got some other RPC event %d", event);
- break;
- }
+ break;
+ }
out:
- return 0;
+ return 0;
}
-
int
-notify (xlator_t *this, int32_t event, void *data, ...)
+notify(xlator_t *this, int32_t event, void *data, ...)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
- if (!conf)
- return 0;
+ conf = this->private;
+ if (!conf)
+ return 0;
- switch (event) {
- case GF_EVENT_PARENT_UP:
- {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP,
- "parent translators are ready, attempting connect "
- "on transport");
+ switch (event) {
+ case GF_EVENT_PARENT_UP: {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP,
+ "parent translators are ready, attempting connect "
+ "on transport");
- rpc_clnt_start (conf->rpc);
- break;
+ rpc_clnt_start(conf->rpc);
+ break;
}
case GF_EVENT_PARENT_DOWN:
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN,
- "current graph is no longer active, destroying "
- "rpc_client ");
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN,
+ "current graph is no longer active, destroying "
+ "rpc_client ");
- pthread_mutex_lock (&conf->lock);
- {
- conf->parent_down = 1;
- }
- pthread_mutex_unlock (&conf->lock);
+ pthread_mutex_lock(&conf->lock);
+ {
+ conf->parent_down = 1;
+ }
+ pthread_mutex_unlock(&conf->lock);
- rpc_clnt_disable (conf->rpc);
- break;
+ rpc_clnt_disable(conf->rpc);
+ break;
default:
- gf_msg_debug (this->name, 0,
- "got %d, calling default_notify ()", event);
+ gf_msg_debug(this->name, 0, "got %d, calling default_notify ()",
+ event);
- default_notify (this, event, data);
- conf->last_sent_event = event;
- break;
- }
+ default_notify(this, event, data);
+ conf->last_sent_event = event;
+ break;
+ }
- return 0;
+ return 0;
}
int
-client_check_remote_host (xlator_t *this, dict_t *options)
-{
- char *remote_host = NULL;
- int ret = -1;
-
- ret = dict_get_str (options, "remote-host", &remote_host);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, EINVAL,
- PC_MSG_DICT_GET_FAILED, "Remote host is not set. "
- "Assuming the volfile server as remote host");
-
- if (!this->ctx->cmd_args.volfile_server) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_DICT_GET_FAILED, "No remote host to "
- "connect.");
- goto out;
- }
+client_check_remote_host(xlator_t *this, dict_t *options)
+{
+ char *remote_host = NULL;
+ int ret = -1;
+
+ ret = dict_get_str(options, "remote-host", &remote_host);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "Remote host is not set. "
+ "Assuming the volfile server as remote host");
+
+ if (!this->ctx->cmd_args.volfile_server) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "No remote host to "
+ "connect.");
+ goto out;
+ }
- ret = dict_set_str (options, "remote-host",
- this->ctx->cmd_args.volfile_server);
- if (ret == -1) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_GET_FAILED, "Failed to set the "
- "remote host");
- goto out;
- }
+ ret = dict_set_str(options, "remote-host",
+ this->ctx->cmd_args.volfile_server);
+ if (ret == -1) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_GET_FAILED,
+ "Failed to set the "
+ "remote host");
+ goto out;
}
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-build_client_config (xlator_t *this, clnt_conf_t *conf)
+build_client_config(xlator_t *this, clnt_conf_t *conf)
{
- int ret = -1;
+ int ret = -1;
- if (!conf)
- goto out;
+ if (!conf)
+ goto out;
- GF_OPTION_INIT ("frame-timeout", conf->rpc_conf.rpc_timeout,
- int32, out);
+ GF_OPTION_INIT("frame-timeout", conf->rpc_conf.rpc_timeout, int32, out);
- GF_OPTION_INIT ("remote-port", conf->rpc_conf.remote_port,
- int32, out);
+ GF_OPTION_INIT("remote-port", conf->rpc_conf.remote_port, int32, out);
- GF_OPTION_INIT ("ping-timeout", conf->opt.ping_timeout,
- int32, out);
+ GF_OPTION_INIT("ping-timeout", conf->opt.ping_timeout, int32, out);
- GF_OPTION_INIT ("remote-subvolume", conf->opt.remote_subvolume,
- path, out);
- if (!conf->opt.remote_subvolume)
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY,
- "option 'remote-subvolume' not given");
+ GF_OPTION_INIT("remote-subvolume", conf->opt.remote_subvolume, path, out);
+ if (!conf->opt.remote_subvolume)
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "option 'remote-subvolume' not given");
- GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct,
- bool, out);
+ GF_OPTION_INIT("filter-O_DIRECT", conf->filter_o_direct, bool, out);
- GF_OPTION_INIT ("send-gids", conf->send_gids, bool, out);
+ GF_OPTION_INIT("send-gids", conf->send_gids, bool, out);
- conf->client_id = glusterfs_leaf_position(this);
+ conf->client_id = glusterfs_leaf_position(this);
- ret = client_check_remote_host (this, this->options);
- if (ret)
- goto out;
+ ret = client_check_remote_host(this, this->options);
+ if (ret)
+ goto out;
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
int32_t
-mem_acct_init (xlator_t *this)
+mem_acct_init(xlator_t *this)
{
- int ret = -1;
+ int ret = -1;
- if (!this)
- return ret;
+ if (!this)
+ return ret;
- ret = xlator_mem_acct_init (this, gf_client_mt_end + 1);
-
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
- "Memory accounting init failed");
- return ret;
- }
+ ret = xlator_mem_acct_init(this, gf_client_mt_end + 1);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
+ "Memory accounting init failed");
return ret;
+ }
+
+ return ret;
}
int
-client_destroy_rpc (xlator_t *this)
+client_destroy_rpc(xlator_t *this)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- if (conf->rpc) {
- /* cleanup the saved-frames before last unref */
- rpc_clnt_connection_cleanup (&conf->rpc->conn);
+ if (conf->rpc) {
+ /* cleanup the saved-frames before last unref */
+ rpc_clnt_connection_cleanup(&conf->rpc->conn);
- conf->rpc = rpc_clnt_unref (conf->rpc);
- ret = 0;
- gf_msg_debug (this->name, 0,
- "Client rpc conn destroyed");
- goto out;
- }
+ conf->rpc = rpc_clnt_unref(conf->rpc);
+ ret = 0;
+ gf_msg_debug(this->name, 0, "Client rpc conn destroyed");
+ goto out;
+ }
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL,
- "RPC destroy called on already destroyed "
- "connection");
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL,
+ "RPC destroy called on already destroyed "
+ "connection");
out:
- return ret;
+ return ret;
}
int
-client_init_rpc (xlator_t *this)
+client_init_rpc(xlator_t *this)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
+ conf = this->private;
- if (conf->rpc) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_RPC_INITED_ALREADY, "client rpc already "
- "init'ed");
- ret = -1;
- goto out;
- }
+ if (conf->rpc) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INITED_ALREADY,
+ "client rpc already "
+ "init'ed");
+ ret = -1;
+ goto out;
+ }
- conf->rpc = rpc_clnt_new (this->options, this, this->name, 0);
- if (!conf->rpc) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED,
- "failed to initialize RPC");
- goto out;
- }
+ conf->rpc = rpc_clnt_new(this->options, this, this->name, 0);
+ if (!conf->rpc) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED,
+ "failed to initialize RPC");
+ goto out;
+ }
- ret = rpc_clnt_register_notify (conf->rpc, client_rpc_notify, this);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED,
- "failed to register notify");
- goto out;
- }
+ ret = rpc_clnt_register_notify(conf->rpc, client_rpc_notify, this);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED,
+ "failed to register notify");
+ goto out;
+ }
- conf->handshake = &clnt_handshake_prog;
- conf->dump = &clnt_dump_prog;
+ conf->handshake = &clnt_handshake_prog;
+ conf->dump = &clnt_dump_prog;
- ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog,
- this);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED,
- "failed to register callback program");
- goto out;
- }
+ ret = rpcclnt_cbk_program_register(conf->rpc, &gluster_cbk_prog, this);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED,
+ "failed to register callback program");
+ goto out;
+ }
- ret = 0;
+ ret = 0;
- gf_msg_debug (this->name, 0, "client init successful");
+ gf_msg_debug(this->name, 0, "client init successful");
out:
- return ret;
+ return ret;
}
int
-client_check_event_threads (xlator_t *this, clnt_conf_t *conf, int32_t old,
- int32_t new)
+client_check_event_threads(xlator_t *this, clnt_conf_t *conf, int32_t old,
+ int32_t new)
{
- if (old == new)
- return 0;
+ if (old == new)
+ return 0;
- conf->event_threads = new;
- return event_reconfigure_threads (this->ctx->event_pool,
- conf->event_threads);
+ conf->event_threads = new;
+ return event_reconfigure_threads(this->ctx->event_pool,
+ conf->event_threads);
}
int
-reconfigure (xlator_t *this, dict_t *options)
-{
- clnt_conf_t *conf = NULL;
- int ret = -1;
- int subvol_ret = 0;
- char *old_remote_subvol = NULL;
- char *new_remote_subvol = NULL;
- char *old_remote_host = NULL;
- char *new_remote_host = NULL;
- int32_t new_nthread = 0;
- struct rpc_clnt_config rpc_config = {0,};
-
- conf = this->private;
-
- GF_OPTION_RECONF ("frame-timeout", conf->rpc_conf.rpc_timeout,
- options, int32, out);
-
- GF_OPTION_RECONF ("ping-timeout", rpc_config.ping_timeout,
- options, int32, out);
-
- GF_OPTION_RECONF ("event-threads", new_nthread, options,
- int32, out);
- ret = client_check_event_threads (this, conf, conf->event_threads,
- new_nthread);
- if (ret)
- goto out;
-
- ret = client_check_remote_host (this, options);
- if (ret)
- goto out;
-
- subvol_ret = dict_get_str (this->options, "remote-host",
- &old_remote_host);
-
+reconfigure(xlator_t *this, dict_t *options)
+{
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+ int subvol_ret = 0;
+ char *old_remote_subvol = NULL;
+ char *new_remote_subvol = NULL;
+ char *old_remote_host = NULL;
+ char *new_remote_host = NULL;
+ int32_t new_nthread = 0;
+ struct rpc_clnt_config rpc_config = {
+ 0,
+ };
+
+ conf = this->private;
+
+ GF_OPTION_RECONF("frame-timeout", conf->rpc_conf.rpc_timeout, options,
+ int32, out);
+
+ GF_OPTION_RECONF("ping-timeout", rpc_config.ping_timeout, options, int32,
+ out);
+
+ GF_OPTION_RECONF("event-threads", new_nthread, options, int32, out);
+ ret = client_check_event_threads(this, conf, conf->event_threads,
+ new_nthread);
+ if (ret)
+ goto out;
+
+ ret = client_check_remote_host(this, options);
+ if (ret)
+ goto out;
+
+ subvol_ret = dict_get_str(this->options, "remote-host", &old_remote_host);
+
+ if (subvol_ret == 0) {
+ subvol_ret = dict_get_str(options, "remote-host", &new_remote_host);
if (subvol_ret == 0) {
- subvol_ret = dict_get_str (options, "remote-host",
- &new_remote_host);
- if (subvol_ret == 0) {
- if (strcmp (old_remote_host, new_remote_host)) {
- ret = 1;
- goto out;
- }
- }
+ if (strcmp(old_remote_host, new_remote_host)) {
+ ret = 1;
+ goto out;
+ }
}
+ }
- subvol_ret = dict_get_str (this->options, "remote-subvolume",
- &old_remote_subvol);
+ subvol_ret = dict_get_str(this->options, "remote-subvolume",
+ &old_remote_subvol);
+ if (subvol_ret == 0) {
+ subvol_ret = dict_get_str(options, "remote-subvolume",
+ &new_remote_subvol);
if (subvol_ret == 0) {
- subvol_ret = dict_get_str (options, "remote-subvolume",
- &new_remote_subvol);
- if (subvol_ret == 0) {
- if (strcmp (old_remote_subvol, new_remote_subvol)) {
- ret = 1;
- goto out;
- }
- }
+ if (strcmp(old_remote_subvol, new_remote_subvol)) {
+ ret = 1;
+ goto out;
+ }
}
+ }
- /* Reconfiguring client xlator's @rpc with new frame-timeout
- * and ping-timeout */
- rpc_clnt_reconfig (conf->rpc, &rpc_config);
+ /* Reconfiguring client xlator's @rpc with new frame-timeout
+ * and ping-timeout */
+ rpc_clnt_reconfig(conf->rpc, &rpc_config);
- GF_OPTION_RECONF ("filter-O_DIRECT", conf->filter_o_direct,
- options, bool, out);
+ GF_OPTION_RECONF("filter-O_DIRECT", conf->filter_o_direct, options, bool,
+ out);
- GF_OPTION_RECONF ("send-gids", conf->send_gids, options, bool, out);
+ GF_OPTION_RECONF("send-gids", conf->send_gids, options, bool, out);
- ret = 0;
+ ret = 0;
out:
- return ret;
-
+ return ret;
}
-
int
-init (xlator_t *this)
+init(xlator_t *this)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- if (this->children) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_INVALID_ENTRY, "FATAL: client protocol "
- "translator cannot have any subvolumes");
- goto out;
- }
+ if (this->children) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
+ "FATAL: client protocol "
+ "translator cannot have any subvolumes");
+ goto out;
+ }
- if (!this->parents) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Volume is dangling. ");
- }
+ if (!this->parents) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Volume is dangling. ");
+ }
- conf = GF_CALLOC (1, sizeof (*conf), gf_client_mt_clnt_conf_t);
- if (!conf)
- goto out;
+ conf = GF_CALLOC(1, sizeof(*conf), gf_client_mt_clnt_conf_t);
+ if (!conf)
+ goto out;
- pthread_mutex_init (&conf->lock, NULL);
- pthread_spin_init (&conf->fd_lock, 0);
- INIT_LIST_HEAD (&conf->saved_fds);
+ pthread_mutex_init(&conf->lock, NULL);
+ pthread_spin_init(&conf->fd_lock, 0);
+ INIT_LIST_HEAD(&conf->saved_fds);
- conf->child_up = _gf_false;
+ conf->child_up = _gf_false;
- /* Set event threads to the configured default */
- GF_OPTION_INIT("event-threads", conf->event_threads, int32, out);
- ret = client_check_event_threads (this, conf, STARTING_EVENT_THREADS,
- conf->event_threads);
- if (ret)
- goto out;
+ /* Set event threads to the configured default */
+ GF_OPTION_INIT("event-threads", conf->event_threads, int32, out);
+ ret = client_check_event_threads(this, conf, STARTING_EVENT_THREADS,
+ conf->event_threads);
+ if (ret)
+ goto out;
- LOCK_INIT (&conf->rec_lock);
+ LOCK_INIT(&conf->rec_lock);
- conf->last_sent_event = -1; /* To start with we don't have any events */
+ conf->last_sent_event = -1; /* To start with we don't have any events */
- this->private = conf;
+ this->private = conf;
- /* If it returns -1, then its a failure, if it returns +1 we need
- have to understand that 'this' is subvolume of a xlator which,
- will set the remote host and remote subvolume in a setxattr
- call.
- */
+ /* If it returns -1, then its a failure, if it returns +1 we need
+ have to understand that 'this' is subvolume of a xlator which,
+ will set the remote host and remote subvolume in a setxattr
+ call.
+ */
- ret = build_client_config (this, conf);
- if (ret == -1)
- goto out;
+ ret = build_client_config(this, conf);
+ if (ret == -1)
+ goto out;
- if (ret) {
- ret = 0;
- goto out;
- }
+ if (ret) {
+ ret = 0;
+ goto out;
+ }
- this->local_pool = mem_pool_new (clnt_local_t, 64);
- if (!this->local_pool) {
- ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
- "failed to create local_t's memory pool");
- goto out;
- }
+ this->local_pool = mem_pool_new(clnt_local_t, 64);
+ if (!this->local_pool) {
+ ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
+ "failed to create local_t's memory pool");
+ goto out;
+ }
- ret = client_init_rpc (this);
+ ret = client_init_rpc(this);
out:
- if (ret)
- this->fini (this);
+ if (ret)
+ this->fini(this);
- return ret;
+ return ret;
}
void
-fini (xlator_t *this)
+fini(xlator_t *this)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
- if (!conf)
- return;
+ conf = this->private;
+ if (!conf)
+ return;
- conf->destroy = 1;
- if (conf->rpc) {
- /* cleanup the saved-frames before last unref */
- rpc_clnt_connection_cleanup (&conf->rpc->conn);
- rpc_clnt_unref (conf->rpc);
- }
+ conf->destroy = 1;
+ if (conf->rpc) {
+ /* cleanup the saved-frames before last unref */
+ rpc_clnt_connection_cleanup(&conf->rpc->conn);
+ rpc_clnt_unref(conf->rpc);
+ }
- /* Saved Fds */
- /* TODO: */
+ /* Saved Fds */
+ /* TODO: */
- return;
+ return;
}
static void
-client_fd_lk_ctx_dump (xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd)
-{
- gf_boolean_t use_try_lock = _gf_true;
- int ret = -1;
- int lock_no = 0;
- fd_lk_ctx_t *lk_ctx_ref = NULL;
- fd_lk_ctx_node_t *plock = NULL;
- char key[GF_DUMP_MAX_BUF_LEN] = {0,};
-
- lk_ctx_ref = fd_lk_ctx_ref (lk_ctx);
- if (!lk_ctx_ref)
- return;
-
- ret = client_fd_lk_list_empty (lk_ctx_ref, (use_try_lock = _gf_true));
- if (ret != 0)
- return;
-
- ret = TRY_LOCK (&lk_ctx_ref->lock);
- if (ret)
- return;
-
- gf_proc_dump_write ("------","------");
-
- lock_no = 0;
- list_for_each_entry (plock, &lk_ctx_ref->lk_list, next) {
- snprintf (key, sizeof (key), "granted-posix-lock[%d]",
- lock_no++);
- gf_proc_dump_write (key, "owner = %s, cmd = %s "
- "fl_type = %s, fl_start = %"
- PRId64", fl_end = %"PRId64
- ", user_flock: l_type = %s, "
- "l_start = %"PRId64", l_len = %"PRId64,
- lkowner_utoa (&plock->user_flock.l_owner),
- get_lk_cmd (plock->cmd),
- get_lk_type (plock->fl_type),
- plock->fl_start, plock->fl_end,
- get_lk_type (plock->user_flock.l_type),
- plock->user_flock.l_start,
- plock->user_flock.l_len);
- }
- gf_proc_dump_write ("------","------");
+client_fd_lk_ctx_dump(xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd)
+{
+ gf_boolean_t use_try_lock = _gf_true;
+ int ret = -1;
+ int lock_no = 0;
+ fd_lk_ctx_t *lk_ctx_ref = NULL;
+ fd_lk_ctx_node_t *plock = NULL;
+ char key[GF_DUMP_MAX_BUF_LEN] = {
+ 0,
+ };
+
+ lk_ctx_ref = fd_lk_ctx_ref(lk_ctx);
+ if (!lk_ctx_ref)
+ return;
+
+ ret = client_fd_lk_list_empty(lk_ctx_ref, (use_try_lock = _gf_true));
+ if (ret != 0)
+ return;
- UNLOCK (&lk_ctx_ref->lock);
- fd_lk_ctx_unref (lk_ctx_ref);
+ ret = TRY_LOCK(&lk_ctx_ref->lock);
+ if (ret)
+ return;
+ gf_proc_dump_write("------", "------");
+
+ lock_no = 0;
+ list_for_each_entry(plock, &lk_ctx_ref->lk_list, next)
+ {
+ snprintf(key, sizeof(key), "granted-posix-lock[%d]", lock_no++);
+ gf_proc_dump_write(
+ key,
+ "owner = %s, cmd = %s "
+ "fl_type = %s, fl_start = %" PRId64 ", fl_end = %" PRId64
+ ", user_flock: l_type = %s, "
+ "l_start = %" PRId64 ", l_len = %" PRId64,
+ lkowner_utoa(&plock->user_flock.l_owner), get_lk_cmd(plock->cmd),
+ get_lk_type(plock->fl_type), plock->fl_start, plock->fl_end,
+ get_lk_type(plock->user_flock.l_type), plock->user_flock.l_start,
+ plock->user_flock.l_len);
+ }
+ gf_proc_dump_write("------", "------");
+
+ UNLOCK(&lk_ctx_ref->lock);
+ fd_lk_ctx_unref(lk_ctx_ref);
}
int
-client_priv_dump (xlator_t *this)
-{
- clnt_conf_t *conf = NULL;
- int ret = -1;
- clnt_fd_ctx_t *tmp = NULL;
- int i = 0;
- char key[GF_DUMP_MAX_BUF_LEN];
- char key_prefix[GF_DUMP_MAX_BUF_LEN];
- rpc_clnt_connection_t *conn = NULL;
-
- if (!this)
- return -1;
-
- conf = this->private;
- if (!conf)
- return -1;
-
- ret = pthread_mutex_trylock(&conf->lock);
- if (ret)
- return -1;
-
- gf_proc_dump_build_key(key_prefix, "xlator.protocol.client",
- "%s.priv", this->name);
-
- gf_proc_dump_add_section(key_prefix);
-
- pthread_spin_lock (&conf->fd_lock);
- list_for_each_entry(tmp, &conf->saved_fds, sfd_pos) {
- sprintf (key, "fd.%d.remote_fd", i);
- gf_proc_dump_write(key, "%d", tmp->remote_fd);
- client_fd_lk_ctx_dump (this, tmp->lk_ctx, i);
- i++;
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- gf_proc_dump_write ("connected", "%d", conf->connected);
-
- if (conf->rpc) {
- conn = &conf->rpc->conn;
- gf_proc_dump_write("total_bytes_read", "%"PRIu64,
- conn->trans->total_bytes_read);
- gf_proc_dump_write("ping_timeout", "%"PRIu32,
- conn->ping_timeout);
- gf_proc_dump_write("total_bytes_written", "%"PRIu64,
- conn->trans->total_bytes_write);
- gf_proc_dump_write("ping_msgs_sent", "%"PRIu64,
- conn->pingcnt);
- gf_proc_dump_write("msgs_sent", "%"PRIu64,
- conn->msgcnt);
- }
- pthread_mutex_unlock(&conf->lock);
-
- return 0;
-
+client_priv_dump(xlator_t *this)
+{
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+ clnt_fd_ctx_t *tmp = NULL;
+ int i = 0;
+ char key[GF_DUMP_MAX_BUF_LEN];
+ char key_prefix[GF_DUMP_MAX_BUF_LEN];
+ rpc_clnt_connection_t *conn = NULL;
+
+ if (!this)
+ return -1;
+
+ conf = this->private;
+ if (!conf)
+ return -1;
+
+ ret = pthread_mutex_trylock(&conf->lock);
+ if (ret)
+ return -1;
+
+ gf_proc_dump_build_key(key_prefix, "xlator.protocol.client", "%s.priv",
+ this->name);
+
+ gf_proc_dump_add_section(key_prefix);
+
+ pthread_spin_lock(&conf->fd_lock);
+ list_for_each_entry(tmp, &conf->saved_fds, sfd_pos)
+ {
+ sprintf(key, "fd.%d.remote_fd", i);
+ gf_proc_dump_write(key, "%d", tmp->remote_fd);
+ client_fd_lk_ctx_dump(this, tmp->lk_ctx, i);
+ i++;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ gf_proc_dump_write("connected", "%d", conf->connected);
+
+ if (conf->rpc) {
+ conn = &conf->rpc->conn;
+ gf_proc_dump_write("total_bytes_read", "%" PRIu64,
+ conn->trans->total_bytes_read);
+ gf_proc_dump_write("ping_timeout", "%" PRIu32, conn->ping_timeout);
+ gf_proc_dump_write("total_bytes_written", "%" PRIu64,
+ conn->trans->total_bytes_write);
+ gf_proc_dump_write("ping_msgs_sent", "%" PRIu64, conn->pingcnt);
+ gf_proc_dump_write("msgs_sent", "%" PRIu64, conn->msgcnt);
+ }
+ pthread_mutex_unlock(&conf->lock);
+
+ return 0;
}
int32_t
-client_inodectx_dump (xlator_t *this, inode_t *inode)
+client_inodectx_dump(xlator_t *this, inode_t *inode)
{
- if (!inode)
- return -1;
+ if (!inode)
+ return -1;
- if (!this)
- return -1;
+ if (!this)
+ return -1;
- /*TODO*/
+ /*TODO*/
- return 0;
+ return 0;
}
-
-
-
-struct xlator_cbks cbks = {
- .forget = client_forget,
- .release = client_release,
- .releasedir = client_releasedir
-};
+struct xlator_cbks cbks = {.forget = client_forget,
+ .release = client_release,
+ .releasedir = client_releasedir};
struct xlator_fops fops = {
- .stat = client_stat,
- .readlink = client_readlink,
- .mknod = client_mknod,
- .mkdir = client_mkdir,
- .unlink = client_unlink,
- .rmdir = client_rmdir,
- .symlink = client_symlink,
- .rename = client_rename,
- .link = client_link,
- .truncate = client_truncate,
- .open = client_open,
- .readv = client_readv,
- .writev = client_writev,
- .statfs = client_statfs,
- .flush = client_flush,
- .fsync = client_fsync,
- .setxattr = client_setxattr,
- .getxattr = client_getxattr,
- .fsetxattr = client_fsetxattr,
- .fgetxattr = client_fgetxattr,
- .removexattr = client_removexattr,
- .fremovexattr = client_fremovexattr,
- .opendir = client_opendir,
- .readdir = client_readdir,
- .readdirp = client_readdirp,
- .fsyncdir = client_fsyncdir,
- .access = client_access,
- .ftruncate = client_ftruncate,
- .fstat = client_fstat,
- .create = client_create,
- .lk = client_lk,
- .inodelk = client_inodelk,
- .finodelk = client_finodelk,
- .entrylk = client_entrylk,
- .fentrylk = client_fentrylk,
- .lookup = client_lookup,
- .rchecksum = client_rchecksum,
- .xattrop = client_xattrop,
- .fxattrop = client_fxattrop,
- .setattr = client_setattr,
- .fsetattr = client_fsetattr,
- .fallocate = client_fallocate,
- .discard = client_discard,
- .zerofill = client_zerofill,
- .getspec = client_getspec,
- .ipc = client_ipc,
- .seek = client_seek,
- .lease = client_lease,
- .compound = client_compound,
- .getactivelk = client_getactivelk,
- .setactivelk = client_setactivelk,
- .icreate = client_icreate,
- .namelink = client_namelink,
- .put = client_put,
+ .stat = client_stat,
+ .readlink = client_readlink,
+ .mknod = client_mknod,
+ .mkdir = client_mkdir,
+ .unlink = client_unlink,
+ .rmdir = client_rmdir,
+ .symlink = client_symlink,
+ .rename = client_rename,
+ .link = client_link,
+ .truncate = client_truncate,
+ .open = client_open,
+ .readv = client_readv,
+ .writev = client_writev,
+ .statfs = client_statfs,
+ .flush = client_flush,
+ .fsync = client_fsync,
+ .setxattr = client_setxattr,
+ .getxattr = client_getxattr,
+ .fsetxattr = client_fsetxattr,
+ .fgetxattr = client_fgetxattr,
+ .removexattr = client_removexattr,
+ .fremovexattr = client_fremovexattr,
+ .opendir = client_opendir,
+ .readdir = client_readdir,
+ .readdirp = client_readdirp,
+ .fsyncdir = client_fsyncdir,
+ .access = client_access,
+ .ftruncate = client_ftruncate,
+ .fstat = client_fstat,
+ .create = client_create,
+ .lk = client_lk,
+ .inodelk = client_inodelk,
+ .finodelk = client_finodelk,
+ .entrylk = client_entrylk,
+ .fentrylk = client_fentrylk,
+ .lookup = client_lookup,
+ .rchecksum = client_rchecksum,
+ .xattrop = client_xattrop,
+ .fxattrop = client_fxattrop,
+ .setattr = client_setattr,
+ .fsetattr = client_fsetattr,
+ .fallocate = client_fallocate,
+ .discard = client_discard,
+ .zerofill = client_zerofill,
+ .getspec = client_getspec,
+ .ipc = client_ipc,
+ .seek = client_seek,
+ .lease = client_lease,
+ .compound = client_compound,
+ .getactivelk = client_getactivelk,
+ .setactivelk = client_setactivelk,
+ .icreate = client_icreate,
+ .namelink = client_namelink,
+ .put = client_put,
};
-
struct xlator_dumpops dumpops = {
- .priv = client_priv_dump,
- .inodectx = client_inodectx_dump,
+ .priv = client_priv_dump,
+ .inodectx = client_inodectx_dump,
};
-
struct volume_options options[] = {
- { .key = {"username"},
- .type = GF_OPTION_TYPE_ANY
- },
- { .key = {"password"},
- .type = GF_OPTION_TYPE_ANY
- },
- { .key = {"transport-type"},
- .value = {"tcp", "socket", "ib-verbs", "unix", "ib-sdp",
- "tcp/client", "ib-verbs/client", "rdma"},
- .type = GF_OPTION_TYPE_STR,
- .default_value = "tcp",
- },
- { .key = {"remote-host"},
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS,
- .default_value = "{{ brick.hostname }}"
- },
- { .key = {"remote-port"},
- .type = GF_OPTION_TYPE_INT,
- },
- { .key = {"remote-subvolume"},
- .type = GF_OPTION_TYPE_ANY,
- .default_value = "{{ brick.path }}"
- },
- { .key = {"frame-timeout",
- "rpc-timeout" },
- .type = GF_OPTION_TYPE_TIME,
- .min = 0,
- .max = 86400,
- .default_value = "1800",
- .description = "Time frame after which the (file) operation would be "
- "declared as dead, if the server does not respond for "
- "a particular (file) operation.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"ping-timeout"},
- .type = GF_OPTION_TYPE_TIME,
- .min = 0,
- .max = 1013,
- .default_value = "42",
- .description = "Time duration for which the client waits to "
- "check if the server is responsive.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"client-bind-insecure"},
- .type = GF_OPTION_TYPE_BOOL
- },
- { .key = {"tcp-window-size"},
- .type = GF_OPTION_TYPE_SIZET,
- .min = GF_MIN_SOCKET_WINDOW_SIZE,
- .max = GF_MAX_SOCKET_WINDOW_SIZE,
- .description = "Specifies the window size for tcp socket.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"filter-O_DIRECT"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "disable",
- .description = "If enabled, in open/creat/readv/writev fops, "
- "O_DIRECT flag will be filtered at the client protocol level so "
- "server will still continue to cache the file. This works similar to "
- "NFS's behavior of O_DIRECT. Anon-fds can choose to readv/writev "
- "using O_DIRECT",
- .op_version = {2},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"send-gids"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "on",
- .op_version = {GD_OP_VERSION_3_6_0},
- .flags = OPT_FLAG_SETTABLE
- },
- { .key = {"event-threads"},
- .type = GF_OPTION_TYPE_INT,
- .min = 1,
- .max = 32,
- .default_value = "2",
- .description = "Specifies the number of event threads to execute "
- "in parallel. Larger values would help process"
- " responses faster, depending on available processing"
- " power. Range 1-32 threads.",
- .op_version = {GD_OP_VERSION_3_7_0},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {NULL} },
+ {.key = {"username"}, .type = GF_OPTION_TYPE_ANY},
+ {.key = {"password"}, .type = GF_OPTION_TYPE_ANY},
+ {
+ .key = {"transport-type"},
+ .value = {"tcp", "socket", "ib-verbs", "unix", "ib-sdp", "tcp/client",
+ "ib-verbs/client", "rdma"},
+ .type = GF_OPTION_TYPE_STR,
+ .default_value = "tcp",
+ },
+ {.key = {"remote-host"},
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS,
+ .default_value = "{{ brick.hostname }}"},
+ {
+ .key = {"remote-port"},
+ .type = GF_OPTION_TYPE_INT,
+ },
+ {.key = {"remote-subvolume"},
+ .type = GF_OPTION_TYPE_ANY,
+ .default_value = "{{ brick.path }}"},
+ {.key = {"frame-timeout", "rpc-timeout"},
+ .type = GF_OPTION_TYPE_TIME,
+ .min = 0,
+ .max = 86400,
+ .default_value = "1800",
+ .description = "Time frame after which the (file) operation would be "
+ "declared as dead, if the server does not respond for "
+ "a particular (file) operation.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"ping-timeout"},
+ .type = GF_OPTION_TYPE_TIME,
+ .min = 0,
+ .max = 1013,
+ .default_value = "42",
+ .description = "Time duration for which the client waits to "
+ "check if the server is responsive.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"client-bind-insecure"}, .type = GF_OPTION_TYPE_BOOL},
+ {.key = {"tcp-window-size"},
+ .type = GF_OPTION_TYPE_SIZET,
+ .min = GF_MIN_SOCKET_WINDOW_SIZE,
+ .max = GF_MAX_SOCKET_WINDOW_SIZE,
+ .description = "Specifies the window size for tcp socket.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"filter-O_DIRECT"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "disable",
+ .description =
+ "If enabled, in open/creat/readv/writev fops, "
+ "O_DIRECT flag will be filtered at the client protocol level so "
+ "server will still continue to cache the file. This works similar to "
+ "NFS's behavior of O_DIRECT. Anon-fds can choose to readv/writev "
+ "using O_DIRECT",
+ .op_version = {2},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"send-gids"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .op_version = {GD_OP_VERSION_3_6_0},
+ .flags = OPT_FLAG_SETTABLE},
+ {.key = {"event-threads"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 1,
+ .max = 32,
+ .default_value = "2",
+ .description = "Specifies the number of event threads to execute "
+ "in parallel. Larger values would help process"
+ " responses faster, depending on available processing"
+ " power. Range 1-32 threads.",
+ .op_version = {GD_OP_VERSION_3_7_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {NULL}},
};
-
diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c
index 0d95b9a7ac9..c1229f9ebf3 100644
--- a/xlators/protocol/server/src/authenticate.c
+++ b/xlators/protocol/server/src/authenticate.c
@@ -8,8 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
-
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@@ -21,217 +19,214 @@
#include "server-messages.h"
static int
-init (dict_t *this, char *key, data_t *value, void *data)
+init(dict_t *this, char *key, data_t *value, void *data)
{
- void *handle = NULL;
- char *auth_file = NULL;
- auth_handle_t *auth_handle = NULL;
- auth_fn_t authenticate = NULL;
- int *error = NULL;
- int ret = 0;
-
- /* It gets over written */
- error = data;
-
- if (!strncasecmp (key, "ip", SLEN ("ip"))) {
- gf_msg ("authenticate", GF_LOG_ERROR, 0,
- PS_MSG_AUTHENTICATE_ERROR, "AUTHENTICATION MODULE "
- "\"IP\" HAS BEEN REPLACED BY \"ADDR\"");
- dict_set (this, key, data_from_dynptr (NULL, 0));
- /* TODO: 1.3.x backward compatibility */
- // *error = -1;
- // return;
- key = "addr";
- }
-
- ret = gf_asprintf (&auth_file, "%s/%s.so", LIBDIR, key);
- if (-1 == ret) {
- dict_set (this, key, data_from_dynptr (NULL, 0));
- *error = -1;
- return -1;
- }
-
- handle = dlopen (auth_file, RTLD_LAZY);
- if (!handle) {
- gf_msg ("authenticate", GF_LOG_ERROR, 0,
- PS_MSG_AUTHENTICATE_ERROR, "dlopen(%s): %s\n",
- auth_file, dlerror ());
- dict_set (this, key, data_from_dynptr (NULL, 0));
- GF_FREE (auth_file);
- *error = -1;
- return -1;
- }
- GF_FREE (auth_file);
-
- authenticate = dlsym (handle, "gf_auth");
- if (!authenticate) {
- gf_msg ("authenticate", GF_LOG_ERROR, 0,
- PS_MSG_AUTHENTICATE_ERROR, "dlsym(gf_auth) on %s\n",
- dlerror ());
- dict_set (this, key, data_from_dynptr (NULL, 0));
- dlclose (handle);
- *error = -1;
- return -1;
- }
-
- auth_handle = GF_CALLOC (1, sizeof (*auth_handle),
- gf_common_mt_auth_handle_t);
- if (!auth_handle) {
- dict_set (this, key, data_from_dynptr (NULL, 0));
- *error = -1;
- dlclose (handle);
- return -1;
- }
- auth_handle->vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
- gf_common_mt_volume_opt_list_t);
- if (!auth_handle->vol_opt) {
- dict_set (this, key, data_from_dynptr (NULL, 0));
- *error = -1;
- GF_FREE (auth_handle);
- dlclose (handle);
- return -1;
- }
- auth_handle->vol_opt->given_opt = dlsym (handle, "options");
- if (auth_handle->vol_opt->given_opt == NULL) {
- gf_msg_debug ("authenticate", 0, "volume option validation "
- "not specified");
- }
-
- auth_handle->authenticate = authenticate;
- auth_handle->handle = handle;
-
- dict_set (this, key,
- data_from_dynptr (auth_handle, sizeof (*auth_handle)));
- return 0;
+ void *handle = NULL;
+ char *auth_file = NULL;
+ auth_handle_t *auth_handle = NULL;
+ auth_fn_t authenticate = NULL;
+ int *error = NULL;
+ int ret = 0;
+
+ /* It gets over written */
+ error = data;
+
+ if (!strncasecmp(key, "ip", SLEN("ip"))) {
+ gf_msg("authenticate", GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
+ "AUTHENTICATION MODULE "
+ "\"IP\" HAS BEEN REPLACED BY \"ADDR\"");
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ /* TODO: 1.3.x backward compatibility */
+ // *error = -1;
+ // return;
+ key = "addr";
+ }
+
+ ret = gf_asprintf(&auth_file, "%s/%s.so", LIBDIR, key);
+ if (-1 == ret) {
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ *error = -1;
+ return -1;
+ }
+
+ handle = dlopen(auth_file, RTLD_LAZY);
+ if (!handle) {
+ gf_msg("authenticate", GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
+ "dlopen(%s): %s\n", auth_file, dlerror());
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ GF_FREE(auth_file);
+ *error = -1;
+ return -1;
+ }
+ GF_FREE(auth_file);
+
+ authenticate = dlsym(handle, "gf_auth");
+ if (!authenticate) {
+ gf_msg("authenticate", GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
+ "dlsym(gf_auth) on %s\n", dlerror());
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ dlclose(handle);
+ *error = -1;
+ return -1;
+ }
+
+ auth_handle = GF_CALLOC(1, sizeof(*auth_handle),
+ gf_common_mt_auth_handle_t);
+ if (!auth_handle) {
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ *error = -1;
+ dlclose(handle);
+ return -1;
+ }
+ auth_handle->vol_opt = GF_CALLOC(1, sizeof(volume_opt_list_t),
+ gf_common_mt_volume_opt_list_t);
+ if (!auth_handle->vol_opt) {
+ dict_set(this, key, data_from_dynptr(NULL, 0));
+ *error = -1;
+ GF_FREE(auth_handle);
+ dlclose(handle);
+ return -1;
+ }
+ auth_handle->vol_opt->given_opt = dlsym(handle, "options");
+ if (auth_handle->vol_opt->given_opt == NULL) {
+ gf_msg_debug("authenticate", 0,
+ "volume option validation "
+ "not specified");
+ }
+
+ auth_handle->authenticate = authenticate;
+ auth_handle->handle = handle;
+
+ dict_set(this, key, data_from_dynptr(auth_handle, sizeof(*auth_handle)));
+ return 0;
}
static int
-fini (dict_t *this, char *key, data_t *value, void *data)
+fini(dict_t *this, char *key, data_t *value, void *data)
{
- auth_handle_t *handle = data_to_ptr (value);
- if (handle) {
- dlclose (handle->handle);
- }
- return 0;
+ auth_handle_t *handle = data_to_ptr(value);
+ if (handle) {
+ dlclose(handle->handle);
+ }
+ return 0;
}
static int
-_gf_auth_option_validate (dict_t *d, char *k, data_t *v, void *tmp)
+_gf_auth_option_validate(dict_t *d, char *k, data_t *v, void *tmp)
{
- auth_handle_t *handle = NULL;
- xlator_t *xl = NULL;
- int ret = 0;
+ auth_handle_t *handle = NULL;
+ xlator_t *xl = NULL;
+ int ret = 0;
- xl = tmp;
+ xl = tmp;
- handle = data_to_ptr (v);
- if (!handle)
- return 0;
+ handle = data_to_ptr(v);
+ if (!handle)
+ return 0;
- list_add_tail (&(handle->vol_opt->list), &(xl->volume_options));
+ list_add_tail(&(handle->vol_opt->list), &(xl->volume_options));
- ret = xlator_options_validate_list (xl, xl->options,
- handle->vol_opt, NULL);
- if (ret) {
- gf_msg ("authenticate", GF_LOG_ERROR, 0,
- PS_MSG_VOL_VALIDATE_FAILED, "volume option validation "
- "failed");
- return -1;
- }
- return 0;
+ ret = xlator_options_validate_list(xl, xl->options, handle->vol_opt, NULL);
+ if (ret) {
+ gf_msg("authenticate", GF_LOG_ERROR, 0, PS_MSG_VOL_VALIDATE_FAILED,
+ "volume option validation "
+ "failed");
+ return -1;
+ }
+ return 0;
}
int32_t
-gf_auth_init (xlator_t *xl, dict_t *auth_modules)
+gf_auth_init(xlator_t *xl, dict_t *auth_modules)
{
- int ret = 0;
+ int ret = 0;
- dict_foreach (auth_modules, init, &ret);
- if (ret)
- goto out;
+ dict_foreach(auth_modules, init, &ret);
+ if (ret)
+ goto out;
- ret = dict_foreach (auth_modules, _gf_auth_option_validate, xl);
+ ret = dict_foreach(auth_modules, _gf_auth_option_validate, xl);
out:
- if (ret) {
- gf_msg (xl->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
- "authentication init failed");
- dict_foreach (auth_modules, fini, &ret);
- ret = -1;
- }
- return ret;
+ if (ret) {
+ gf_msg(xl->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
+ "authentication init failed");
+ dict_foreach(auth_modules, fini, &ret);
+ ret = -1;
+ }
+ return ret;
}
typedef struct {
- dict_t *iparams;
- dict_t *cparams;
- int64_t result;
+ dict_t *iparams;
+ dict_t *cparams;
+ int64_t result;
} gf_auth_args_t;
static int
-gf_auth_one_method (dict_t *this, char *key, data_t *value, void *data)
+gf_auth_one_method(dict_t *this, char *key, data_t *value, void *data)
{
- gf_auth_args_t *args = data;
- auth_handle_t *handle = NULL;
+ gf_auth_args_t *args = data;
+ auth_handle_t *handle = NULL;
- if (!value) {
- return 0;
- }
+ if (!value) {
+ return 0;
+ }
- handle = data_to_ptr (value);
- if (!handle || !handle->authenticate) {
- return 0;
- }
+ handle = data_to_ptr(value);
+ if (!handle || !handle->authenticate) {
+ return 0;
+ }
- switch (handle->authenticate (args->iparams, args->cparams)) {
+ switch (handle->authenticate(args->iparams, args->cparams)) {
case AUTH_ACCEPT:
- if (args->result != AUTH_REJECT) {
- args->result = AUTH_ACCEPT;
- }
- /* FALLTHROUGH */
+ if (args->result != AUTH_REJECT) {
+ args->result = AUTH_ACCEPT;
+ }
+ /* FALLTHROUGH */
default:
- return 0;
+ return 0;
case AUTH_REJECT:
- args->result = AUTH_REJECT;
- return -1;
- }
+ args->result = AUTH_REJECT;
+ return -1;
+ }
}
auth_result_t
-gf_authenticate (dict_t *input_params,
- dict_t *config_params,
- dict_t *auth_modules)
+gf_authenticate(dict_t *input_params, dict_t *config_params,
+ dict_t *auth_modules)
{
- char *name = NULL;
- data_t *peerinfo_data = NULL;
- gf_auth_args_t args;
-
- args.iparams = input_params;
- args.cparams = config_params;
- args.result = AUTH_DONT_CARE;
+ char *name = NULL;
+ data_t *peerinfo_data = NULL;
+ gf_auth_args_t args;
- dict_foreach (auth_modules, gf_auth_one_method, &args);
+ args.iparams = input_params;
+ args.cparams = config_params;
+ args.result = AUTH_DONT_CARE;
- if (AUTH_DONT_CARE == args.result) {
- peerinfo_data = dict_get (input_params, "peer-info-name");
+ dict_foreach(auth_modules, gf_auth_one_method, &args);
- if (peerinfo_data) {
- name = peerinfo_data->data;
- }
+ if (AUTH_DONT_CARE == args.result) {
+ peerinfo_data = dict_get(input_params, "peer-info-name");
- gf_msg ("auth", GF_LOG_ERROR, 0, PS_MSG_REMOTE_CLIENT_REFUSED,
- "no authentication module is interested in "
- "accepting remote-client %s", name);
- args.result = AUTH_REJECT;
+ if (peerinfo_data) {
+ name = peerinfo_data->data;
}
- return args.result;
+ gf_msg("auth", GF_LOG_ERROR, 0, PS_MSG_REMOTE_CLIENT_REFUSED,
+ "no authentication module is interested in "
+ "accepting remote-client %s",
+ name);
+ args.result = AUTH_REJECT;
+ }
+
+ return args.result;
}
void
-gf_auth_fini (dict_t *auth_modules)
+gf_auth_fini(dict_t *auth_modules)
{
- int32_t dummy;
+ int32_t dummy;
- dict_foreach (auth_modules, fini, &dummy);
+ dict_foreach(auth_modules, fini, &dummy);
}
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c
index 071a1cf2714..b5d61edccfb 100644
--- a/xlators/protocol/server/src/server-common.c
+++ b/xlators/protocol/server/src/server-common.c
@@ -11,871 +11,839 @@
#include "xdr-nfs3.h"
void
-server_post_stat (server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
-{
- if (state->client->subdir_mount &&
- !gf_uuid_compare (stbuf->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
-
- gfid[15] = 1;
- stbuf->ia_ino = 1;
- gf_uuid_copy (stbuf->ia_gfid, gfid);
- }
+server_post_stat(server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
+{
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare(stbuf->ia_gfid, state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {
+ 0,
+ };
+
+ gfid[15] = 1;
+ stbuf->ia_ino = 1;
+ gf_uuid_copy(stbuf->ia_gfid, gfid);
+ }
- gf_stat_from_iatt (&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
}
void
-server_post_readlink (gfs3_readlink_rsp *rsp, struct iatt *stbuf,
- const char *buf)
+server_post_readlink(gfs3_readlink_rsp *rsp, struct iatt *stbuf,
+ const char *buf)
{
- gf_stat_from_iatt (&rsp->buf, stbuf);
- rsp->path = (char *)buf;
+ gf_stat_from_iatt(&rsp->buf, stbuf);
+ rsp->path = (char *)buf;
}
void
-server_post_mknod (server_state_t *state, gfs3_mknod_rsp *rsp,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, inode_t *inode)
+server_post_mknod(server_state_t *state, gfs3_mknod_rsp *rsp,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, inode_t *inode)
{
- inode_t *link_inode = NULL;
+ inode_t *link_inode = NULL;
- gf_stat_from_iatt (&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
void
-server_post_mkdir (server_state_t *state, gfs3_mkdir_rsp *rsp,
- inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_post_mkdir(server_state_t *state, gfs3_mkdir_rsp *rsp, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- inode_t *link_inode = NULL;
-
- gf_stat_from_iatt (&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ inode_t *link_inode = NULL;
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
void
-server_post_unlink (server_state_t *state, gfs3_unlink_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent)
+server_post_unlink(server_state_t *state, gfs3_unlink_rsp *rsp,
+ struct iatt *preparent, struct iatt *postparent)
{
- inode_unlink (state->loc.inode, state->loc.parent,
- state->loc.name);
+ inode_unlink(state->loc.inode, state->loc.parent, state->loc.name);
- forget_inode_if_no_dentry (state->loc.inode);
-
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ forget_inode_if_no_dentry(state->loc.inode);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
}
void
-server_post_rmdir (server_state_t *state, gfs3_rmdir_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent)
+server_post_rmdir(server_state_t *state, gfs3_rmdir_rsp *rsp,
+ struct iatt *preparent, struct iatt *postparent)
{
- inode_unlink (state->loc.inode, state->loc.parent,
- state->loc.name);
- /* parent should not be found for directories after
- * inode_unlink, since directories cannot have
- * hardlinks.
- */
- forget_inode_if_no_dentry (state->loc.inode);
+ inode_unlink(state->loc.inode, state->loc.parent, state->loc.name);
+ /* parent should not be found for directories after
+ * inode_unlink, since directories cannot have
+ * hardlinks.
+ */
+ forget_inode_if_no_dentry(state->loc.inode);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
}
void
-server_post_symlink (server_state_t *state, gfs3_symlink_rsp *rsp,
- inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_post_symlink(server_state_t *state, gfs3_symlink_rsp *rsp,
+ inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- inode_t *link_inode = NULL;
-
- gf_stat_from_iatt (&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ inode_t *link_inode = NULL;
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
void
-server_post_link (server_state_t *state, gfs3_link_rsp *rsp,
- inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_post_link(server_state_t *state, gfs3_link_rsp *rsp, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- inode_t *link_inode = NULL;
-
- gf_stat_from_iatt (&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ inode_t *link_inode = NULL;
- link_inode = inode_link (inode, state->loc2.parent,
- state->loc2.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
+ link_inode = inode_link(inode, state->loc2.parent, state->loc2.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
void
-server_post_truncate (gfs3_truncate_rsp *rsp, struct iatt *prebuf,
- struct iatt *postbuf)
+server_post_truncate(gfs3_truncate_rsp *rsp, struct iatt *prebuf,
+ struct iatt *postbuf)
{
- gf_stat_from_iatt (&rsp->prestat, prebuf);
- gf_stat_from_iatt (&rsp->poststat, postbuf);
+ gf_stat_from_iatt(&rsp->prestat, prebuf);
+ gf_stat_from_iatt(&rsp->poststat, postbuf);
}
void
-server_post_writev (gfs3_write_rsp *rsp, struct iatt *prebuf,
- struct iatt *postbuf)
+server_post_writev(gfs3_write_rsp *rsp, struct iatt *prebuf,
+ struct iatt *postbuf)
{
- gf_stat_from_iatt (&rsp->prestat, prebuf);
- gf_stat_from_iatt (&rsp->poststat, postbuf);
+ gf_stat_from_iatt(&rsp->prestat, prebuf);
+ gf_stat_from_iatt(&rsp->poststat, postbuf);
}
void
-server_post_statfs (gfs3_statfs_rsp *rsp, struct statvfs *stbuf)
+server_post_statfs(gfs3_statfs_rsp *rsp, struct statvfs *stbuf)
{
- gf_statfs_from_statfs (&rsp->statfs, stbuf);
+ gf_statfs_from_statfs(&rsp->statfs, stbuf);
}
void
-server_post_fsync (gfs3_fsync_rsp *rsp, struct iatt *prebuf,
- struct iatt *postbuf)
+server_post_fsync(gfs3_fsync_rsp *rsp, struct iatt *prebuf,
+ struct iatt *postbuf)
{
- gf_stat_from_iatt (&rsp->prestat, prebuf);
- gf_stat_from_iatt (&rsp->poststat, postbuf);
+ gf_stat_from_iatt(&rsp->prestat, prebuf);
+ gf_stat_from_iatt(&rsp->poststat, postbuf);
}
void
-server_post_ftruncate (gfs3_ftruncate_rsp *rsp, struct iatt *prebuf,
+server_post_ftruncate(gfs3_ftruncate_rsp *rsp, struct iatt *prebuf,
struct iatt *postbuf)
{
- gf_stat_from_iatt (&rsp->prestat, prebuf);
- gf_stat_from_iatt (&rsp->poststat, postbuf);
+ gf_stat_from_iatt(&rsp->prestat, prebuf);
+ gf_stat_from_iatt(&rsp->poststat, postbuf);
}
void
-server_post_fstat (server_state_t *state, gfs3_fstat_rsp *rsp,
- struct iatt *stbuf)
+server_post_fstat(server_state_t *state, gfs3_fstat_rsp *rsp,
+ struct iatt *stbuf)
{
- if (state->client->subdir_mount &&
- !gf_uuid_compare (stbuf->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare(stbuf->ia_gfid, state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {
+ 0,
+ };
- gfid[15] = 1;
- stbuf->ia_ino = 1;
- gf_uuid_copy (stbuf->ia_gfid, gfid);
- }
+ gfid[15] = 1;
+ stbuf->ia_ino = 1;
+ gf_uuid_copy(stbuf->ia_gfid, gfid);
+ }
- gf_stat_from_iatt (&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
}
void
-server_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock)
+server_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock)
{
- switch (lock->l_type) {
+ switch (lock->l_type) {
case F_RDLCK:
- lock->l_type = GF_LK_F_RDLCK;
- break;
+ lock->l_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- lock->l_type = GF_LK_F_WRLCK;
- break;
+ lock->l_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- lock->l_type = GF_LK_F_UNLCK;
- break;
+ lock->l_type = GF_LK_F_UNLCK;
+ break;
default:
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
- "Unknown lock type: %"PRId32"!", lock->l_type);
- break;
- }
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
+ "Unknown lock type: %" PRId32 "!", lock->l_type);
+ break;
+ }
- gf_proto_flock_from_flock (&rsp->flock, lock);
+ gf_proto_flock_from_flock(&rsp->flock, lock);
}
int
-server_post_readdir (gfs3_readdir_rsp *rsp, gf_dirent_t *entries)
+server_post_readdir(gfs3_readdir_rsp *rsp, gf_dirent_t *entries)
{
- int ret = 0;
+ int ret = 0;
- ret = serialize_rsp_dirent (entries, rsp);
+ ret = serialize_rsp_dirent(entries, rsp);
- return ret;
+ return ret;
}
void
-server_post_zerofill (gfs3_zerofill_rsp *rsp, struct iatt *statpre,
- struct iatt *statpost)
+server_post_zerofill(gfs3_zerofill_rsp *rsp, struct iatt *statpre,
+ struct iatt *statpost)
{
- gf_stat_from_iatt (&rsp->statpre, statpre);
- gf_stat_from_iatt (&rsp->statpost, statpost);
+ gf_stat_from_iatt(&rsp->statpre, statpre);
+ gf_stat_from_iatt(&rsp->statpost, statpost);
}
void
-server_post_discard (gfs3_discard_rsp *rsp, struct iatt *statpre,
- struct iatt *statpost)
+server_post_discard(gfs3_discard_rsp *rsp, struct iatt *statpre,
+ struct iatt *statpost)
{
- gf_stat_from_iatt (&rsp->statpre, statpre);
- gf_stat_from_iatt (&rsp->statpost, statpost);
+ gf_stat_from_iatt(&rsp->statpre, statpre);
+ gf_stat_from_iatt(&rsp->statpost, statpost);
}
void
-server_post_fallocate (gfs3_fallocate_rsp *rsp, struct iatt *statpre,
- struct iatt *statpost)
+server_post_fallocate(gfs3_fallocate_rsp *rsp, struct iatt *statpre,
+ struct iatt *statpost)
{
- gf_stat_from_iatt (&rsp->statpre, statpre);
- gf_stat_from_iatt (&rsp->statpost, statpost);
+ gf_stat_from_iatt(&rsp->statpre, statpre);
+ gf_stat_from_iatt(&rsp->statpost, statpost);
}
void
-server_post_seek (gfs3_seek_rsp *rsp, off_t offset)
+server_post_seek(gfs3_seek_rsp *rsp, off_t offset)
{
- rsp->offset = offset;
+ rsp->offset = offset;
}
int
-server_post_readdirp (gfs3_readdirp_rsp *rsp, gf_dirent_t *entries)
+server_post_readdirp(gfs3_readdirp_rsp *rsp, gf_dirent_t *entries)
{
- int ret = 0;
+ int ret = 0;
- ret = serialize_rsp_direntp (entries, rsp);
+ ret = serialize_rsp_direntp(entries, rsp);
- return ret;
+ return ret;
}
void
-server_post_fsetattr (gfs3_fsetattr_rsp *rsp, struct iatt *statpre,
- struct iatt *statpost)
+server_post_fsetattr(gfs3_fsetattr_rsp *rsp, struct iatt *statpre,
+ struct iatt *statpost)
{
- gf_stat_from_iatt (&rsp->statpre, statpre);
- gf_stat_from_iatt (&rsp->statpost, statpost);
+ gf_stat_from_iatt(&rsp->statpre, statpre);
+ gf_stat_from_iatt(&rsp->statpost, statpost);
}
void
-server_post_setattr (gfs3_setattr_rsp *rsp, struct iatt *statpre,
- struct iatt *statpost)
+server_post_setattr(gfs3_setattr_rsp *rsp, struct iatt *statpre,
+ struct iatt *statpost)
{
- gf_stat_from_iatt (&rsp->statpre, statpre);
- gf_stat_from_iatt (&rsp->statpost, statpost);
+ gf_stat_from_iatt(&rsp->statpre, statpre);
+ gf_stat_from_iatt(&rsp->statpost, statpost);
}
void
-server_post_rchecksum (gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum,
- uint8_t *strong_checksum)
+server_post_rchecksum(gfs3_rchecksum_rsp *rsp, uint32_t weak_checksum,
+ uint8_t *strong_checksum)
{
- rsp->weak_checksum = weak_checksum;
-
- rsp->strong_checksum.strong_checksum_val = (char *)strong_checksum;
- rsp->strong_checksum.strong_checksum_len = MD5_DIGEST_LENGTH;
+ rsp->weak_checksum = weak_checksum;
+ rsp->strong_checksum.strong_checksum_val = (char *)strong_checksum;
+ rsp->strong_checksum.strong_checksum_len = MD5_DIGEST_LENGTH;
}
void
-server_post_rename (call_frame_t *frame,
- server_state_t *state, gfs3_rename_rsp *rsp,
- struct iatt *stbuf,
- struct iatt *preoldparent,
- struct iatt *postoldparent,
- struct iatt *prenewparent,
- struct iatt *postnewparent)
+server_post_rename(call_frame_t *frame, server_state_t *state,
+ gfs3_rename_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent)
{
- inode_t *tmp_inode = NULL;
+ inode_t *tmp_inode = NULL;
- stbuf->ia_type = state->loc.inode->ia_type;
+ stbuf->ia_type = state->loc.inode->ia_type;
- /* TODO: log gfid of the inodes */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "RENAME_CBK %s ==> %s", frame->root->unique,
- state->loc.name, state->loc2.name);
-
- /* Before renaming the inode, we have to get the inode for the
- * destination entry (i.e. inode with state->loc2.parent as
- * parent and state->loc2.name as name). If it exists, then
- * unlink that inode, and send forget on that inode if the
- * unlinked entry is the last entry. In case of fuse client
- * the fuse kernel module itself sends the forget on the
- * unlinked inode.
- */
- tmp_inode = inode_grep (state->loc.inode->table,
- state->loc2.parent, state->loc2.name);
- if (tmp_inode) {
- inode_unlink (tmp_inode, state->loc2.parent,
- state->loc2.name);
- forget_inode_if_no_dentry (tmp_inode);
- inode_unref (tmp_inode);
- }
+ /* TODO: log gfid of the inodes */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "RENAME_CBK %s ==> %s",
+ frame->root->unique, state->loc.name, state->loc2.name);
- inode_rename (state->itable,
- state->loc.parent, state->loc.name,
- state->loc2.parent, state->loc2.name,
- state->loc.inode, stbuf);
- gf_stat_from_iatt (&rsp->stat, stbuf);
+ /* Before renaming the inode, we have to get the inode for the
+ * destination entry (i.e. inode with state->loc2.parent as
+ * parent and state->loc2.name as name). If it exists, then
+ * unlink that inode, and send forget on that inode if the
+ * unlinked entry is the last entry. In case of fuse client
+ * the fuse kernel module itself sends the forget on the
+ * unlinked inode.
+ */
+ tmp_inode = inode_grep(state->loc.inode->table, state->loc2.parent,
+ state->loc2.name);
+ if (tmp_inode) {
+ inode_unlink(tmp_inode, state->loc2.parent, state->loc2.name);
+ forget_inode_if_no_dentry(tmp_inode);
+ inode_unref(tmp_inode);
+ }
- gf_stat_from_iatt (&rsp->preoldparent, preoldparent);
- gf_stat_from_iatt (&rsp->postoldparent, postoldparent);
+ inode_rename(state->itable, state->loc.parent, state->loc.name,
+ state->loc2.parent, state->loc2.name, state->loc.inode, stbuf);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->prenewparent, prenewparent);
- gf_stat_from_iatt (&rsp->postnewparent, postnewparent);
+ gf_stat_from_iatt(&rsp->preoldparent, preoldparent);
+ gf_stat_from_iatt(&rsp->postoldparent, postoldparent);
+ gf_stat_from_iatt(&rsp->prenewparent, prenewparent);
+ gf_stat_from_iatt(&rsp->postnewparent, postnewparent);
}
int
-server_post_open (call_frame_t *frame, xlator_t *this,
- gfs3_open_rsp *rsp, fd_t *fd)
-{
- server_ctx_t *serv_ctx = NULL;
- uint64_t fd_no = 0;
-
- serv_ctx = server_ctx_get (frame->root->client, this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- return -1;
- }
+server_post_open(call_frame_t *frame, xlator_t *this, gfs3_open_rsp *rsp,
+ fd_t *fd)
+{
+ server_ctx_t *serv_ctx = NULL;
+ uint64_t fd_no = 0;
+
+ serv_ctx = server_ctx_get(frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ return -1;
+ }
- fd_bind (fd);
- fd_ref (fd);
- fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
- rsp->fd = fd_no;
+ fd_bind(fd);
+ fd_ref(fd);
+ fd_no = gf_fd_unused_get(serv_ctx->fdtable, fd);
+ rsp->fd = fd_no;
- return 0;
+ return 0;
}
void
-server_post_readv (gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret)
+server_post_readv(gfs3_read_rsp *rsp, struct iatt *stbuf, int op_ret)
{
- gf_stat_from_iatt (&rsp->stat, stbuf);
- rsp->size = op_ret;
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ rsp->size = op_ret;
}
int
-server_post_opendir (call_frame_t *frame, xlator_t *this,
- gfs3_opendir_rsp *rsp, fd_t *fd)
-{
- server_ctx_t *serv_ctx = NULL;
- uint64_t fd_no = 0;
-
- serv_ctx = server_ctx_get (frame->root->client, this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- return -1;
- }
-
- fd_bind (fd);
- fd_ref (fd);
- fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
- rsp->fd = fd_no;
-
- return 0;
-}
-
-int
-server_post_create (call_frame_t *frame, gfs3_create_rsp *rsp,
- server_state_t *state,
- xlator_t *this, fd_t *fd, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent)
+server_post_opendir(call_frame_t *frame, xlator_t *this, gfs3_opendir_rsp *rsp,
+ fd_t *fd)
{
- server_ctx_t *serv_ctx = NULL;
- inode_t *link_inode = NULL;
- uint64_t fd_no = 0;
- int op_errno = 0;
+ server_ctx_t *serv_ctx = NULL;
+ uint64_t fd_no = 0;
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
+ serv_ctx = server_ctx_get(frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ return -1;
+ }
- if (!link_inode) {
- op_errno = ENOENT;
- goto out;
- }
-
- if (link_inode != inode) {
- /*
- VERY racy code (if used anywhere else)
- -- don't do this without understanding
- */
-
- inode_ctx_merge (fd, fd->inode, link_inode);
- inode_unref (fd->inode);
- fd->inode = inode_ref (link_inode);
- }
+ fd_bind(fd);
+ fd_ref(fd);
+ fd_no = gf_fd_unused_get(serv_ctx->fdtable, fd);
+ rsp->fd = fd_no;
- inode_lookup (link_inode);
- inode_unref (link_inode);
-
- serv_ctx = server_ctx_get (frame->root->client, this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- goto out;
- }
-
- fd_bind (fd);
- fd_ref (fd);
- fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
-
- if ((fd_no > UINT64_MAX) || (fd == 0)) {
- op_errno = errno;
- }
-
- rsp->fd = fd_no;
- gf_stat_from_iatt (&rsp->stat, stbuf);
- gf_stat_from_iatt (&rsp->preparent, preparent);
- gf_stat_from_iatt (&rsp->postparent, postparent);
+ return 0;
+}
- return 0;
+int
+server_post_create(call_frame_t *frame, gfs3_create_rsp *rsp,
+ server_state_t *state, xlator_t *this, fd_t *fd,
+ inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent)
+{
+ server_ctx_t *serv_ctx = NULL;
+ inode_t *link_inode = NULL;
+ uint64_t fd_no = 0;
+ int op_errno = 0;
+
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+
+ if (!link_inode) {
+ op_errno = ENOENT;
+ goto out;
+ }
+
+ if (link_inode != inode) {
+ /*
+ VERY racy code (if used anywhere else)
+ -- don't do this without understanding
+ */
+
+ inode_ctx_merge(fd, fd->inode, link_inode);
+ inode_unref(fd->inode);
+ fd->inode = inode_ref(link_inode);
+ }
+
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
+
+ serv_ctx = server_ctx_get(frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ goto out;
+ }
+
+ fd_bind(fd);
+ fd_ref(fd);
+ fd_no = gf_fd_unused_get(serv_ctx->fdtable, fd);
+
+ if ((fd_no > UINT64_MAX) || (fd == 0)) {
+ op_errno = errno;
+ }
+
+ rsp->fd = fd_no;
+ gf_stat_from_iatt(&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->preparent, preparent);
+ gf_stat_from_iatt(&rsp->postparent, postparent);
+
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
/*TODO: Handle revalidate path */
void
-server_post_lookup (gfs3_lookup_rsp *rsp, call_frame_t *frame,
- server_state_t *state,
- inode_t *inode, struct iatt *stbuf,
- struct iatt *postparent)
+server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame,
+ server_state_t *state, inode_t *inode, struct iatt *stbuf,
+ struct iatt *postparent)
{
- inode_t *root_inode = NULL;
- inode_t *link_inode = NULL;
- uuid_t rootgfid = {0,};
+ inode_t *root_inode = NULL;
+ inode_t *link_inode = NULL;
+ uuid_t rootgfid = {
+ 0,
+ };
- root_inode = frame->root->client->bound_xl->itable->root;
+ root_inode = frame->root->client->bound_xl->itable->root;
- if (!__is_root_gfid (inode->gfid)) {
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- if (link_inode) {
- inode_lookup (link_inode);
- inode_unref (link_inode);
- }
+ if (!__is_root_gfid(inode->gfid)) {
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name,
+ stbuf);
+ if (link_inode) {
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
+ }
- if ((inode == root_inode) ||
- (state->client->subdir_mount &&
- (inode == state->client->subdir_inode))) {
- /* we just looked up root ("/") OR
- subdir mount directory, which is root ('/') in client */
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- stbuf->ia_ino = 1;
- rootgfid[15] = 1;
- gf_uuid_copy (stbuf->ia_gfid, rootgfid);
- if (inode->ia_type == 0)
- inode->ia_type = stbuf->ia_type;
- }
+ if ((inode == root_inode) || (state->client->subdir_mount &&
+ (inode == state->client->subdir_inode))) {
+ /* we just looked up root ("/") OR
+ subdir mount directory, which is root ('/') in client */
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ stbuf->ia_ino = 1;
+ rootgfid[15] = 1;
+ gf_uuid_copy(stbuf->ia_gfid, rootgfid);
+ if (inode->ia_type == 0)
+ inode->ia_type = stbuf->ia_type;
+ }
- gf_stat_from_iatt (&rsp->stat, stbuf);
+ gf_stat_from_iatt(&rsp->stat, stbuf);
}
void
-server_post_lease (gfs3_lease_rsp *rsp, struct gf_lease *lease)
+server_post_lease(gfs3_lease_rsp *rsp, struct gf_lease *lease)
{
- gf_proto_lease_from_lease (&rsp->lease, lease);
+ gf_proto_lease_from_lease(&rsp->lease, lease);
}
-
/* Version 4 helpers */
void
-server4_post_readlink (gfx_readlink_rsp *rsp, struct iatt *stbuf,
+server4_post_readlink(gfx_readlink_rsp *rsp, struct iatt *stbuf,
const char *buf)
{
- gfx_stat_from_iattx (&rsp->buf, stbuf);
- rsp->path = (char *)buf;
+ gfx_stat_from_iattx(&rsp->buf, stbuf);
+ rsp->path = (char *)buf;
}
void
-server4_post_common_3iatt (server_state_t *state, gfx_common_3iatt_rsp *rsp,
- inode_t *inode, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent)
+server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp,
+ inode_t *inode, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent)
{
- inode_t *link_inode = NULL;
+ inode_t *link_inode = NULL;
- gfx_stat_from_iattx (&rsp->stat, stbuf);
- if (state->client->subdir_mount &&
- !gf_uuid_compare (preparent->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare(preparent->ia_gfid, state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {
+ 0,
+ };
- gfid[15] = 1;
- preparent->ia_ino = 1;
- postparent->ia_ino = 1;
- gf_uuid_copy (preparent->ia_gfid, gfid);
- gf_uuid_copy (postparent->ia_gfid, gfid);
- }
+ gfid[15] = 1;
+ preparent->ia_ino = 1;
+ postparent->ia_ino = 1;
+ gf_uuid_copy(preparent->ia_gfid, gfid);
+ gf_uuid_copy(postparent->ia_gfid, gfid);
+ }
- gfx_stat_from_iattx (&rsp->preparent, preparent);
- gfx_stat_from_iattx (&rsp->postparent, postparent);
+ gfx_stat_from_iattx(&rsp->preparent, preparent);
+ gfx_stat_from_iattx(&rsp->postparent, postparent);
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
void
-server4_post_common_2iatt (gfx_common_2iatt_rsp *rsp, struct iatt *prebuf,
- struct iatt *postbuf)
+server4_post_common_2iatt(gfx_common_2iatt_rsp *rsp, struct iatt *prebuf,
+ struct iatt *postbuf)
{
- gfx_stat_from_iattx (&rsp->prestat, prebuf);
- gfx_stat_from_iattx (&rsp->poststat, postbuf);
+ gfx_stat_from_iattx(&rsp->prestat, prebuf);
+ gfx_stat_from_iattx(&rsp->poststat, postbuf);
}
void
-server4_post_entry_remove (server_state_t *state, gfx_common_2iatt_rsp *rsp,
- struct iatt *prebuf, struct iatt *postbuf)
+server4_post_entry_remove(server_state_t *state, gfx_common_2iatt_rsp *rsp,
+ struct iatt *prebuf, struct iatt *postbuf)
{
- inode_unlink (state->loc.inode, state->loc.parent,
- state->loc.name);
- /* parent should not be found for directories after
- * inode_unlink, since directories cannot have
- * hardlinks.
- */
- forget_inode_if_no_dentry (state->loc.inode);
+ inode_unlink(state->loc.inode, state->loc.parent, state->loc.name);
+ /* parent should not be found for directories after
+ * inode_unlink, since directories cannot have
+ * hardlinks.
+ */
+ forget_inode_if_no_dentry(state->loc.inode);
- gfx_stat_from_iattx (&rsp->prestat, prebuf);
- gfx_stat_from_iattx (&rsp->poststat, postbuf);
+ gfx_stat_from_iattx(&rsp->prestat, prebuf);
+ gfx_stat_from_iattx(&rsp->poststat, postbuf);
}
-
void
-server4_post_statfs (gfx_statfs_rsp *rsp, struct statvfs *stbuf)
+server4_post_statfs(gfx_statfs_rsp *rsp, struct statvfs *stbuf)
{
- gf_statfs_from_statfs (&rsp->statfs, stbuf);
+ gf_statfs_from_statfs(&rsp->statfs, stbuf);
}
void
-server4_post_common_iatt (server_state_t *state, gfx_common_iatt_rsp *rsp,
- struct iatt *stbuf)
+server4_post_common_iatt(server_state_t *state, gfx_common_iatt_rsp *rsp,
+ struct iatt *stbuf)
{
- if (state->client->subdir_mount &&
- !gf_uuid_compare (stbuf->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare(stbuf->ia_gfid, state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {
+ 0,
+ };
- gfid[15] = 1;
- stbuf->ia_ino = 1;
- gf_uuid_copy (stbuf->ia_gfid, gfid);
- }
+ gfid[15] = 1;
+ stbuf->ia_ino = 1;
+ gf_uuid_copy(stbuf->ia_gfid, gfid);
+ }
- gfx_stat_from_iattx (&rsp->stat, stbuf);
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
}
void
-server4_post_lk (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock)
+server4_post_lk(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock)
{
- switch (lock->l_type) {
+ switch (lock->l_type) {
case F_RDLCK:
- lock->l_type = GF_LK_F_RDLCK;
- break;
+ lock->l_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- lock->l_type = GF_LK_F_WRLCK;
- break;
+ lock->l_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- lock->l_type = GF_LK_F_UNLCK;
- break;
+ lock->l_type = GF_LK_F_UNLCK;
+ break;
default:
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
- "Unknown lock type: %"PRId32"!", lock->l_type);
- break;
- }
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
+ "Unknown lock type: %" PRId32 "!", lock->l_type);
+ break;
+ }
- gf_proto_flock_from_flock (&rsp->flock, lock);
+ gf_proto_flock_from_flock(&rsp->flock, lock);
}
int
-server4_post_readdir (gfx_readdir_rsp *rsp, gf_dirent_t *entries)
+server4_post_readdir(gfx_readdir_rsp *rsp, gf_dirent_t *entries)
{
- int ret = 0;
+ int ret = 0;
- ret = serialize_rsp_dirent_v2 (entries, rsp);
+ ret = serialize_rsp_dirent_v2(entries, rsp);
- return ret;
+ return ret;
}
void
-server4_post_seek (gfx_seek_rsp *rsp, off_t offset)
+server4_post_seek(gfx_seek_rsp *rsp, off_t offset)
{
- rsp->offset = offset;
+ rsp->offset = offset;
}
int
-server4_post_readdirp (gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
+server4_post_readdirp(gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
{
- int ret = 0;
+ int ret = 0;
- ret = serialize_rsp_direntp_v2 (entries, rsp);
+ ret = serialize_rsp_direntp_v2(entries, rsp);
- return ret;
+ return ret;
}
void
-server4_post_rchecksum (gfx_rchecksum_rsp *rsp, uint32_t weak_checksum,
+server4_post_rchecksum(gfx_rchecksum_rsp *rsp, uint32_t weak_checksum,
uint8_t *strong_checksum)
{
- rsp->weak_checksum = weak_checksum;
-
- rsp->strong_checksum.strong_checksum_val = (char *)strong_checksum;
- rsp->strong_checksum.strong_checksum_len = SHA256_DIGEST_LENGTH;
- rsp->flags = 1; /* Indicates SHA256 TYPE */
+ rsp->weak_checksum = weak_checksum;
+ rsp->strong_checksum.strong_checksum_val = (char *)strong_checksum;
+ rsp->strong_checksum.strong_checksum_len = SHA256_DIGEST_LENGTH;
+ rsp->flags = 1; /* Indicates SHA256 TYPE */
}
void
-server4_post_rename (call_frame_t *frame,
- server_state_t *state, gfx_rename_rsp *rsp,
- struct iatt *stbuf,
- struct iatt *preoldparent,
- struct iatt *postoldparent,
- struct iatt *prenewparent,
- struct iatt *postnewparent)
+server4_post_rename(call_frame_t *frame, server_state_t *state,
+ gfx_rename_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent)
{
- inode_t *tmp_inode = NULL;
-
- stbuf->ia_type = state->loc.inode->ia_type;
+ inode_t *tmp_inode = NULL;
- /* TODO: log gfid of the inodes */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "RENAME_CBK %s ==> %s", frame->root->unique,
- state->loc.name, state->loc2.name);
+ stbuf->ia_type = state->loc.inode->ia_type;
- /* Before renaming the inode, we have to get the inode for the
- * destination entry (i.e. inode with state->loc2.parent as
- * parent and state->loc2.name as name). If it exists, then
- * unlink that inode, and send forget on that inode if the
- * unlinked entry is the last entry. In case of fuse client
- * the fuse kernel module itself sends the forget on the
- * unlinked inode.
- */
- tmp_inode = inode_grep (state->loc.inode->table,
- state->loc2.parent, state->loc2.name);
- if (tmp_inode) {
- inode_unlink (tmp_inode, state->loc2.parent,
- state->loc2.name);
- forget_inode_if_no_dentry (tmp_inode);
- inode_unref (tmp_inode);
- }
+ /* TODO: log gfid of the inodes */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "RENAME_CBK %s ==> %s",
+ frame->root->unique, state->loc.name, state->loc2.name);
- inode_rename (state->itable,
- state->loc.parent, state->loc.name,
- state->loc2.parent, state->loc2.name,
- state->loc.inode, stbuf);
- gfx_stat_from_iattx (&rsp->stat, stbuf);
+ /* Before renaming the inode, we have to get the inode for the
+ * destination entry (i.e. inode with state->loc2.parent as
+ * parent and state->loc2.name as name). If it exists, then
+ * unlink that inode, and send forget on that inode if the
+ * unlinked entry is the last entry. In case of fuse client
+ * the fuse kernel module itself sends the forget on the
+ * unlinked inode.
+ */
+ tmp_inode = inode_grep(state->loc.inode->table, state->loc2.parent,
+ state->loc2.name);
+ if (tmp_inode) {
+ inode_unlink(tmp_inode, state->loc2.parent, state->loc2.name);
+ forget_inode_if_no_dentry(tmp_inode);
+ inode_unref(tmp_inode);
+ }
- gfx_stat_from_iattx (&rsp->preoldparent, preoldparent);
- gfx_stat_from_iattx (&rsp->postoldparent, postoldparent);
+ inode_rename(state->itable, state->loc.parent, state->loc.name,
+ state->loc2.parent, state->loc2.name, state->loc.inode, stbuf);
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
- gfx_stat_from_iattx (&rsp->prenewparent, prenewparent);
- gfx_stat_from_iattx (&rsp->postnewparent, postnewparent);
+ gfx_stat_from_iattx(&rsp->preoldparent, preoldparent);
+ gfx_stat_from_iattx(&rsp->postoldparent, postoldparent);
+ gfx_stat_from_iattx(&rsp->prenewparent, prenewparent);
+ gfx_stat_from_iattx(&rsp->postnewparent, postnewparent);
}
int
-server4_post_open (call_frame_t *frame, xlator_t *this,
- gfx_open_rsp *rsp, fd_t *fd)
-{
- server_ctx_t *serv_ctx = NULL;
- uint64_t fd_no = 0;
-
- serv_ctx = server_ctx_get (frame->root->client, this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- return -1;
- }
+server4_post_open(call_frame_t *frame, xlator_t *this, gfx_open_rsp *rsp,
+ fd_t *fd)
+{
+ server_ctx_t *serv_ctx = NULL;
+ uint64_t fd_no = 0;
+
+ serv_ctx = server_ctx_get(frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ return -1;
+ }
- fd_bind (fd);
- fd_ref (fd);
- fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
- rsp->fd = fd_no;
+ fd_bind(fd);
+ fd_ref(fd);
+ fd_no = gf_fd_unused_get(serv_ctx->fdtable, fd);
+ rsp->fd = fd_no;
- return 0;
+ return 0;
}
void
-server4_post_readv (gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret)
+server4_post_readv(gfx_read_rsp *rsp, struct iatt *stbuf, int op_ret)
{
- gfx_stat_from_iattx (&rsp->stat, stbuf);
- rsp->size = op_ret;
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
+ rsp->size = op_ret;
}
int
-server4_post_create (call_frame_t *frame, gfx_create_rsp *rsp,
- server_state_t *state,
- xlator_t *this, fd_t *fd, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
+server4_post_create(call_frame_t *frame, gfx_create_rsp *rsp,
+ server_state_t *state, xlator_t *this, fd_t *fd,
+ inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent)
{
- server_ctx_t *serv_ctx = NULL;
- inode_t *link_inode = NULL;
- uint64_t fd_no = 0;
- int op_errno = 0;
-
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
-
- if (!link_inode) {
- op_errno = ENOENT;
- goto out;
- }
-
- if (link_inode != inode) {
- /*
- VERY racy code (if used anywhere else)
- -- don't do this without understanding
- */
-
- inode_ctx_merge (fd, fd->inode, link_inode);
- inode_unref (fd->inode);
- fd->inode = inode_ref (link_inode);
- }
-
- inode_lookup (link_inode);
- inode_unref (link_inode);
-
- serv_ctx = server_ctx_get (frame->root->client, this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- goto out;
- }
-
- fd_bind (fd);
- fd_ref (fd);
- fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
-
- if ((fd_no > UINT64_MAX) || (fd == 0)) {
- op_errno = errno;
- }
-
- rsp->fd = fd_no;
- gfx_stat_from_iattx (&rsp->stat, stbuf);
- gfx_stat_from_iattx (&rsp->preparent, preparent);
- gfx_stat_from_iattx (&rsp->postparent, postparent);
-
- return 0;
+ server_ctx_t *serv_ctx = NULL;
+ inode_t *link_inode = NULL;
+ uint64_t fd_no = 0;
+ int op_errno = 0;
+
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
+
+ if (!link_inode) {
+ op_errno = ENOENT;
+ goto out;
+ }
+
+ if (link_inode != inode) {
+ /*
+ VERY racy code (if used anywhere else)
+ -- don't do this without understanding
+ */
+
+ inode_ctx_merge(fd, fd->inode, link_inode);
+ inode_unref(fd->inode);
+ fd->inode = inode_ref(link_inode);
+ }
+
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
+
+ serv_ctx = server_ctx_get(frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ goto out;
+ }
+
+ fd_bind(fd);
+ fd_ref(fd);
+ fd_no = gf_fd_unused_get(serv_ctx->fdtable, fd);
+
+ if ((fd_no > UINT64_MAX) || (fd == 0)) {
+ op_errno = errno;
+ }
+
+ rsp->fd = fd_no;
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
+ gfx_stat_from_iattx(&rsp->preparent, preparent);
+ gfx_stat_from_iattx(&rsp->postparent, postparent);
+
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
/*TODO: Handle revalidate path */
void
-server4_post_lookup (gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
- server_state_t *state,
- inode_t *inode, struct iatt *stbuf)
+server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
+ server_state_t *state, inode_t *inode, struct iatt *stbuf)
{
- inode_t *root_inode = NULL;
- inode_t *link_inode = NULL;
- uuid_t rootgfid = {0,};
+ inode_t *root_inode = NULL;
+ inode_t *link_inode = NULL;
+ uuid_t rootgfid = {
+ 0,
+ };
- root_inode = frame->root->client->bound_xl->itable->root;
+ root_inode = frame->root->client->bound_xl->itable->root;
- if (!__is_root_gfid (inode->gfid)) {
- link_inode = inode_link (inode, state->loc.parent,
- state->loc.name, stbuf);
- if (link_inode) {
- inode_lookup (link_inode);
- inode_unref (link_inode);
- }
+ if (!__is_root_gfid(inode->gfid)) {
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name,
+ stbuf);
+ if (link_inode) {
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
+ }
- if ((inode == root_inode) ||
- (state->client->subdir_mount &&
- (inode == state->client->subdir_inode))) {
- /* we just looked up root ("/") OR
- subdir mount directory, which is root ('/') in client */
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- stbuf->ia_ino = 1;
- rootgfid[15] = 1;
- gf_uuid_copy (stbuf->ia_gfid, rootgfid);
- if (inode->ia_type == 0)
- inode->ia_type = stbuf->ia_type;
- }
+ if ((inode == root_inode) || (state->client->subdir_mount &&
+ (inode == state->client->subdir_inode))) {
+ /* we just looked up root ("/") OR
+ subdir mount directory, which is root ('/') in client */
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ stbuf->ia_ino = 1;
+ rootgfid[15] = 1;
+ gf_uuid_copy(stbuf->ia_gfid, rootgfid);
+ if (inode->ia_type == 0)
+ inode->ia_type = stbuf->ia_type;
+ }
- gfx_stat_from_iattx (&rsp->prestat, stbuf);
+ gfx_stat_from_iattx(&rsp->prestat, stbuf);
}
void
-server4_post_lease (gfx_lease_rsp *rsp, struct gf_lease *lease)
+server4_post_lease(gfx_lease_rsp *rsp, struct gf_lease *lease)
{
- gf_proto_lease_from_lease (&rsp->lease, lease);
+ gf_proto_lease_from_lease(&rsp->lease, lease);
}
void
-server4_post_link (server_state_t *state, gfx_common_3iatt_rsp *rsp,
- inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server4_post_link(server_state_t *state, gfx_common_3iatt_rsp *rsp,
+ inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- inode_t *link_inode = NULL;
-
- gfx_stat_from_iattx (&rsp->stat, stbuf);
- gfx_stat_from_iattx (&rsp->preparent, preparent);
- gfx_stat_from_iattx (&rsp->postparent, postparent);
+ inode_t *link_inode = NULL;
- link_inode = inode_link (inode, state->loc2.parent,
- state->loc2.name, stbuf);
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
+ gfx_stat_from_iattx(&rsp->preparent, preparent);
+ gfx_stat_from_iattx(&rsp->postparent, postparent);
+ link_inode = inode_link(inode, state->loc2.parent, state->loc2.name, stbuf);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
}
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index c0b03510191..30e7e4b0478 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -8,7 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
#include "server.h"
#include "server-helpers.h"
#include "rpc-common-xdr.h"
@@ -22,989 +21,1012 @@
#include "syncop.h"
struct __get_xl_struct {
- const char *name;
- xlator_t *reply;
+ const char *name;
+ xlator_t *reply;
};
int
-gf_compare_client_version (rpcsvc_request_t *req, int fop_prognum,
- int mgmt_prognum)
+gf_compare_client_version(rpcsvc_request_t *req, int fop_prognum,
+ int mgmt_prognum)
{
- int ret = -1;
- /* TODO: think.. */
- if (glusterfs3_3_fop_prog.prognum == fop_prognum)
- ret = 0;
+ int ret = -1;
+ /* TODO: think.. */
+ if (glusterfs3_3_fop_prog.prognum == fop_prognum)
+ ret = 0;
- return ret;
+ return ret;
}
int
-_volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
+_volfile_update_checksum(xlator_t *this, char *key, uint32_t checksum)
{
- server_conf_t *conf = NULL;
- struct _volfile_ctx *temp_volfile = NULL;
-
- conf = this->private;
- temp_volfile = conf->volfile;
-
- while (temp_volfile) {
- if ((NULL == key) && (NULL == temp_volfile->key))
- break;
- if ((NULL == key) || (NULL == temp_volfile->key)) {
- temp_volfile = temp_volfile->next;
- continue;
- }
- if (strcmp (temp_volfile->key, key) == 0)
- break;
- temp_volfile = temp_volfile->next;
+ server_conf_t *conf = NULL;
+ struct _volfile_ctx *temp_volfile = NULL;
+
+ conf = this->private;
+ temp_volfile = conf->volfile;
+
+ while (temp_volfile) {
+ if ((NULL == key) && (NULL == temp_volfile->key))
+ break;
+ if ((NULL == key) || (NULL == temp_volfile->key)) {
+ temp_volfile = temp_volfile->next;
+ continue;
}
+ if (strcmp(temp_volfile->key, key) == 0)
+ break;
+ temp_volfile = temp_volfile->next;
+ }
+
+ if (!temp_volfile) {
+ temp_volfile = GF_CALLOC(1, sizeof(struct _volfile_ctx),
+ gf_server_mt_volfile_ctx_t);
+ if (!temp_volfile)
+ goto out;
+ temp_volfile->next = conf->volfile;
+ temp_volfile->key = (key) ? gf_strdup(key) : NULL;
+ temp_volfile->checksum = checksum;
- if (!temp_volfile) {
- temp_volfile = GF_CALLOC (1, sizeof (struct _volfile_ctx),
- gf_server_mt_volfile_ctx_t);
- if (!temp_volfile)
- goto out;
- temp_volfile->next = conf->volfile;
- temp_volfile->key = (key)? gf_strdup (key): NULL;
- temp_volfile->checksum = checksum;
-
- conf->volfile = temp_volfile;
- goto out;
- }
+ conf->volfile = temp_volfile;
+ goto out;
+ }
- if (temp_volfile->checksum != checksum) {
- gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_REMOUNT_CLIENT_REQD,
- "the volume file was modified between a prior access "
- "and now. This may lead to inconsistency between "
- "clients, you are advised to remount client");
- temp_volfile->checksum = checksum;
- }
+ if (temp_volfile->checksum != checksum) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_REMOUNT_CLIENT_REQD,
+ "the volume file was modified between a prior access "
+ "and now. This may lead to inconsistency between "
+ "clients, you are advised to remount client");
+ temp_volfile->checksum = checksum;
+ }
out:
- return 0;
+ return 0;
}
-
static size_t
-getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
- size_t path_len)
+getspec_build_volfile_path(xlator_t *this, const char *key, char *path,
+ size_t path_len)
{
- char *filename = NULL;
- server_conf_t *conf = NULL;
- int ret = -1;
- int free_filename = 0;
- char data_key[256] = {0,};
-
- conf = this->private;
-
- /* Inform users that this option is changed now */
- ret = dict_get_str (this->options, "client-volume-filename",
- &filename);
- if (ret == 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_DEFAULTING_FILE,
- "option 'client-volume-filename' is changed to "
- "'volume-filename.<key>' which now takes 'key' as an "
- "option to choose/fetch different files from server. "
- "Refer documentation or contact developers for more "
- "info. Currently defaulting to given file '%s'",
- filename);
- }
-
- if (key && !filename) {
- sprintf (data_key, "volume-filename.%s", key);
- ret = dict_get_str (this->options, data_key, &filename);
- if (ret < 0) {
- /* Make sure that key doesn't contain "../" in path */
- if ((gf_strstr (key, "/", "..")) == -1) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PS_MSG_INVALID_ENTRY, "%s: invalid "
- "key", key);
- goto out;
- }
- }
+ char *filename = NULL;
+ server_conf_t *conf = NULL;
+ int ret = -1;
+ int free_filename = 0;
+ char data_key[256] = {
+ 0,
+ };
+
+ conf = this->private;
+
+ /* Inform users that this option is changed now */
+ ret = dict_get_str(this->options, "client-volume-filename", &filename);
+ if (ret == 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_DEFAULTING_FILE,
+ "option 'client-volume-filename' is changed to "
+ "'volume-filename.<key>' which now takes 'key' as an "
+ "option to choose/fetch different files from server. "
+ "Refer documentation or contact developers for more "
+ "info. Currently defaulting to given file '%s'",
+ filename);
+ }
+
+ if (key && !filename) {
+ sprintf(data_key, "volume-filename.%s", key);
+ ret = dict_get_str(this->options, data_key, &filename);
+ if (ret < 0) {
+ /* Make sure that key doesn't contain "../" in path */
+ if ((gf_strstr(key, "/", "..")) == -1) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
+ "%s: invalid "
+ "key",
+ key);
+ goto out;
+ }
}
+ }
- if (!filename) {
- ret = dict_get_str (this->options,
- "volume-filename.default", &filename);
- if (ret < 0) {
- gf_msg_debug (this->name, 0, "no default volume "
- "filename given, defaulting to %s",
- DEFAULT_VOLUME_FILE_PATH);
- }
+ if (!filename) {
+ ret = dict_get_str(this->options, "volume-filename.default", &filename);
+ if (ret < 0) {
+ gf_msg_debug(this->name, 0,
+ "no default volume "
+ "filename given, defaulting to %s",
+ DEFAULT_VOLUME_FILE_PATH);
}
+ }
- if (!filename && key) {
- ret = gf_asprintf (&filename, "%s/%s.vol", conf->conf_dir, key);
- if (-1 == ret)
- goto out;
+ if (!filename && key) {
+ ret = gf_asprintf(&filename, "%s/%s.vol", conf->conf_dir, key);
+ if (-1 == ret)
+ goto out;
- free_filename = 1;
- }
- if (!filename)
- filename = DEFAULT_VOLUME_FILE_PATH;
+ free_filename = 1;
+ }
+ if (!filename)
+ filename = DEFAULT_VOLUME_FILE_PATH;
- ret = -1;
+ ret = -1;
- if ((filename) && (path_len > strlen (filename))) {
- strcpy (path, filename);
- ret = strlen (filename);
- }
+ if ((filename) && (path_len > strlen(filename))) {
+ strcpy(path, filename);
+ ret = strlen(filename);
+ }
out:
- if (free_filename)
- GF_FREE (filename);
+ if (free_filename)
+ GF_FREE(filename);
- return ret;
+ return ret;
}
int
-_validate_volfile_checksum (xlator_t *this, char *key,
- uint32_t checksum)
+_validate_volfile_checksum(xlator_t *this, char *key, uint32_t checksum)
{
- char filename[PATH_MAX] = {0,};
- server_conf_t *conf = NULL;
- struct _volfile_ctx *temp_volfile = NULL;
- int ret = 0;
- int fd = 0;
- uint32_t local_checksum = 0;
-
- conf = this->private;
- temp_volfile = conf->volfile;
-
- if (!checksum)
- goto out;
+ char filename[PATH_MAX] = {
+ 0,
+ };
+ server_conf_t *conf = NULL;
+ struct _volfile_ctx *temp_volfile = NULL;
+ int ret = 0;
+ int fd = 0;
+ uint32_t local_checksum = 0;
+
+ conf = this->private;
+ temp_volfile = conf->volfile;
+
+ if (!checksum)
+ goto out;
- if (!temp_volfile) {
- ret = getspec_build_volfile_path (this, key, filename,
- sizeof (filename));
- if (ret <= 0)
- goto out;
- fd = open (filename, O_RDONLY);
- if (-1 == fd) {
- ret = 0;
- gf_msg (this->name, GF_LOG_INFO, errno,
- PS_MSG_VOL_FILE_OPEN_FAILED,
- "failed to open volume file (%s) : %s",
- filename, strerror (errno));
- goto out;
- }
- get_checksum_for_file (fd, &local_checksum);
- _volfile_update_checksum (this, key, local_checksum);
- sys_close (fd);
+ if (!temp_volfile) {
+ ret = getspec_build_volfile_path(this, key, filename, sizeof(filename));
+ if (ret <= 0)
+ goto out;
+ fd = open(filename, O_RDONLY);
+ if (-1 == fd) {
+ ret = 0;
+ gf_msg(this->name, GF_LOG_INFO, errno, PS_MSG_VOL_FILE_OPEN_FAILED,
+ "failed to open volume file (%s) : %s", filename,
+ strerror(errno));
+ goto out;
}
-
- temp_volfile = conf->volfile;
- while (temp_volfile) {
- if ((NULL == key) && (NULL == temp_volfile->key))
- break;
- if ((NULL == key) || (NULL == temp_volfile->key)) {
- temp_volfile = temp_volfile->next;
- continue;
- }
- if (strcmp (temp_volfile->key, key) == 0)
- break;
- temp_volfile = temp_volfile->next;
+ get_checksum_for_file(fd, &local_checksum);
+ _volfile_update_checksum(this, key, local_checksum);
+ sys_close(fd);
+ }
+
+ temp_volfile = conf->volfile;
+ while (temp_volfile) {
+ if ((NULL == key) && (NULL == temp_volfile->key))
+ break;
+ if ((NULL == key) || (NULL == temp_volfile->key)) {
+ temp_volfile = temp_volfile->next;
+ continue;
}
+ if (strcmp(temp_volfile->key, key) == 0)
+ break;
+ temp_volfile = temp_volfile->next;
+ }
- if (!temp_volfile)
- goto out;
+ if (!temp_volfile)
+ goto out;
- if ((temp_volfile->checksum) &&
- (checksum != temp_volfile->checksum))
- ret = -1;
+ if ((temp_volfile->checksum) && (checksum != temp_volfile->checksum))
+ ret = -1;
out:
- return ret;
+ return ret;
}
-
int
-server_getspec (rpcsvc_request_t *req)
+server_getspec(rpcsvc_request_t *req)
{
- int32_t ret = -1;
- int32_t op_errno = ENOENT;
- int32_t spec_fd = -1;
- size_t file_len = 0;
- char filename[PATH_MAX] = {0,};
- struct stat stbuf = {0,};
- uint32_t checksum = 0;
- char *key = NULL;
- server_conf_t *conf = NULL;
- xlator_t *this = NULL;
- gf_getspec_req args = {0,};
- gf_getspec_rsp rsp = {0,};
-
- this = req->svc->xl;
- conf = this->private;
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gf_getspec_req);
+ int32_t ret = -1;
+ int32_t op_errno = ENOENT;
+ int32_t spec_fd = -1;
+ size_t file_len = 0;
+ char filename[PATH_MAX] = {
+ 0,
+ };
+ struct stat stbuf = {
+ 0,
+ };
+ uint32_t checksum = 0;
+ char *key = NULL;
+ server_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ gf_getspec_req args = {
+ 0,
+ };
+ gf_getspec_rsp rsp = {
+ 0,
+ };
+
+ this = req->svc->xl;
+ conf = this->private;
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_getspec_req);
+ if (ret < 0) {
+ // failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ op_errno = EINVAL;
+ goto fail;
+ }
+
+ ret = getspec_build_volfile_path(this, args.key, filename,
+ sizeof(filename));
+ if (ret > 0) {
+ /* to allocate the proper buffer to hold the file data */
+ ret = sys_stat(filename, &stbuf);
if (ret < 0) {
- //failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
- op_errno = EINVAL;
- goto fail;
+ gf_msg(this->name, GF_LOG_ERROR, errno, PS_MSG_STAT_ERROR,
+ "Unable to stat %s (%s)", filename, strerror(errno));
+ op_errno = errno;
+ goto fail;
}
- ret = getspec_build_volfile_path (this, args.key,
- filename, sizeof (filename));
- if (ret > 0) {
- /* to allocate the proper buffer to hold the file data */
- ret = sys_stat (filename, &stbuf);
- if (ret < 0){
- gf_msg (this->name, GF_LOG_ERROR, errno,
- PS_MSG_STAT_ERROR, "Unable to stat %s (%s)",
- filename, strerror (errno));
- op_errno = errno;
- goto fail;
- }
-
- spec_fd = open (filename, O_RDONLY);
- if (spec_fd < 0) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- PS_MSG_FILE_OP_FAILED, "Unable to open %s "
- "(%s)", filename, strerror (errno));
- op_errno = errno;
- goto fail;
- }
- ret = file_len = stbuf.st_size;
-
- if (conf->verify_volfile) {
- get_checksum_for_file (spec_fd, &checksum);
- _volfile_update_checksum (this, key, checksum);
- }
+ spec_fd = open(filename, O_RDONLY);
+ if (spec_fd < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, errno, PS_MSG_FILE_OP_FAILED,
+ "Unable to open %s "
+ "(%s)",
+ filename, strerror(errno));
+ op_errno = errno;
+ goto fail;
}
+ ret = file_len = stbuf.st_size;
- if (file_len) {
- rsp.spec = GF_CALLOC (file_len, sizeof (char),
- gf_server_mt_rsp_buf_t);
- if (!rsp.spec) {
- ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
- ret = sys_read (spec_fd, rsp.spec, file_len);
+ if (conf->verify_volfile) {
+ get_checksum_for_file(spec_fd, &checksum);
+ _volfile_update_checksum(this, key, checksum);
}
+ }
+
+ if (file_len) {
+ rsp.spec = GF_CALLOC(file_len, sizeof(char), gf_server_mt_rsp_buf_t);
+ if (!rsp.spec) {
+ ret = -1;
+ op_errno = ENOMEM;
+ goto fail;
+ }
+ ret = sys_read(spec_fd, rsp.spec, file_len);
+ }
- /* convert to XDR */
- op_errno = errno;
+ /* convert to XDR */
+ op_errno = errno;
fail:
- if (!rsp.spec)
- rsp.spec = "";
- rsp.op_errno = gf_errno_to_error (op_errno);
- rsp.op_ret = ret;
+ if (!rsp.spec)
+ rsp.spec = "";
+ rsp.op_errno = gf_errno_to_error(op_errno);
+ rsp.op_ret = ret;
- if (spec_fd != -1)
- sys_close (spec_fd);
+ if (spec_fd != -1)
+ sys_close(spec_fd);
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_getspec_rsp);
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_getspec_rsp);
- return 0;
+ return 0;
}
static void
-server_first_lookup_done (rpcsvc_request_t *req, gf_setvolume_rsp *rsp) {
-
- server_submit_reply (NULL, req, rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_setvolume_rsp);
+server_first_lookup_done(rpcsvc_request_t *req, gf_setvolume_rsp *rsp)
+{
+ server_submit_reply(NULL, req, rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_setvolume_rsp);
- GF_FREE (rsp->dict.dict_val);
- GF_FREE (rsp);
+ GF_FREE(rsp->dict.dict_val);
+ GF_FREE(rsp);
}
static inode_t *
-do_path_lookup (xlator_t *xl, dict_t *dict, inode_t *parinode, char *basename)
+do_path_lookup(xlator_t *xl, dict_t *dict, inode_t *parinode, char *basename)
{
- int ret = 0;
- loc_t loc = {0,};
- uuid_t gfid = {0,};
- struct iatt iatt = {0,};
- inode_t *inode = NULL;
-
- loc.parent = parinode;
- loc_touchup (&loc, basename);
- loc.inode = inode_new (xl->itable);
-
- gf_uuid_generate (gfid);
- ret = dict_set_gfuuid (dict, "gfid-req", gfid, true);
- if (ret) {
- gf_log (xl->name, GF_LOG_ERROR,
- "failed to set 'gfid-req' for subdir");
- goto out;
- }
-
- ret = syncop_lookup (xl, &loc, &iatt, NULL, dict, NULL);
- if (ret < 0) {
- gf_log (xl->name, GF_LOG_ERROR,
- "first lookup on subdir (%s) failed: %s",
- basename, strerror (errno));
- }
+ int ret = 0;
+ loc_t loc = {
+ 0,
+ };
+ uuid_t gfid = {
+ 0,
+ };
+ struct iatt iatt = {
+ 0,
+ };
+ inode_t *inode = NULL;
+
+ loc.parent = parinode;
+ loc_touchup(&loc, basename);
+ loc.inode = inode_new(xl->itable);
+
+ gf_uuid_generate(gfid);
+ ret = dict_set_gfuuid(dict, "gfid-req", gfid, true);
+ if (ret) {
+ gf_log(xl->name, GF_LOG_ERROR, "failed to set 'gfid-req' for subdir");
+ goto out;
+ }
+ ret = syncop_lookup(xl, &loc, &iatt, NULL, dict, NULL);
+ if (ret < 0) {
+ gf_log(xl->name, GF_LOG_ERROR, "first lookup on subdir (%s) failed: %s",
+ basename, strerror(errno));
+ }
- /* Inode linking is required so that the
- resolution happens all fine for future fops */
- inode = inode_link (loc.inode, loc.parent, loc.name, &iatt);
+ /* Inode linking is required so that the
+ resolution happens all fine for future fops */
+ inode = inode_link(loc.inode, loc.parent, loc.name, &iatt);
- /* Extra ref so the pointer is valid till client is valid */
- /* FIXME: not a priority, but this can lead to some inode
- leaks if subdir is more than 1 level depth. Leak is only
- per subdir entry, and not dependent on number of
- connections, so it should be fine for now */
- inode_ref (inode);
+ /* Extra ref so the pointer is valid till client is valid */
+ /* FIXME: not a priority, but this can lead to some inode
+ leaks if subdir is more than 1 level depth. Leak is only
+ per subdir entry, and not dependent on number of
+ connections, so it should be fine for now */
+ inode_ref(inode);
out:
- return inode;
+ return inode;
}
int
-server_first_lookup (xlator_t *this, client_t *client, dict_t *reply)
+server_first_lookup(xlator_t *this, client_t *client, dict_t *reply)
{
- loc_t loc = {0, };
- struct iatt iatt = {0,};
- dict_t *dict = NULL;
- int ret = 0;
- xlator_t *xl = client->bound_xl;
- char *msg = NULL;
- inode_t *inode = NULL;
- char *bname = NULL;
- char *str = NULL;
- char *tmp = NULL;
- char *saveptr = NULL;
-
- loc.path = "/";
- loc.name = "";
- loc.inode = xl->itable->root;
- loc.parent = NULL;
- gf_uuid_copy (loc.gfid, loc.inode->gfid);
-
- ret = syncop_lookup (xl, &loc, &iatt, NULL, NULL, NULL);
- if (ret < 0)
- gf_log (xl->name, GF_LOG_ERROR, "lookup on root failed: %s",
- strerror (errno));
- /* Ignore error from lookup, don't set
- * failure in rsp->op_ret. lookup on a snapview-server
- * can fail with ESTALE
- */
- /* TODO-SUBDIR-MOUNT: validate above comment with respect to subdir lookup */
-
- if (client->subdir_mount) {
- str = tmp = gf_strdup (client->subdir_mount);
- dict = dict_new ();
- inode = xl->itable->root;
- bname = strtok_r (str, "/", &saveptr);
- while (bname != NULL) {
- inode = do_path_lookup (xl, dict, inode, bname);
- if (inode == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
- "first lookup on subdir (%s) failed: %s",
- client->subdir_mount, strerror (errno));
- ret = -1;
- goto fail;
- }
- bname = strtok_r (NULL, "/", &saveptr);
- }
-
- /* Can be used in server_resolve() */
- gf_uuid_copy (client->subdir_gfid, inode->gfid);
- client->subdir_inode = inode;
+ loc_t loc = {
+ 0,
+ };
+ struct iatt iatt = {
+ 0,
+ };
+ dict_t *dict = NULL;
+ int ret = 0;
+ xlator_t *xl = client->bound_xl;
+ char *msg = NULL;
+ inode_t *inode = NULL;
+ char *bname = NULL;
+ char *str = NULL;
+ char *tmp = NULL;
+ char *saveptr = NULL;
+
+ loc.path = "/";
+ loc.name = "";
+ loc.inode = xl->itable->root;
+ loc.parent = NULL;
+ gf_uuid_copy(loc.gfid, loc.inode->gfid);
+
+ ret = syncop_lookup(xl, &loc, &iatt, NULL, NULL, NULL);
+ if (ret < 0)
+ gf_log(xl->name, GF_LOG_ERROR, "lookup on root failed: %s",
+ strerror(errno));
+ /* Ignore error from lookup, don't set
+ * failure in rsp->op_ret. lookup on a snapview-server
+ * can fail with ESTALE
+ */
+ /* TODO-SUBDIR-MOUNT: validate above comment with respect to subdir lookup
+ */
+
+ if (client->subdir_mount) {
+ str = tmp = gf_strdup(client->subdir_mount);
+ dict = dict_new();
+ inode = xl->itable->root;
+ bname = strtok_r(str, "/", &saveptr);
+ while (bname != NULL) {
+ inode = do_path_lookup(xl, dict, inode, bname);
+ if (inode == NULL) {
+ gf_log(this->name, GF_LOG_ERROR,
+ "first lookup on subdir (%s) failed: %s",
+ client->subdir_mount, strerror(errno));
+ ret = -1;
+ goto fail;
+ }
+ bname = strtok_r(NULL, "/", &saveptr);
}
- ret = 0;
- goto out;
+ /* Can be used in server_resolve() */
+ gf_uuid_copy(client->subdir_gfid, inode->gfid);
+ client->subdir_inode = inode;
+ }
-fail:
- /* we should say to client, it is not possible
- to connect */
- ret = gf_asprintf (&msg, "subdirectory for mount \"%s\" is not found",
- client->subdir_mount);
- if (-1 == ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_ASPRINTF_FAILED,
- "asprintf failed while setting error msg");
- }
- ret = dict_set_dynstr (reply, "ERROR", msg);
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
+ ret = 0;
+ goto out;
- ret = -1;
+fail:
+ /* we should say to client, it is not possible
+ to connect */
+ ret = gf_asprintf(&msg, "subdirectory for mount \"%s\" is not found",
+ client->subdir_mount);
+ if (-1 == ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_ASPRINTF_FAILED,
+ "asprintf failed while setting error msg");
+ }
+ ret = dict_set_dynstr(reply, "ERROR", msg);
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+
+ ret = -1;
out:
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- inode_unref (loc.inode);
+ inode_unref(loc.inode);
- if (tmp)
- GF_FREE (tmp);
+ if (tmp)
+ GF_FREE(tmp);
- return ret;
+ return ret;
}
int
-server_setvolume (rpcsvc_request_t *req)
+server_setvolume(rpcsvc_request_t *req)
{
- gf_setvolume_req args = {{0,},};
- gf_setvolume_rsp *rsp = NULL;
- client_t *client = NULL;
- server_ctx_t *serv_ctx = NULL;
- server_conf_t *conf = NULL;
- peer_info_t *peerinfo = NULL;
- dict_t *reply = NULL;
- dict_t *config_params = NULL;
- dict_t *params = NULL;
- char *name = NULL;
- char *client_uid = NULL;
- char *clnt_version = NULL;
- xlator_t *xl = NULL;
- char *msg = NULL;
- char *volfile_key = NULL;
- xlator_t *this = NULL;
- uint32_t checksum = 0;
- int32_t ret = -1;
- int32_t op_ret = -1;
- int32_t op_errno = EINVAL;
- char *buf = NULL;
- uint32_t opversion = 0;
- rpc_transport_t *xprt = NULL;
- int32_t fop_version = 0;
- int32_t mgmt_version = 0;
- glusterfs_ctx_t *ctx = NULL;
- struct _child_status *tmp = NULL;
- char *subdir_mount = NULL;
- char *client_name = NULL;
- gf_boolean_t cleanup_starting = _gf_false;
-
- params = dict_new ();
- reply = dict_new ();
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gf_setvolume_req);
- if (ret < 0) {
- //failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
- goto fail;
- }
- ctx = THIS->ctx;
-
- this = req->svc->xl;
- /* this is to ensure config_params is populated with the first brick
- * details at first place if brick multiplexing is enabled
- */
- config_params = dict_copy_with_ref (this->options, NULL);
-
- buf = memdup (args.dict.dict_val, args.dict.dict_len);
- if (buf == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
-
- ret = dict_unserialize (buf, args.dict.dict_len, &params);
- if (ret < 0) {
- ret = dict_set_str (reply, "ERROR",
- "Internal error: failed to unserialize "
- "request dictionary");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg \"%s\"", "Internal error: failed "
- "to unserialize request dictionary");
-
- op_ret = -1;
- op_errno = EINVAL;
- goto fail;
- }
-
- params->extra_free = buf;
- buf = NULL;
-
- ret = dict_get_str (params, "remote-subvolume", &name);
- if (ret < 0) {
- ret = dict_set_str (reply, "ERROR",
- "No remote-subvolume option specified");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
-
- op_ret = -1;
- op_errno = EINVAL;
- goto fail;
- }
-
- LOCK (&ctx->volfile_lock);
+ gf_setvolume_req args = {
{
- xl = get_xlator_by_name (this, name);
- if (!xl)
- xl = this;
- }
- UNLOCK (&ctx->volfile_lock);
- if (xl == NULL) {
- ret = gf_asprintf (&msg, "remote-subvolume \"%s\" is not found",
- name);
- if (-1 == ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_ASPRINTF_FAILED,
- "asprintf failed while setting error msg");
- goto fail;
- }
- ret = dict_set_dynstr (reply, "ERROR", msg);
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
-
- op_ret = -1;
- op_errno = ENOENT;
- goto fail;
- }
-
- config_params = dict_copy_with_ref (xl->options, config_params);
- conf = this->private;
-
- if (conf->parent_up == _gf_false) {
- /* PARENT_UP indicates that all xlators in graph are inited
- * successfully
- */
- op_ret = -1;
- op_errno = EAGAIN;
-
- ret = dict_set_str (reply, "ERROR",
- "xlator graph in server is not initialised "
- "yet. Try again later");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error: "
- "xlator graph in server is not "
- "initialised yet. Try again later");
- goto fail;
- }
-
- list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
- if (strcmp (tmp->name, name) == 0)
- break;
- }
-
- if (!tmp->name) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_CHILD_STATUS_FAILED,
- "No xlator %s is found in "
- "child status list", name);
- } else {
- ret = dict_set_int32 (reply, "child_up", tmp->child_up);
- if (ret < 0)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_DICT_GET_FAILED,
- "Failed to set 'child_up' for xlator %s "
- "in the reply dict", tmp->name);
- }
-
- ret = dict_get_str (params, "process-uuid", &client_uid);
- if (ret < 0) {
- ret = dict_set_str (reply, "ERROR",
- "UUID not specified");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
-
- op_ret = -1;
- op_errno = EINVAL;
- goto fail;
- }
-
- ret = dict_get_str (params, "subdir-mount", &subdir_mount);
- if (ret < 0) {
- /* Not a problem at all as the key is optional */
- }
- ret = dict_get_str (params, "process-name", &client_name);
- if (ret < 0) {
- client_name = "unknown";
- }
-
- client = gf_client_get (this, &req->cred, client_uid, subdir_mount);
- if (client == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
-
- client->client_name = gf_strdup(client_name);
-
- gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid);
-
- serv_ctx = server_ctx_get (client, client->this);
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- goto fail;
+ 0,
+ },
+ };
+ gf_setvolume_rsp *rsp = NULL;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ server_conf_t *conf = NULL;
+ peer_info_t *peerinfo = NULL;
+ dict_t *reply = NULL;
+ dict_t *config_params = NULL;
+ dict_t *params = NULL;
+ char *name = NULL;
+ char *client_uid = NULL;
+ char *clnt_version = NULL;
+ xlator_t *xl = NULL;
+ char *msg = NULL;
+ char *volfile_key = NULL;
+ xlator_t *this = NULL;
+ uint32_t checksum = 0;
+ int32_t ret = -1;
+ int32_t op_ret = -1;
+ int32_t op_errno = EINVAL;
+ char *buf = NULL;
+ uint32_t opversion = 0;
+ rpc_transport_t *xprt = NULL;
+ int32_t fop_version = 0;
+ int32_t mgmt_version = 0;
+ glusterfs_ctx_t *ctx = NULL;
+ struct _child_status *tmp = NULL;
+ char *subdir_mount = NULL;
+ char *client_name = NULL;
+ gf_boolean_t cleanup_starting = _gf_false;
+
+ params = dict_new();
+ reply = dict_new();
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_setvolume_req);
+ if (ret < 0) {
+ // failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ goto fail;
+ }
+ ctx = THIS->ctx;
+
+ this = req->svc->xl;
+ /* this is to ensure config_params is populated with the first brick
+ * details at first place if brick multiplexing is enabled
+ */
+ config_params = dict_copy_with_ref(this->options, NULL);
+
+ buf = memdup(args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto fail;
+ }
+
+ ret = dict_unserialize(buf, args.dict.dict_len, &params);
+ if (ret < 0) {
+ ret = dict_set_str(reply, "ERROR",
+ "Internal error: failed to unserialize "
+ "request dictionary");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg \"%s\"",
+ "Internal error: failed "
+ "to unserialize request dictionary");
+
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto fail;
+ }
+
+ params->extra_free = buf;
+ buf = NULL;
+
+ ret = dict_get_str(params, "remote-subvolume", &name);
+ if (ret < 0) {
+ ret = dict_set_str(reply, "ERROR",
+ "No remote-subvolume option specified");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto fail;
+ }
+
+ LOCK(&ctx->volfile_lock);
+ {
+ xl = get_xlator_by_name(this, name);
+ if (!xl)
+ xl = this;
+ }
+ UNLOCK(&ctx->volfile_lock);
+ if (xl == NULL) {
+ ret = gf_asprintf(&msg, "remote-subvolume \"%s\" is not found", name);
+ if (-1 == ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_ASPRINTF_FAILED,
+ "asprintf failed while setting error msg");
+ goto fail;
}
+ ret = dict_set_dynstr(reply, "ERROR", msg);
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
- pthread_mutex_lock (&conf->mutex);
- if (xl->cleanup_starting) {
- cleanup_starting = _gf_true;
- } else if (req->trans->xl_private != client) {
- req->trans->xl_private = client;
- }
- pthread_mutex_unlock (&conf->mutex);
+ op_ret = -1;
+ op_errno = ENOENT;
+ goto fail;
+ }
- if (cleanup_starting) {
- op_ret = -1;
- op_errno = EAGAIN;
+ config_params = dict_copy_with_ref(xl->options, config_params);
+ conf = this->private;
- ret = dict_set_str (reply, "ERROR",
- "cleanup flag is set for xlator. "
- " Try again later");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error: "
- "cleanup flag is set for xlator. "
- "Try again later");
- goto fail;
- }
+ if (conf->parent_up == _gf_false) {
+ /* PARENT_UP indicates that all xlators in graph are inited
+ * successfully
+ */
+ op_ret = -1;
+ op_errno = EAGAIN;
- auth_set_username_passwd (params, config_params, client);
- if (req->trans->ssl_name) {
- if (dict_set_str(params,"ssl-name",req->trans->ssl_name) != 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PS_MSG_SSL_NAME_SET_FAILED, "failed to set "
- "ssl_name %s", req->trans->ssl_name);
- /* Not fatal, auth will just fail. */
- }
+ ret = dict_set_str(reply, "ERROR",
+ "xlator graph in server is not initialised "
+ "yet. Try again later");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error: "
+ "xlator graph in server is not "
+ "initialised yet. Try again later");
+ goto fail;
+ }
+
+ list_for_each_entry(tmp, &conf->child_status->status_list, status_list)
+ {
+ if (strcmp(tmp->name, name) == 0)
+ break;
+ }
+
+ if (!tmp->name) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
+ "No xlator %s is found in "
+ "child status list",
+ name);
+ } else {
+ ret = dict_set_int32(reply, "child_up", tmp->child_up);
+ if (ret < 0)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
+ "Failed to set 'child_up' for xlator %s "
+ "in the reply dict",
+ tmp->name);
+ }
+
+ ret = dict_get_str(params, "process-uuid", &client_uid);
+ if (ret < 0) {
+ ret = dict_set_str(reply, "ERROR", "UUID not specified");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto fail;
+ }
+
+ ret = dict_get_str(params, "subdir-mount", &subdir_mount);
+ if (ret < 0) {
+ /* Not a problem at all as the key is optional */
+ }
+ ret = dict_get_str(params, "process-name", &client_name);
+ if (ret < 0) {
+ client_name = "unknown";
+ }
+
+ client = gf_client_get(this, &req->cred, client_uid, subdir_mount);
+ if (client == NULL) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto fail;
+ }
+
+ client->client_name = gf_strdup(client_name);
+
+ gf_msg_debug(this->name, 0, "Connected to %s", client->client_uid);
+
+ serv_ctx = server_ctx_get(client, client->this);
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ goto fail;
+ }
+
+ pthread_mutex_lock(&conf->mutex);
+ if (xl->cleanup_starting) {
+ cleanup_starting = _gf_true;
+ } else if (req->trans->xl_private != client) {
+ req->trans->xl_private = client;
+ }
+ pthread_mutex_unlock(&conf->mutex);
+
+ if (cleanup_starting) {
+ op_ret = -1;
+ op_errno = EAGAIN;
+
+ ret = dict_set_str(reply, "ERROR",
+ "cleanup flag is set for xlator. "
+ " Try again later");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error: "
+ "cleanup flag is set for xlator. "
+ "Try again later");
+ goto fail;
+ }
+
+ auth_set_username_passwd(params, config_params, client);
+ if (req->trans->ssl_name) {
+ if (dict_set_str(params, "ssl-name", req->trans->ssl_name) != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_SSL_NAME_SET_FAILED,
+ "failed to set "
+ "ssl_name %s",
+ req->trans->ssl_name);
+ /* Not fatal, auth will just fail. */
}
+ }
- ret = dict_get_int32 (params, "fops-version", &fop_version);
- if (ret < 0) {
- ret = dict_set_str (reply, "ERROR",
- "No FOP version number specified");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
+ ret = dict_get_int32(params, "fops-version", &fop_version);
+ if (ret < 0) {
+ ret = dict_set_str(reply, "ERROR", "No FOP version number specified");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+ }
+
+ ret = dict_get_int32(params, "mgmt-version", &mgmt_version);
+ if (ret < 0) {
+ ret = dict_set_str(reply, "ERROR", "No MGMT version number specified");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+ }
+
+ ret = gf_compare_client_version(req, fop_version, mgmt_version);
+ if (ret != 0) {
+ ret = gf_asprintf(&msg,
+ "version mismatch: client(%d)"
+ " - client-mgmt(%d)",
+ fop_version, mgmt_version);
+ /* get_supported_version (req)); */
+ if (-1 == ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_ASPRINTF_FAILED,
+ "asprintf failed while"
+ "setting up error msg");
+ goto fail;
}
+ ret = dict_set_dynstr(reply, "ERROR", msg);
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
- ret = dict_get_int32 (params, "mgmt-version", &mgmt_version);
- if (ret < 0) {
- ret = dict_set_str (reply, "ERROR",
- "No MGMT version number specified");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
- }
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto fail;
+ }
- ret = gf_compare_client_version (req, fop_version, mgmt_version);
- if (ret != 0) {
- ret = gf_asprintf (&msg, "version mismatch: client(%d)"
- " - client-mgmt(%d)",
- fop_version, mgmt_version);
- /* get_supported_version (req)); */
- if (-1 == ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_ASPRINTF_FAILED, "asprintf failed while"
- "setting up error msg");
- goto fail;
- }
- ret = dict_set_dynstr (reply, "ERROR", msg);
+ if (conf->verify_volfile) {
+ ret = dict_get_uint32(params, "volfile-checksum", &checksum);
+ if (ret == 0) {
+ ret = dict_get_str(params, "volfile-key", &volfile_key);
+ if (ret)
+ gf_msg_debug(this->name, 0,
+ "failed to get "
+ "'volfile-key'");
+
+ ret = _validate_volfile_checksum(this, volfile_key, checksum);
+ if (-1 == ret) {
+ ret = dict_set_str(reply, "ERROR",
+ "volume-file checksum "
+ "varies from earlier "
+ "access");
if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
+ gf_msg_debug(this->name, 0,
+ "failed "
+ "to set error msg");
op_ret = -1;
- op_errno = EINVAL;
+ op_errno = ESTALE;
goto fail;
+ }
}
+ }
- if (conf->verify_volfile) {
- ret = dict_get_uint32 (params, "volfile-checksum", &checksum);
- if (ret == 0) {
- ret = dict_get_str (params, "volfile-key",
- &volfile_key);
- if (ret)
- gf_msg_debug (this->name, 0, "failed to get "
- "'volfile-key'");
-
- ret = _validate_volfile_checksum (this, volfile_key,
- checksum);
- if (-1 == ret) {
- ret = dict_set_str (reply, "ERROR",
- "volume-file checksum "
- "varies from earlier "
- "access");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed "
- "to set error msg");
-
- op_ret = -1;
- op_errno = ESTALE;
- goto fail;
- }
- }
- }
-
-
- peerinfo = &req->trans->peerinfo;
- if (peerinfo) {
- ret = dict_set_static_ptr (params, "peer-info", peerinfo);
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set "
- "peer-info");
- }
-
- ret = dict_get_uint32 (params, "opversion", &opversion);
- if (ret) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_CLIENT_OPVERSION_GET_FAILED,
- "Failed to get client opversion");
- }
- client->opversion = opversion;
- /* Assign op-version value to the client */
- pthread_mutex_lock (&conf->mutex);
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- if (strcmp (peerinfo->identifier, xprt->peerinfo.identifier))
- continue;
- xprt->peerinfo.max_op_version = opversion;
- }
- pthread_mutex_unlock (&conf->mutex);
-
- if (conf->auth_modules == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
- "Authentication module not initialized");
+ peerinfo = &req->trans->peerinfo;
+ if (peerinfo) {
+ ret = dict_set_static_ptr(params, "peer-info", peerinfo);
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set "
+ "peer-info");
+ }
+
+ ret = dict_get_uint32(params, "opversion", &opversion);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_OPVERSION_GET_FAILED,
+ "Failed to get client opversion");
+ }
+ client->opversion = opversion;
+ /* Assign op-version value to the client */
+ pthread_mutex_lock(&conf->mutex);
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ if (strcmp(peerinfo->identifier, xprt->peerinfo.identifier))
+ continue;
+ xprt->peerinfo.max_op_version = opversion;
+ }
+ pthread_mutex_unlock(&conf->mutex);
+
+ if (conf->auth_modules == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
+ "Authentication module not initialized");
+ }
+
+ ret = dict_get_str(params, "client-version", &clnt_version);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_VERSION_NOT_SET,
+ "client-version not set, may be of older version");
+
+ ret = gf_authenticate(params, config_params, conf->auth_modules);
+
+ if (ret == AUTH_ACCEPT) {
+ /* Store options received from client side */
+ req->trans->clnt_options = dict_ref(params);
+
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_ACCEPTED,
+ "accepted client from %s (version: %s)", client->client_uid,
+ (clnt_version) ? clnt_version : "old");
+
+ gf_event(EVENT_CLIENT_CONNECT,
+ "client_uid=%s;"
+ "client_identifier=%s;server_identifier=%s;"
+ "brick_path=%s;subdir_mount=%s",
+ client->client_uid, req->trans->peerinfo.identifier,
+ req->trans->myinfo.identifier, name, subdir_mount);
+
+ op_ret = 0;
+ client->bound_xl = xl;
+
+ /* Don't be confused by the below line (like how ERROR can
+ be Success), key checked on client is 'ERROR' and hence
+ we send 'Success' in this key */
+ ret = dict_set_str(reply, "ERROR", "Success");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+ } else {
+ gf_event(EVENT_CLIENT_AUTH_REJECT,
+ "client_uid=%s;"
+ "client_identifier=%s;server_identifier=%s;"
+ "brick_path=%s",
+ client->client_uid, req->trans->peerinfo.identifier,
+ req->trans->myinfo.identifier, name);
+ gf_msg(this->name, GF_LOG_ERROR, EACCES, PS_MSG_AUTHENTICATE_ERROR,
+ "Cannot authenticate client"
+ " from %s %s",
+ client->client_uid, (clnt_version) ? clnt_version : "old");
+
+ op_ret = -1;
+ op_errno = EACCES;
+ ret = dict_set_str(reply, "ERROR", "Authentication failed");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+ goto fail;
+ }
+
+ if (client->bound_xl == NULL) {
+ ret = dict_set_str(reply, "ERROR",
+ "Check volfile and handshake "
+ "options in protocol/client");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0,
+ "failed to set error "
+ "msg");
+
+ op_ret = -1;
+ op_errno = EACCES;
+ goto fail;
+ }
+
+ LOCK(&conf->itable_lock);
+ {
+ if (client->bound_xl->itable == NULL) {
+ /* create inode table for this bound_xl, if one doesn't
+ already exist */
+
+ gf_msg_trace(this->name, 0,
+ "creating inode table with"
+ " lru_limit=%" PRId32 ", xlator=%s",
+ conf->inode_lru_limit, client->bound_xl->name);
+
+ /* TODO: what is this ? */
+ client->bound_xl->itable = inode_table_new(conf->inode_lru_limit,
+ client->bound_xl);
}
+ }
+ UNLOCK(&conf->itable_lock);
+
+ ret = dict_set_str(reply, "process-uuid", this->ctx->process_uuid);
+ if (ret)
+ gf_msg_debug(this->name, 0, "failed to set 'process-uuid'");
+
+ /* Insert a dummy key value pair to avoid failure at client side for
+ * clnt-lk-version with older clients.
+ */
+ ret = dict_set_uint32(reply, "clnt-lk-version", 0);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_CLIENT_LK_VERSION_ERROR,
+ "failed to set "
+ "'clnt-lk-version'");
+ }
+
+ ret = dict_set_uint64(reply, "transport-ptr", ((uint64_t)(long)req->trans));
+ if (ret)
+ gf_msg_debug(this->name, 0, "failed to set 'transport-ptr'");
- ret = dict_get_str (params, "client-version", &clnt_version);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_CLIENT_VERSION_NOT_SET,
- "client-version not set, may be of older version");
-
- ret = gf_authenticate (params, config_params,
- conf->auth_modules);
-
- if (ret == AUTH_ACCEPT) {
- /* Store options received from client side */
- req->trans->clnt_options = dict_ref(params);
-
- gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_ACCEPTED,
- "accepted client from %s (version: %s)",
- client->client_uid,
- (clnt_version) ? clnt_version : "old");
-
- gf_event (EVENT_CLIENT_CONNECT, "client_uid=%s;"
- "client_identifier=%s;server_identifier=%s;"
- "brick_path=%s;subdir_mount=%s",
- client->client_uid,
- req->trans->peerinfo.identifier,
- req->trans->myinfo.identifier,
- name, subdir_mount);
-
- op_ret = 0;
- client->bound_xl = xl;
-
- /* Don't be confused by the below line (like how ERROR can
- be Success), key checked on client is 'ERROR' and hence
- we send 'Success' in this key */
- ret = dict_set_str (reply, "ERROR", "Success");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
+fail:
+ /* It is important to validate the lookup on '/' as part of handshake,
+ because if lookup itself can't succeed, we should communicate this
+ to client. Very important in case of subdirectory mounts, where if
+ client is trying to mount a non-existing directory */
+ if (op_ret >= 0 && client->bound_xl->itable) {
+ if (client->bound_xl->cleanup_starting) {
+ op_ret = -1;
+ op_errno = EAGAIN;
+ ret = dict_set_str(reply, "ERROR",
+ "cleanup flag is set for xlator "
+ "before call first_lookup Try again later");
} else {
- gf_event (EVENT_CLIENT_AUTH_REJECT, "client_uid=%s;"
- "client_identifier=%s;server_identifier=%s;"
- "brick_path=%s",
- client->client_uid,
- req->trans->peerinfo.identifier,
- req->trans->myinfo.identifier,
- name);
- gf_msg (this->name, GF_LOG_ERROR, EACCES,
- PS_MSG_AUTHENTICATE_ERROR, "Cannot authenticate client"
- " from %s %s", client->client_uid,
- (clnt_version) ? clnt_version : "old");
-
- op_ret = -1;
- op_errno = EACCES;
- ret = dict_set_str (reply, "ERROR", "Authentication failed");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
- goto fail;
+ op_ret = server_first_lookup(this, client, reply);
+ if (op_ret == -1)
+ op_errno = ENOENT;
}
-
- if (client->bound_xl == NULL) {
- ret = dict_set_str (reply, "ERROR",
- "Check volfile and handshake "
- "options in protocol/client");
- if (ret < 0)
- gf_msg_debug (this->name, 0, "failed to set error "
- "msg");
-
+ }
+
+ rsp = GF_CALLOC(1, sizeof(gf_setvolume_rsp), gf_server_mt_setvolume_rsp_t);
+ GF_ASSERT(rsp);
+
+ rsp->op_ret = 0;
+ rsp->dict.dict_len = dict_serialized_length(reply);
+ if (rsp->dict.dict_len) {
+ rsp->dict.dict_val = GF_CALLOC(1, rsp->dict.dict_len,
+ gf_server_mt_rsp_buf_t);
+ if (rsp->dict.dict_val) {
+ ret = dict_serialize(reply, rsp->dict.dict_val);
+ if (ret < 0) {
+ gf_msg_debug("server-handshake", 0,
+ "failed "
+ "to serialize reply dict");
op_ret = -1;
- op_errno = EACCES;
- goto fail;
- }
-
- LOCK (&conf->itable_lock);
- {
- if (client->bound_xl->itable == NULL) {
- /* create inode table for this bound_xl, if one doesn't
- already exist */
-
- gf_msg_trace (this->name, 0, "creating inode table with"
- " lru_limit=%"PRId32", xlator=%s",
- conf->inode_lru_limit,
- client->bound_xl->name);
-
- /* TODO: what is this ? */
- client->bound_xl->itable =
- inode_table_new (conf->inode_lru_limit,
- client->bound_xl);
- }
+ op_errno = -ret;
+ }
}
- UNLOCK (&conf->itable_lock);
-
- ret = dict_set_str (reply, "process-uuid",
- this->ctx->process_uuid);
- if (ret)
- gf_msg_debug (this->name, 0, "failed to set 'process-uuid'");
-
- /* Insert a dummy key value pair to avoid failure at client side for
- * clnt-lk-version with older clients.
+ }
+ rsp->op_ret = op_ret;
+ rsp->op_errno = gf_errno_to_error(op_errno);
+
+ /* if bound_xl is NULL or something fails, then put the connection
+ * back. Otherwise the connection would have been added to the
+ * list of connections the server is maintaining and might segfault
+ * during statedump when bound_xl of the connection is accessed.
+ */
+ if (op_ret && !xl && (client != NULL)) {
+ /* We would have set the xl_private of the transport to the
+ * @conn. But if we have put the connection i.e shutting down
+ * the connection, then we should set xl_private to NULL as it
+ * would be pointing to a freed memory and would segfault when
+ * accessed upon getting DISCONNECT.
*/
- ret = dict_set_uint32 (reply, "clnt-lk-version", 0);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PS_MSG_CLIENT_LK_VERSION_ERROR, "failed to set "
- "'clnt-lk-version'");
- }
-
- ret = dict_set_uint64 (reply, "transport-ptr",
- ((uint64_t) (long) req->trans));
- if (ret)
- gf_msg_debug (this->name, 0, "failed to set 'transport-ptr'");
+ gf_client_put(client, NULL);
+ req->trans->xl_private = NULL;
+ }
-fail:
- /* It is important to validate the lookup on '/' as part of handshake,
- because if lookup itself can't succeed, we should communicate this
- to client. Very important in case of subdirectory mounts, where if
- client is trying to mount a non-existing directory */
- if (op_ret >= 0 && client->bound_xl->itable) {
- if (client->bound_xl->cleanup_starting) {
- op_ret = -1;
- op_errno = EAGAIN;
- ret = dict_set_str (reply, "ERROR",
- "cleanup flag is set for xlator "
- "before call first_lookup Try again later");
- } else {
- op_ret = server_first_lookup (this, client, reply);
- if (op_ret == -1)
- op_errno = ENOENT;
- }
- }
+ /* Send the response properly */
+ server_first_lookup_done(req, rsp);
- rsp = GF_CALLOC (1, sizeof (gf_setvolume_rsp),
- gf_server_mt_setvolume_rsp_t);
- GF_ASSERT (rsp);
-
- rsp->op_ret = 0;
- rsp->dict.dict_len = dict_serialized_length (reply);
- if (rsp->dict.dict_len) {
- rsp->dict.dict_val = GF_CALLOC (1, rsp->dict.dict_len,
- gf_server_mt_rsp_buf_t);
- if (rsp->dict.dict_val) {
- ret = dict_serialize (reply, rsp->dict.dict_val);
- if (ret < 0) {
- gf_msg_debug ("server-handshake", 0, "failed "
- "to serialize reply dict");
- op_ret = -1;
- op_errno = -ret;
- }
- }
- }
- rsp->op_ret = op_ret;
- rsp->op_errno = gf_errno_to_error (op_errno);
+ free(args.dict.dict_val);
- /* if bound_xl is NULL or something fails, then put the connection
- * back. Otherwise the connection would have been added to the
- * list of connections the server is maintaining and might segfault
- * during statedump when bound_xl of the connection is accessed.
+ dict_unref(params);
+ dict_unref(reply);
+ if (config_params) {
+ /*
+ * This might be null if we couldn't even find the translator
+ * (brick) to copy it from.
*/
- if (op_ret && !xl && (client != NULL)) {
- /* We would have set the xl_private of the transport to the
- * @conn. But if we have put the connection i.e shutting down
- * the connection, then we should set xl_private to NULL as it
- * would be pointing to a freed memory and would segfault when
- * accessed upon getting DISCONNECT.
- */
- gf_client_put (client, NULL);
- req->trans->xl_private = NULL;
- }
+ dict_unref(config_params);
+ }
- /* Send the response properly */
- server_first_lookup_done (req, rsp);
+ GF_FREE(buf);
- free (args.dict.dict_val);
-
- dict_unref (params);
- dict_unref (reply);
- if (config_params) {
- /*
- * This might be null if we couldn't even find the translator
- * (brick) to copy it from.
- */
- dict_unref (config_params);
- }
-
- GF_FREE (buf);
-
- return 0;
+ return 0;
}
-
int
-server_ping (rpcsvc_request_t *req)
+server_ping(rpcsvc_request_t *req)
{
- gf_common_rsp rsp = {0,};
+ gf_common_rsp rsp = {
+ 0,
+ };
- /* Accepted */
- rsp.op_ret = 0;
+ /* Accepted */
+ rsp.op_ret = 0;
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- return 0;
+ return 0;
}
int
-server_set_lk_version (rpcsvc_request_t *req)
+server_set_lk_version(rpcsvc_request_t *req)
{
- int ret = -1;
- gf_set_lk_ver_req args = {0,};
- gf_set_lk_ver_rsp rsp = {0,};
-
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gf_set_lk_ver_req);
- if (ret < 0) {
- /* failed to decode msg */
- req->rpc_err = GARBAGE_ARGS;
- goto fail;
- }
-
- rsp.lk_ver = args.lk_ver;
+ int ret = -1;
+ gf_set_lk_ver_req args = {
+ 0,
+ };
+ gf_set_lk_ver_rsp rsp = {
+ 0,
+ };
+
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gf_set_lk_ver_req);
+ if (ret < 0) {
+ /* failed to decode msg */
+ req->rpc_err = GARBAGE_ARGS;
+ goto fail;
+ }
+
+ rsp.lk_ver = args.lk_ver;
fail:
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_set_lk_ver_rsp);
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_set_lk_ver_rsp);
- free (args.uid);
+ free(args.uid);
- return 0;
+ return 0;
}
rpcsvc_actor_t gluster_handshake_actors[GF_HNDSK_MAXVALUE] = {
- [GF_HNDSK_NULL] = {"NULL", GF_HNDSK_NULL, server_null, NULL, 0, DRC_NA},
- [GF_HNDSK_SETVOLUME] = {"SETVOLUME", GF_HNDSK_SETVOLUME, server_setvolume, NULL, 0, DRC_NA},
- [GF_HNDSK_GETSPEC] = {"GETSPEC", GF_HNDSK_GETSPEC, server_getspec, NULL, 0, DRC_NA},
- [GF_HNDSK_PING] = {"PING", GF_HNDSK_PING, server_ping, NULL, 0, DRC_NA},
- [GF_HNDSK_SET_LK_VER] = {"SET_LK_VER", GF_HNDSK_SET_LK_VER, server_set_lk_version, NULL, 0, DRC_NA},
+ [GF_HNDSK_NULL] = {"NULL", GF_HNDSK_NULL, server_null, NULL, 0, DRC_NA},
+ [GF_HNDSK_SETVOLUME] = {"SETVOLUME", GF_HNDSK_SETVOLUME, server_setvolume,
+ NULL, 0, DRC_NA},
+ [GF_HNDSK_GETSPEC] = {"GETSPEC", GF_HNDSK_GETSPEC, server_getspec, NULL, 0,
+ DRC_NA},
+ [GF_HNDSK_PING] = {"PING", GF_HNDSK_PING, server_ping, NULL, 0, DRC_NA},
+ [GF_HNDSK_SET_LK_VER] = {"SET_LK_VER", GF_HNDSK_SET_LK_VER,
+ server_set_lk_version, NULL, 0, DRC_NA},
};
-
struct rpcsvc_program gluster_handshake_prog = {
- .progname = "GlusterFS Handshake",
- .prognum = GLUSTER_HNDSK_PROGRAM,
- .progver = GLUSTER_HNDSK_VERSION,
- .actors = gluster_handshake_actors,
- .numactors = GF_HNDSK_MAXVALUE,
+ .progname = "GlusterFS Handshake",
+ .prognum = GLUSTER_HNDSK_PROGRAM,
+ .progver = GLUSTER_HNDSK_VERSION,
+ .actors = gluster_handshake_actors,
+ .numactors = GF_HNDSK_MAXVALUE,
};
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index ce2097765b1..cb2a73c7168 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -23,5289 +23,4830 @@
/* based on nfs_fix_aux_groups() */
int
-gid_resolve (server_conf_t *conf, call_stack_t *root)
+gid_resolve(server_conf_t *conf, call_stack_t *root)
{
- int ret = 0;
- struct passwd mypw;
- char mystrs[1024];
- struct passwd *result;
- gid_t *mygroups = NULL;
- gid_list_t gl;
- int ngroups;
- const gid_list_t *agl;
-
- agl = gid_cache_lookup (&conf->gid_cache, root->uid, 0, 0);
- if (agl) {
- root->ngrps = agl->gl_count;
-
- if (root->ngrps > 0) {
- ret = call_stack_alloc_groups (root, agl->gl_count);
- if (ret == 0) {
- memcpy (root->groups, agl->gl_list,
- sizeof (gid_t) * agl->gl_count);
- }
- }
-
- gid_cache_release (&conf->gid_cache, agl);
+ int ret = 0;
+ struct passwd mypw;
+ char mystrs[1024];
+ struct passwd *result;
+ gid_t *mygroups = NULL;
+ gid_list_t gl;
+ int ngroups;
+ const gid_list_t *agl;
+
+ agl = gid_cache_lookup(&conf->gid_cache, root->uid, 0, 0);
+ if (agl) {
+ root->ngrps = agl->gl_count;
- return ret;
+ if (root->ngrps > 0) {
+ ret = call_stack_alloc_groups(root, agl->gl_count);
+ if (ret == 0) {
+ memcpy(root->groups, agl->gl_list,
+ sizeof(gid_t) * agl->gl_count);
+ }
}
- ret = getpwuid_r (root->uid, &mypw, mystrs, sizeof(mystrs), &result);
- if (ret != 0) {
- gf_msg ("gid-cache", GF_LOG_ERROR, errno,
- PS_MSG_GET_UID_FAILED, "getpwuid_r(%u) failed",
- root->uid);
- return -1;
- }
+ gid_cache_release(&conf->gid_cache, agl);
- if (!result) {
- gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND,
- "getpwuid_r(%u) found nothing", root->uid);
- return -1;
- }
+ return ret;
+ }
- gf_msg_trace ("gid-cache", 0, "mapped %u => %s", root->uid,
- result->pw_name);
+ ret = getpwuid_r(root->uid, &mypw, mystrs, sizeof(mystrs), &result);
+ if (ret != 0) {
+ gf_msg("gid-cache", GF_LOG_ERROR, errno, PS_MSG_GET_UID_FAILED,
+ "getpwuid_r(%u) failed", root->uid);
+ return -1;
+ }
- ngroups = gf_getgrouplist (result->pw_name, root->gid, &mygroups);
- if (ngroups == -1) {
- gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
- "could not map %s to group list (%d gids)",
- result->pw_name, root->ngrps);
- return -1;
- }
- root->ngrps = (uint16_t) ngroups;
+ if (!result) {
+ gf_msg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND,
+ "getpwuid_r(%u) found nothing", root->uid);
+ return -1;
+ }
- /* setup a full gid_list_t to add it to the gid_cache */
- gl.gl_id = root->uid;
- gl.gl_uid = root->uid;
- gl.gl_gid = root->gid;
- gl.gl_count = root->ngrps;
+ gf_msg_trace("gid-cache", 0, "mapped %u => %s", root->uid, result->pw_name);
- gl.gl_list = GF_MALLOC (root->ngrps * sizeof(gid_t),
- gf_common_mt_groups_t);
- if (gl.gl_list)
- memcpy (gl.gl_list, mygroups,
- sizeof(gid_t) * root->ngrps);
- else {
- GF_FREE (mygroups);
- return -1;
- }
+ ngroups = gf_getgrouplist(result->pw_name, root->gid, &mygroups);
+ if (ngroups == -1) {
+ gf_msg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
+ "could not map %s to group list (%d gids)", result->pw_name,
+ root->ngrps);
+ return -1;
+ }
+ root->ngrps = (uint16_t)ngroups;
+
+ /* setup a full gid_list_t to add it to the gid_cache */
+ gl.gl_id = root->uid;
+ gl.gl_uid = root->uid;
+ gl.gl_gid = root->gid;
+ gl.gl_count = root->ngrps;
+
+ gl.gl_list = GF_MALLOC(root->ngrps * sizeof(gid_t), gf_common_mt_groups_t);
+ if (gl.gl_list)
+ memcpy(gl.gl_list, mygroups, sizeof(gid_t) * root->ngrps);
+ else {
+ GF_FREE(mygroups);
+ return -1;
+ }
- if (root->ngrps > 0) {
- call_stack_set_groups (root, root->ngrps, &mygroups);
- }
+ if (root->ngrps > 0) {
+ call_stack_set_groups(root, root->ngrps, &mygroups);
+ }
- if (gid_cache_add (&conf->gid_cache, &gl) != 1)
- GF_FREE (gl.gl_list);
+ if (gid_cache_add(&conf->gid_cache, &gl) != 1)
+ GF_FREE(gl.gl_list);
- return ret;
+ return ret;
}
int
-server_resolve_groups (call_frame_t *frame, rpcsvc_request_t *req)
+server_resolve_groups(call_frame_t *frame, rpcsvc_request_t *req)
{
- xlator_t *this = NULL;
- server_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ server_conf_t *conf = NULL;
- GF_VALIDATE_OR_GOTO ("server", frame, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- this = req->trans->xl;
- conf = this->private;
+ this = req->trans->xl;
+ conf = this->private;
- return gid_resolve (conf, frame->root);
+ return gid_resolve(conf, frame->root);
out:
- return -1;
+ return -1;
}
int
-server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
+server_decode_groups(call_frame_t *frame, rpcsvc_request_t *req)
{
- int i = 0;
+ int i = 0;
- GF_VALIDATE_OR_GOTO ("server", frame, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- if (call_stack_alloc_groups (frame->root, req->auxgidcount) != 0)
- return -1;
+ if (call_stack_alloc_groups(frame->root, req->auxgidcount) != 0)
+ return -1;
- frame->root->ngrps = req->auxgidcount;
- if (frame->root->ngrps == 0)
- return 0;
+ frame->root->ngrps = req->auxgidcount;
+ if (frame->root->ngrps == 0)
+ return 0;
- /* ngrps cannot be bigger than USHRT_MAX(65535) */
- if (frame->root->ngrps > GF_MAX_AUX_GROUPS)
- return -1;
+ /* ngrps cannot be bigger than USHRT_MAX(65535) */
+ if (frame->root->ngrps > GF_MAX_AUX_GROUPS)
+ return -1;
- for (; i < frame->root->ngrps; ++i)
- frame->root->groups[i] = req->auxgids[i];
+ for (; i < frame->root->ngrps; ++i)
+ frame->root->groups[i] = req->auxgids[i];
out:
- return 0;
+ return 0;
}
-
void
-server_loc_wipe (loc_t *loc)
+server_loc_wipe(loc_t *loc)
{
- if (loc->parent) {
- inode_unref (loc->parent);
- loc->parent = NULL;
- }
+ if (loc->parent) {
+ inode_unref(loc->parent);
+ loc->parent = NULL;
+ }
- if (loc->inode) {
- inode_unref (loc->inode);
- loc->inode = NULL;
- }
+ if (loc->inode) {
+ inode_unref(loc->inode);
+ loc->inode = NULL;
+ }
- GF_FREE ((void *)loc->path);
+ GF_FREE((void *)loc->path);
}
-
void
-server_resolve_wipe (server_resolve_t *resolve)
+server_resolve_wipe(server_resolve_t *resolve)
{
- GF_FREE ((void *)resolve->path);
+ GF_FREE((void *)resolve->path);
- GF_FREE ((void *)resolve->bname);
+ GF_FREE((void *)resolve->bname);
- loc_wipe (&resolve->resolve_loc);
+ loc_wipe(&resolve->resolve_loc);
}
-
void
-free_state (server_state_t *state)
+free_state(server_state_t *state)
{
- if (state->fd) {
- fd_unref (state->fd);
- state->fd = NULL;
- }
-
- if (state->params) {
- dict_unref (state->params);
- state->params = NULL;
- }
-
- if (state->iobref) {
- iobref_unref (state->iobref);
- state->iobref = NULL;
- }
-
- if (state->iobuf) {
- iobuf_unref (state->iobuf);
- state->iobuf = NULL;
- }
-
- if (state->dict) {
- dict_unref (state->dict);
- state->dict = NULL;
- }
-
- if (state->xdata) {
- dict_unref (state->xdata);
- state->xdata = NULL;
- }
-
- GF_FREE ((void *)state->volume);
-
- GF_FREE ((void *)state->name);
-
- server_loc_wipe (&state->loc);
- server_loc_wipe (&state->loc2);
-
- server_resolve_wipe (&state->resolve);
- server_resolve_wipe (&state->resolve2);
-
- compound_args_cleanup (state->args);
-
- /* Call rpc_trnasport_unref to avoid crashes at last after free
- all resources because of server_rpc_notify (for transport destroy)
- call's xlator_mem_cleanup if all xprt are destroyed that internally
- call's inode_table_destroy.
- */
- if (state->xprt) {
- rpc_transport_unref (state->xprt);
- state->xprt = NULL;
- }
-
-
- GF_FREE (state);
+ if (state->fd) {
+ fd_unref(state->fd);
+ state->fd = NULL;
+ }
+
+ if (state->params) {
+ dict_unref(state->params);
+ state->params = NULL;
+ }
+
+ if (state->iobref) {
+ iobref_unref(state->iobref);
+ state->iobref = NULL;
+ }
+
+ if (state->iobuf) {
+ iobuf_unref(state->iobuf);
+ state->iobuf = NULL;
+ }
+
+ if (state->dict) {
+ dict_unref(state->dict);
+ state->dict = NULL;
+ }
+
+ if (state->xdata) {
+ dict_unref(state->xdata);
+ state->xdata = NULL;
+ }
+
+ GF_FREE((void *)state->volume);
+
+ GF_FREE((void *)state->name);
+
+ server_loc_wipe(&state->loc);
+ server_loc_wipe(&state->loc2);
+
+ server_resolve_wipe(&state->resolve);
+ server_resolve_wipe(&state->resolve2);
+
+ compound_args_cleanup(state->args);
+
+ /* Call rpc_trnasport_unref to avoid crashes at last after free
+ all resources because of server_rpc_notify (for transport destroy)
+ call's xlator_mem_cleanup if all xprt are destroyed that internally
+ call's inode_table_destroy.
+ */
+ if (state->xprt) {
+ rpc_transport_unref(state->xprt);
+ state->xprt = NULL;
+ }
+
+ GF_FREE(state);
}
-
static int
-server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie,
- xlator_t *this, int32_t op_ret,
- int32_t op_errno, dict_t *xdata)
+server_connection_cleanup_flush_cbk(call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, dict_t *xdata)
{
- int32_t ret = -1;
- fd_t *fd = NULL;
- client_t *client = NULL;
+ int32_t ret = -1;
+ fd_t *fd = NULL;
+ client_t *client = NULL;
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
- fd = frame->local;
- client = frame->root->client;
+ fd = frame->local;
+ client = frame->root->client;
- fd_unref (fd);
- frame->local = NULL;
+ fd_unref(fd);
+ frame->local = NULL;
- gf_client_unref (client);
- STACK_DESTROY (frame->root);
+ gf_client_unref(client);
+ STACK_DESTROY(frame->root);
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
static int
-do_fd_cleanup (xlator_t *this, client_t* client, fdentry_t *fdentries, int fd_count)
+do_fd_cleanup(xlator_t *this, client_t *client, fdentry_t *fdentries,
+ int fd_count)
{
- fd_t *fd = NULL;
- int i = 0, ret = -1;
- call_frame_t *tmp_frame = NULL;
- xlator_t *bound_xl = NULL;
- char *path = NULL;
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", fdentries, out);
-
- bound_xl = client->bound_xl;
- for (i = 0;i < fd_count; i++) {
- fd = fdentries[i].fd;
-
- if (fd != NULL) {
- tmp_frame = create_frame (this, this->ctx->pool);
- if (tmp_frame == NULL) {
- goto out;
- }
-
- GF_ASSERT (fd->inode);
-
- ret = inode_path (fd->inode, NULL, &path);
-
- if (ret > 0) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_FD_CLEANUP,
- "fd cleanup on %s", path);
- GF_FREE (path);
- } else {
-
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_FD_CLEANUP,
- "fd cleanup on inode with gfid %s",
- uuid_utoa (fd->inode->gfid));
- }
-
- tmp_frame->local = fd;
- tmp_frame->root->pid = 0;
- gf_client_ref (client);
- tmp_frame->root->client = client;
- memset (&tmp_frame->root->lk_owner, 0,
- sizeof (gf_lkowner_t));
-
- STACK_WIND (tmp_frame,
- server_connection_cleanup_flush_cbk,
- bound_xl, bound_xl->fops->flush, fd, NULL);
- }
- }
+ fd_t *fd = NULL;
+ int i = 0, ret = -1;
+ call_frame_t *tmp_frame = NULL;
+ xlator_t *bound_xl = NULL;
+ char *path = NULL;
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", fdentries, out);
+
+ bound_xl = client->bound_xl;
+ for (i = 0; i < fd_count; i++) {
+ fd = fdentries[i].fd;
+
+ if (fd != NULL) {
+ tmp_frame = create_frame(this, this->ctx->pool);
+ if (tmp_frame == NULL) {
+ goto out;
+ }
- GF_FREE (fdentries);
- ret = 0;
+ GF_ASSERT(fd->inode);
-out:
- return ret;
-}
+ ret = inode_path(fd->inode, NULL, &path);
+ if (ret > 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
+ "fd cleanup on %s", path);
+ GF_FREE(path);
+ } else {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
+ "fd cleanup on inode with gfid %s",
+ uuid_utoa(fd->inode->gfid));
+ }
-int
-server_connection_cleanup (xlator_t *this, client_t *client,
- int32_t flags)
-{
- server_ctx_t *serv_ctx = NULL;
- fdentry_t *fdentries = NULL;
- uint32_t fd_count = 0;
- int cd_ret = 0;
- int ret = 0;
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO (this->name, client, out);
- GF_VALIDATE_OR_GOTO (this->name, flags, out);
-
- serv_ctx = server_ctx_get (client, client->this);
-
- if (serv_ctx == NULL) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- goto out;
- }
+ tmp_frame->local = fd;
+ tmp_frame->root->pid = 0;
+ gf_client_ref(client);
+ tmp_frame->root->client = client;
+ memset(&tmp_frame->root->lk_owner, 0, sizeof(gf_lkowner_t));
- LOCK (&serv_ctx->fdtable_lock);
- {
- if (serv_ctx->fdtable && (flags & POSIX_LOCKS))
- fdentries = gf_fd_fdtable_get_all_fds (serv_ctx->fdtable,
- &fd_count);
+ STACK_WIND(tmp_frame, server_connection_cleanup_flush_cbk, bound_xl,
+ bound_xl->fops->flush, fd, NULL);
}
- UNLOCK (&serv_ctx->fdtable_lock);
+ }
- if (client->bound_xl == NULL)
- goto out;
+ GF_FREE(fdentries);
+ ret = 0;
- if (flags & INTERNAL_LOCKS) {
- cd_ret = gf_client_disconnect (client);
- }
-
- if (fdentries != NULL) {
- gf_msg_debug (this->name, 0, "Performing cleanup on %d "
- "fdentries", fd_count);
- ret = do_fd_cleanup (this, client, fdentries, fd_count);
- }
- else
- gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL,
- "no fdentries to clean");
+out:
+ return ret;
+}
- if (cd_ret || ret)
- ret = -1;
+int
+server_connection_cleanup(xlator_t *this, client_t *client, int32_t flags)
+{
+ server_ctx_t *serv_ctx = NULL;
+ fdentry_t *fdentries = NULL;
+ uint32_t fd_count = 0;
+ int cd_ret = 0;
+ int ret = 0;
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, client, out);
+ GF_VALIDATE_OR_GOTO(this->name, flags, out);
+
+ serv_ctx = server_ctx_get(client, client->this);
+
+ if (serv_ctx == NULL) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ goto out;
+ }
+
+ LOCK(&serv_ctx->fdtable_lock);
+ {
+ if (serv_ctx->fdtable && (flags & POSIX_LOCKS))
+ fdentries = gf_fd_fdtable_get_all_fds(serv_ctx->fdtable, &fd_count);
+ }
+ UNLOCK(&serv_ctx->fdtable_lock);
+
+ if (client->bound_xl == NULL)
+ goto out;
+
+ if (flags & INTERNAL_LOCKS) {
+ cd_ret = gf_client_disconnect(client);
+ }
+
+ if (fdentries != NULL) {
+ gf_msg_debug(this->name, 0,
+ "Performing cleanup on %d "
+ "fdentries",
+ fd_count);
+ ret = do_fd_cleanup(this, client, fdentries, fd_count);
+ } else
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL,
+ "no fdentries to clean");
+
+ if (cd_ret || ret)
+ ret = -1;
out:
- return ret;
+ return ret;
}
-
static call_frame_t *
-server_alloc_frame (rpcsvc_request_t *req)
+server_alloc_frame(rpcsvc_request_t *req)
{
- call_frame_t *frame = NULL;
- server_state_t *state = NULL;
- client_t *client = NULL;
+ call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
+ client_t *client = NULL;
- GF_VALIDATE_OR_GOTO ("server", req, out);
- GF_VALIDATE_OR_GOTO ("server", req->trans, out);
- GF_VALIDATE_OR_GOTO ("server", req->svc, out);
- GF_VALIDATE_OR_GOTO ("server", req->svc->ctx, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
+ GF_VALIDATE_OR_GOTO("server", req->trans, out);
+ GF_VALIDATE_OR_GOTO("server", req->svc, out);
+ GF_VALIDATE_OR_GOTO("server", req->svc->ctx, out);
- client = req->trans->xl_private;
- GF_VALIDATE_OR_GOTO ("server", client, out);
+ client = req->trans->xl_private;
+ GF_VALIDATE_OR_GOTO("server", client, out);
- frame = create_frame (client->this, req->svc->ctx->pool);
- if (!frame)
- goto out;
+ frame = create_frame(client->this, req->svc->ctx->pool);
+ if (!frame)
+ goto out;
- state = GF_CALLOC (1, sizeof (*state), gf_server_mt_state_t);
- if (!state)
- goto out;
+ state = GF_CALLOC(1, sizeof(*state), gf_server_mt_state_t);
+ if (!state)
+ goto out;
- if (client->bound_xl)
- state->itable = client->bound_xl->itable;
+ if (client->bound_xl)
+ state->itable = client->bound_xl->itable;
- state->xprt = rpc_transport_ref (req->trans);
- state->resolve.fd_no = -1;
- state->resolve2.fd_no = -1;
+ state->xprt = rpc_transport_ref(req->trans);
+ state->resolve.fd_no = -1;
+ state->resolve2.fd_no = -1;
- frame->root->client = client;
- frame->root->state = state; /* which socket */
- frame->root->unique = 0; /* which call */
+ frame->root->client = client;
+ frame->root->state = state; /* which socket */
+ frame->root->unique = 0; /* which call */
- frame->this = client->this;
+ frame->this = client->this;
out:
- return frame;
+ return frame;
}
-
call_frame_t *
-get_frame_from_request (rpcsvc_request_t *req)
+get_frame_from_request(rpcsvc_request_t *req)
{
- call_frame_t *frame = NULL;
- client_t *client = NULL;
- client_t *tmp_client = NULL;
- xlator_t *this = NULL;
- server_conf_t *priv = NULL;
- clienttable_t *clienttable = NULL;
- unsigned int i = 0;
- rpc_transport_t *trans = NULL;
- server_state_t *state = NULL;
-
- GF_VALIDATE_OR_GOTO ("server", req, out);
-
- client = req->trans->xl_private;
-
- frame = server_alloc_frame (req);
- if (!frame)
- goto out;
-
- frame->root->op = req->procnum;
-
- frame->root->unique = req->xid;
-
- client = req->trans->xl_private;
- this = req->trans->xl;
- priv = this->private;
- clienttable = this->ctx->clienttable;
-
- for (i = 0; i < clienttable->max_clients; i++) {
- tmp_client = clienttable->cliententries[i].client;
- if (client == tmp_client) {
- /* for non trusted clients username and password
- would not have been set. So for non trusted clients
- (i.e clients not from the same machine as the brick,
- and clients from outside the storage pool)
- do the root-squashing.
- TODO: If any client within the storage pool (i.e
- mounting within a machine from the pool but using
- other machine's ip/hostname from the same pool)
- is present treat it as a trusted client
- */
- if (!client->auth.username && req->pid != NFS_PID)
- RPC_AUTH_ROOT_SQUASH (req);
-
- /* Problem: If we just check whether the client is
- trusted client and do not do root squashing for
- them, then for smb clients and UFO clients root
- squashing will never happen as they use the fuse
- mounts done within the trusted pool (i.e they are
- trusted clients).
- Solution: To fix it, do root squashing for trusted
- clients also. If one wants to have a client within
- the storage pool for which root-squashing does not
- happen, then the client has to be mounted with
- --no-root-squash option. But for defrag client and
- gsyncd client do not do root-squashing.
- */
- if (client->auth.username &&
- req->pid != GF_CLIENT_PID_NO_ROOT_SQUASH &&
- req->pid != GF_CLIENT_PID_GSYNCD &&
- req->pid != GF_CLIENT_PID_DEFRAG &&
- req->pid != GF_CLIENT_PID_SELF_HEALD &&
- req->pid != GF_CLIENT_PID_QUOTA_MOUNT)
- RPC_AUTH_ROOT_SQUASH (req);
-
- /* For nfs clients the server processes will be running
- within the trusted storage pool machines. So if we
- do not do root-squashing for nfs servers, thinking
- that its a trusted client, then root-squashing won't
- work for nfs clients.
- */
- if (req->pid == NFS_PID)
- RPC_AUTH_ROOT_SQUASH (req);
- }
- }
-
- /* Add a ref for this fop */
- if (client)
- gf_client_ref (client);
-
- frame->root->uid = req->uid;
- frame->root->gid = req->gid;
- frame->root->pid = req->pid;
- frame->root->client = client;
- frame->root->lk_owner = req->lk_owner;
-
- if (priv->server_manage_gids)
- server_resolve_groups (frame, req);
- else
- server_decode_groups (frame, req);
- trans = req->trans;
- if (trans) {
- memcpy (&frame->root->identifier, trans->peerinfo.identifier,
- sizeof (trans->peerinfo.identifier));
- }
-
- /* more fields, for the clients which are 3.x series this will be 0 */
- frame->root->flags = req->flags;
- frame->root->ctime = req->ctime;
-
- frame->local = req;
-
- state = CALL_STATE (frame);
- state->client = client;
+ call_frame_t *frame = NULL;
+ client_t *client = NULL;
+ client_t *tmp_client = NULL;
+ xlator_t *this = NULL;
+ server_conf_t *priv = NULL;
+ clienttable_t *clienttable = NULL;
+ unsigned int i = 0;
+ rpc_transport_t *trans = NULL;
+ server_state_t *state = NULL;
+
+ GF_VALIDATE_OR_GOTO("server", req, out);
+
+ client = req->trans->xl_private;
+
+ frame = server_alloc_frame(req);
+ if (!frame)
+ goto out;
+
+ frame->root->op = req->procnum;
+
+ frame->root->unique = req->xid;
+
+ client = req->trans->xl_private;
+ this = req->trans->xl;
+ priv = this->private;
+ clienttable = this->ctx->clienttable;
+
+ for (i = 0; i < clienttable->max_clients; i++) {
+ tmp_client = clienttable->cliententries[i].client;
+ if (client == tmp_client) {
+ /* for non trusted clients username and password
+ would not have been set. So for non trusted clients
+ (i.e clients not from the same machine as the brick,
+ and clients from outside the storage pool)
+ do the root-squashing.
+ TODO: If any client within the storage pool (i.e
+ mounting within a machine from the pool but using
+ other machine's ip/hostname from the same pool)
+ is present treat it as a trusted client
+ */
+ if (!client->auth.username && req->pid != NFS_PID)
+ RPC_AUTH_ROOT_SQUASH(req);
+
+ /* Problem: If we just check whether the client is
+ trusted client and do not do root squashing for
+ them, then for smb clients and UFO clients root
+ squashing will never happen as they use the fuse
+ mounts done within the trusted pool (i.e they are
+ trusted clients).
+ Solution: To fix it, do root squashing for trusted
+ clients also. If one wants to have a client within
+ the storage pool for which root-squashing does not
+ happen, then the client has to be mounted with
+ --no-root-squash option. But for defrag client and
+ gsyncd client do not do root-squashing.
+ */
+ if (client->auth.username &&
+ req->pid != GF_CLIENT_PID_NO_ROOT_SQUASH &&
+ req->pid != GF_CLIENT_PID_GSYNCD &&
+ req->pid != GF_CLIENT_PID_DEFRAG &&
+ req->pid != GF_CLIENT_PID_SELF_HEALD &&
+ req->pid != GF_CLIENT_PID_QUOTA_MOUNT)
+ RPC_AUTH_ROOT_SQUASH(req);
+
+ /* For nfs clients the server processes will be running
+ within the trusted storage pool machines. So if we
+ do not do root-squashing for nfs servers, thinking
+ that its a trusted client, then root-squashing won't
+ work for nfs clients.
+ */
+ if (req->pid == NFS_PID)
+ RPC_AUTH_ROOT_SQUASH(req);
+ }
+ }
+
+ /* Add a ref for this fop */
+ if (client)
+ gf_client_ref(client);
+
+ frame->root->uid = req->uid;
+ frame->root->gid = req->gid;
+ frame->root->pid = req->pid;
+ frame->root->client = client;
+ frame->root->lk_owner = req->lk_owner;
+
+ if (priv->server_manage_gids)
+ server_resolve_groups(frame, req);
+ else
+ server_decode_groups(frame, req);
+ trans = req->trans;
+ if (trans) {
+ memcpy(&frame->root->identifier, trans->peerinfo.identifier,
+ sizeof(trans->peerinfo.identifier));
+ }
+
+ /* more fields, for the clients which are 3.x series this will be 0 */
+ frame->root->flags = req->flags;
+ frame->root->ctime = req->ctime;
+
+ frame->local = req;
+
+ state = CALL_STATE(frame);
+ state->client = client;
out:
- return frame;
+ return frame;
}
-
int
-server_build_config (xlator_t *this, server_conf_t *conf)
+server_build_config(xlator_t *this, server_conf_t *conf)
{
- data_t *data = NULL;
- int ret = -1;
- struct stat buf = {0,};
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", conf, out);
-
- ret = dict_get_int32 (this->options, "inode-lru-limit",
- &conf->inode_lru_limit);
- if (ret < 0) {
- conf->inode_lru_limit = 16384;
- }
-
- conf->verify_volfile = 1;
- data = dict_get (this->options, "verify-volfile-checksum");
- if (data) {
- ret = gf_string2boolean(data->data, &conf->verify_volfile);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PS_MSG_INVALID_ENTRY, "wrong value for '"
- "verify-volfile-checksum', Neglecting option");
- }
- }
-
- data = dict_get (this->options, "trace");
- if (data) {
- ret = gf_string2boolean (data->data, &conf->trace);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PS_MSG_INVALID_ENTRY, "'trace' takes on only "
- "boolean values. Neglecting option");
- }
+ data_t *data = NULL;
+ int ret = -1;
+ struct stat buf = {
+ 0,
+ };
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", conf, out);
+
+ ret = dict_get_int32(this->options, "inode-lru-limit",
+ &conf->inode_lru_limit);
+ if (ret < 0) {
+ conf->inode_lru_limit = 16384;
+ }
+
+ conf->verify_volfile = 1;
+ data = dict_get(this->options, "verify-volfile-checksum");
+ if (data) {
+ ret = gf_string2boolean(data->data, &conf->verify_volfile);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ "wrong value for '"
+ "verify-volfile-checksum', Neglecting option");
}
+ }
- /* TODO: build_rpc_config (); */
- ret = dict_get_int32 (this->options, "limits.transaction-size",
- &conf->rpc_conf.max_block_size);
- if (ret < 0) {
- gf_msg_trace (this->name, 0, "defaulting limits.transaction-"
- "size to %d", DEFAULT_BLOCK_SIZE);
- conf->rpc_conf.max_block_size = DEFAULT_BLOCK_SIZE;
- }
-
- data = dict_get (this->options, "config-directory");
- if (data) {
- /* Check whether the specified directory exists,
- or directory specified is non standard */
- ret = sys_stat (data->data, &buf);
- if ((ret != 0) || !S_ISDIR (buf.st_mode)) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_DIR_NOT_FOUND, "Directory '%s' doesn't "
- "exist, exiting.", data->data);
- ret = -1;
- goto out;
- }
- /* Make sure that conf-dir doesn't contain ".." in path */
- if ((gf_strstr (data->data, "/", "..")) == -1) {
- ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_CONF_DIR_INVALID,
- "%s: invalid conf_dir", data->data);
- goto out;
- }
-
- conf->conf_dir = gf_strdup (data->data);
- }
- ret = 0;
+ data = dict_get(this->options, "trace");
+ if (data) {
+ ret = gf_string2boolean(data->data, &conf->trace);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ "'trace' takes on only "
+ "boolean values. Neglecting option");
+ }
+ }
+
+ /* TODO: build_rpc_config (); */
+ ret = dict_get_int32(this->options, "limits.transaction-size",
+ &conf->rpc_conf.max_block_size);
+ if (ret < 0) {
+ gf_msg_trace(this->name, 0,
+ "defaulting limits.transaction-"
+ "size to %d",
+ DEFAULT_BLOCK_SIZE);
+ conf->rpc_conf.max_block_size = DEFAULT_BLOCK_SIZE;
+ }
+
+ data = dict_get(this->options, "config-directory");
+ if (data) {
+ /* Check whether the specified directory exists,
+ or directory specified is non standard */
+ ret = sys_stat(data->data, &buf);
+ if ((ret != 0) || !S_ISDIR(buf.st_mode)) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_DIR_NOT_FOUND,
+ "Directory '%s' doesn't "
+ "exist, exiting.",
+ data->data);
+ ret = -1;
+ goto out;
+ }
+ /* Make sure that conf-dir doesn't contain ".." in path */
+ if ((gf_strstr(data->data, "/", "..")) == -1) {
+ ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CONF_DIR_INVALID,
+ "%s: invalid conf_dir", data->data);
+ goto out;
+ }
+
+ conf->conf_dir = gf_strdup(data->data);
+ }
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
void
-print_caller (char *str, int size, call_frame_t *frame)
+print_caller(char *str, int size, call_frame_t *frame)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- GF_VALIDATE_OR_GOTO ("server", str, out);
- GF_VALIDATE_OR_GOTO ("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", str, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- snprintf (str, size,
- " Callid=%"PRId64", Client=%s",
- frame->root->unique,
- state->xprt->peerinfo.identifier);
+ snprintf(str, size, " Callid=%" PRId64 ", Client=%s", frame->root->unique,
+ state->xprt->peerinfo.identifier);
out:
- return;
+ return;
}
-
void
-server_print_resolve (char *str, int size, server_resolve_t *resolve)
+server_print_resolve(char *str, int size, server_resolve_t *resolve)
{
- int filled = 0;
+ int filled = 0;
- GF_VALIDATE_OR_GOTO ("server", str, out);
+ GF_VALIDATE_OR_GOTO("server", str, out);
- if (!resolve) {
- snprintf (str, size, "<nul>");
- return;
- }
-
- filled += snprintf (str + filled, size - filled,
- " Resolve={");
- if (resolve->fd_no != -1)
- filled += snprintf (str + filled, size - filled,
- "fd=%"PRId64",", (uint64_t) resolve->fd_no);
- if (resolve->bname)
- filled += snprintf (str + filled, size - filled,
- "bname=%s,", resolve->bname);
- if (resolve->path)
- filled += snprintf (str + filled, size - filled,
- "path=%s", resolve->path);
-
- snprintf (str + filled, size - filled, "}");
-out:
+ if (!resolve) {
+ snprintf(str, size, "<nul>");
return;
+ }
+
+ filled += snprintf(str + filled, size - filled, " Resolve={");
+ if (resolve->fd_no != -1)
+ filled += snprintf(str + filled, size - filled, "fd=%" PRId64 ",",
+ (uint64_t)resolve->fd_no);
+ if (resolve->bname)
+ filled += snprintf(str + filled, size - filled, "bname=%s,",
+ resolve->bname);
+ if (resolve->path)
+ filled += snprintf(str + filled, size - filled, "path=%s",
+ resolve->path);
+
+ snprintf(str + filled, size - filled, "}");
+out:
+ return;
}
-
void
-server_print_loc (char *str, int size, loc_t *loc)
+server_print_loc(char *str, int size, loc_t *loc)
{
- int filled = 0;
+ int filled = 0;
- GF_VALIDATE_OR_GOTO ("server", str, out);
+ GF_VALIDATE_OR_GOTO("server", str, out);
- if (!loc) {
- snprintf (str, size, "<nul>");
- return;
- }
+ if (!loc) {
+ snprintf(str, size, "<nul>");
+ return;
+ }
- filled += snprintf (str + filled, size - filled,
- " Loc={");
+ filled += snprintf(str + filled, size - filled, " Loc={");
- if (loc->path)
- filled += snprintf (str + filled, size - filled,
- "path=%s,", loc->path);
- if (loc->inode)
- filled += snprintf (str + filled, size - filled,
- "inode=%p,", loc->inode);
- if (loc->parent)
- filled += snprintf (str + filled, size - filled,
- "parent=%p", loc->parent);
+ if (loc->path)
+ filled += snprintf(str + filled, size - filled, "path=%s,", loc->path);
+ if (loc->inode)
+ filled += snprintf(str + filled, size - filled, "inode=%p,",
+ loc->inode);
+ if (loc->parent)
+ filled += snprintf(str + filled, size - filled, "parent=%p",
+ loc->parent);
- snprintf (str + filled, size - filled, "}");
+ snprintf(str + filled, size - filled, "}");
out:
- return;
+ return;
}
-
void
-server_print_params (char *str, int size, server_state_t *state)
+server_print_params(char *str, int size, server_state_t *state)
{
- int filled = 0;
-
- GF_VALIDATE_OR_GOTO ("server", str, out);
-
- filled += snprintf (str + filled, size - filled,
- " Params={");
-
- if (state->fd)
- filled += snprintf (str + filled, size - filled,
- "fd=%p,", state->fd);
- if (state->valid)
- filled += snprintf (str + filled, size - filled,
- "valid=%d,", state->valid);
- if (state->flags)
- filled += snprintf (str + filled, size - filled,
- "flags=%d,", state->flags);
- if (state->wbflags)
- filled += snprintf (str + filled, size - filled,
- "wbflags=%d,", state->wbflags);
- if (state->size)
- filled += snprintf (str + filled, size - filled,
- "size=%zu,", state->size);
- if (state->offset)
- filled += snprintf (str + filled, size - filled,
- "offset=%"PRId64",", state->offset);
- if (state->cmd)
- filled += snprintf (str + filled, size - filled,
- "cmd=%d,", state->cmd);
- if (state->type)
- filled += snprintf (str + filled, size - filled,
- "type=%d,", state->type);
- if (state->name)
- filled += snprintf (str + filled, size - filled,
- "name=%s,", state->name);
- if (state->mask)
- filled += snprintf (str + filled, size - filled,
- "mask=%d,", state->mask);
- if (state->volume)
- filled += snprintf (str + filled, size - filled,
- "volume=%s,", state->volume);
+ int filled = 0;
+
+ GF_VALIDATE_OR_GOTO("server", str, out);
+
+ filled += snprintf(str + filled, size - filled, " Params={");
+
+ if (state->fd)
+ filled += snprintf(str + filled, size - filled, "fd=%p,", state->fd);
+ if (state->valid)
+ filled += snprintf(str + filled, size - filled, "valid=%d,",
+ state->valid);
+ if (state->flags)
+ filled += snprintf(str + filled, size - filled, "flags=%d,",
+ state->flags);
+ if (state->wbflags)
+ filled += snprintf(str + filled, size - filled, "wbflags=%d,",
+ state->wbflags);
+ if (state->size)
+ filled += snprintf(str + filled, size - filled, "size=%zu,",
+ state->size);
+ if (state->offset)
+ filled += snprintf(str + filled, size - filled, "offset=%" PRId64 ",",
+ state->offset);
+ if (state->cmd)
+ filled += snprintf(str + filled, size - filled, "cmd=%d,", state->cmd);
+ if (state->type)
+ filled += snprintf(str + filled, size - filled, "type=%d,",
+ state->type);
+ if (state->name)
+ filled += snprintf(str + filled, size - filled, "name=%s,",
+ state->name);
+ if (state->mask)
+ filled += snprintf(str + filled, size - filled, "mask=%d,",
+ state->mask);
+ if (state->volume)
+ filled += snprintf(str + filled, size - filled, "volume=%s,",
+ state->volume);
/* FIXME
snprintf (str + filled, size - filled,
"bound_xl=%s}", state->client->bound_xl->name);
*/
out:
- return;
+ return;
}
-
int
-server_resolve_is_empty (server_resolve_t *resolve)
+server_resolve_is_empty(server_resolve_t *resolve)
{
- if (resolve->fd_no != -1)
- return 0;
+ if (resolve->fd_no != -1)
+ return 0;
- if (resolve->path != 0)
- return 0;
+ if (resolve->path != 0)
+ return 0;
- if (resolve->bname != 0)
- return 0;
+ if (resolve->bname != 0)
+ return 0;
- return 1;
+ return 1;
}
-
void
-server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
+server_print_reply(call_frame_t *frame, int op_ret, int op_errno)
{
- server_conf_t *conf = NULL;
- server_state_t *state = NULL;
- xlator_t *this = NULL;
- char caller[512];
- char fdstr[32];
- char *op = "UNKNOWN";
+ server_conf_t *conf = NULL;
+ server_state_t *state = NULL;
+ xlator_t *this = NULL;
+ char caller[512];
+ char fdstr[32];
+ char *op = "UNKNOWN";
- GF_VALIDATE_OR_GOTO ("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
- this = frame->this;
- conf = this->private;
+ this = frame->this;
+ conf = this->private;
- GF_VALIDATE_OR_GOTO ("server", conf, out);
- GF_VALIDATE_OR_GOTO ("server", conf->trace, out);
+ GF_VALIDATE_OR_GOTO("server", conf, out);
+ GF_VALIDATE_OR_GOTO("server", conf->trace, out);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- print_caller (caller, 256, frame);
+ print_caller(caller, 256, frame);
- switch (frame->root->type) {
+ switch (frame->root->type) {
case GF_OP_TYPE_FOP:
- op = (char *)gf_fop_list[frame->root->op];
- break;
+ op = (char *)gf_fop_list[frame->root->op];
+ break;
default:
- op = "";
- }
+ op = "";
+ }
- fdstr[0] = '\0';
- if (state->fd)
- snprintf (fdstr, 32, " fd=%p", state->fd);
+ fdstr[0] = '\0';
+ if (state->fd)
+ snprintf(fdstr, 32, " fd=%p", state->fd);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG,
- "%s%s => (%d, %d)%s", op, caller, op_ret, op_errno, fdstr);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG,
+ "%s%s => (%d, %d)%s", op, caller, op_ret, op_errno, fdstr);
out:
- return;
+ return;
}
-
void
-server_print_request (call_frame_t *frame)
+server_print_request(call_frame_t *frame)
{
- server_conf_t *conf = NULL;
- xlator_t *this = NULL;
- server_state_t *state = NULL;
- char *op = "UNKNOWN";
- char resolve_vars[256];
- char resolve2_vars[256];
- char loc_vars[256];
- char loc2_vars[256];
- char other_vars[512];
- char caller[512];
+ server_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ server_state_t *state = NULL;
+ char *op = "UNKNOWN";
+ char resolve_vars[256];
+ char resolve2_vars[256];
+ char loc_vars[256];
+ char loc2_vars[256];
+ char other_vars[512];
+ char caller[512];
- GF_VALIDATE_OR_GOTO ("server", frame, out);
+ GF_VALIDATE_OR_GOTO("server", frame, out);
- this = frame->this;
- conf = this->private;
+ this = frame->this;
+ conf = this->private;
- GF_VALIDATE_OR_GOTO ("server", conf, out);
+ GF_VALIDATE_OR_GOTO("server", conf, out);
- if (!conf->trace)
- goto out;
+ if (!conf->trace)
+ goto out;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- memset (resolve_vars, '\0', 256);
- memset (resolve2_vars, '\0', 256);
- memset (loc_vars, '\0', 256);
- memset (loc2_vars, '\0', 256);
- memset (other_vars, '\0', 256);
+ memset(resolve_vars, '\0', 256);
+ memset(resolve2_vars, '\0', 256);
+ memset(loc_vars, '\0', 256);
+ memset(loc2_vars, '\0', 256);
+ memset(other_vars, '\0', 256);
- print_caller (caller, 256, frame);
+ print_caller(caller, 256, frame);
- if (!server_resolve_is_empty (&state->resolve)) {
- server_print_resolve (resolve_vars, 256, &state->resolve);
- server_print_loc (loc_vars, 256, &state->loc);
- }
+ if (!server_resolve_is_empty(&state->resolve)) {
+ server_print_resolve(resolve_vars, 256, &state->resolve);
+ server_print_loc(loc_vars, 256, &state->loc);
+ }
- if (!server_resolve_is_empty (&state->resolve2)) {
- server_print_resolve (resolve2_vars, 256, &state->resolve2);
- server_print_loc (loc2_vars, 256, &state->loc2);
- }
+ if (!server_resolve_is_empty(&state->resolve2)) {
+ server_print_resolve(resolve2_vars, 256, &state->resolve2);
+ server_print_loc(loc2_vars, 256, &state->loc2);
+ }
- server_print_params (other_vars, 512, state);
+ server_print_params(other_vars, 512, state);
- switch (frame->root->type) {
+ switch (frame->root->type) {
case GF_OP_TYPE_FOP:
- op = (char *)gf_fop_list[frame->root->op];
- break;
+ op = (char *)gf_fop_list[frame->root->op];
+ break;
default:
- op = "";
- break;
- }
+ op = "";
+ break;
+ }
- gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG,
- "%s%s%s%s%s%s%s", op, caller,
- resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars);
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG, "%s%s%s%s%s%s%s", op,
+ caller, resolve_vars, loc_vars, resolve2_vars, loc2_vars,
+ other_vars);
out:
- return;
+ return;
}
-
int
-serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
+serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
{
- gf_dirent_t *entry = NULL;
- gfs3_dirplist *trav = NULL;
- gfs3_dirplist *prev = NULL;
- int ret = -1;
- int temp = 0;
-
- GF_VALIDATE_OR_GOTO ("server", entries, out);
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
-
- list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
- if (!trav)
- goto out;
-
- trav->d_ino = entry->d_ino;
- trav->d_off = entry->d_off;
- trav->d_len = entry->d_len;
- trav->d_type = entry->d_type;
- trav->name = entry->d_name;
-
- gf_stat_from_iatt (&trav->stat, &entry->d_stat);
-
- /* if 'dict' is present, pack it */
- if (entry->dict) {
- temp = dict_serialized_length (entry->dict);
-
- if (temp < 0) {
- gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
- PS_MSG_INVALID_ENTRY, "failed to get "
- "serialized length of reply dict");
- errno = EINVAL;
- trav->dict.dict_len = 0;
- goto out;
- }
- trav->dict.dict_len = temp;
-
- trav->dict.dict_val = GF_CALLOC (1, trav->dict.dict_len,
- gf_server_mt_rsp_buf_t);
- if (!trav->dict.dict_val) {
- errno = ENOMEM;
- trav->dict.dict_len = 0;
- goto out;
- }
-
- ret = dict_serialize (entry->dict, trav->dict.dict_val);
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0,
- PS_MSG_DICT_SERIALIZE_FAIL,
- "failed to serialize reply dict");
- errno = -ret;
- trav->dict.dict_len = 0;
- goto out;
- }
- }
+ gf_dirent_t *entry = NULL;
+ gfs3_dirplist *trav = NULL;
+ gfs3_dirplist *prev = NULL;
+ int ret = -1;
+ int temp = 0;
+
+ GF_VALIDATE_OR_GOTO("server", entries, out);
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+
+ list_for_each_entry(entry, &entries->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_server_mt_dirent_rsp_t);
+ if (!trav)
+ goto out;
+
+ trav->d_ino = entry->d_ino;
+ trav->d_off = entry->d_off;
+ trav->d_len = entry->d_len;
+ trav->d_type = entry->d_type;
+ trav->name = entry->d_name;
+
+ gf_stat_from_iatt(&trav->stat, &entry->d_stat);
+
+ /* if 'dict' is present, pack it */
+ if (entry->dict) {
+ temp = dict_serialized_length(entry->dict);
+
+ if (temp < 0) {
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
+ "failed to get "
+ "serialized length of reply dict");
+ errno = EINVAL;
+ trav->dict.dict_len = 0;
+ goto out;
+ }
+ trav->dict.dict_len = temp;
+
+ trav->dict.dict_val = GF_CALLOC(1, trav->dict.dict_len,
+ gf_server_mt_rsp_buf_t);
+ if (!trav->dict.dict_val) {
+ errno = ENOMEM;
+ trav->dict.dict_len = 0;
+ goto out;
+ }
+
+ ret = dict_serialize(entry->dict, trav->dict.dict_val);
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_DICT_SERIALIZE_FAIL,
+ "failed to serialize reply dict");
+ errno = -ret;
+ trav->dict.dict_len = 0;
+ goto out;
+ }
+ }
- if (prev)
- prev->nextentry = trav;
- else
- rsp->reply = trav;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ rsp->reply = trav;
- prev = trav;
- trav = NULL;
- }
+ prev = trav;
+ trav = NULL;
+ }
- ret = 0;
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
-
int
-serialize_rsp_direntp_v2 (gf_dirent_t *entries, gfx_readdirp_rsp *rsp)
+serialize_rsp_direntp_v2(gf_dirent_t *entries, gfx_readdirp_rsp *rsp)
{
- gf_dirent_t *entry = NULL;
- gfx_dirplist *trav = NULL;
- gfx_dirplist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", entries, out);
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
-
- list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
- if (!trav)
- goto out;
-
- trav->d_ino = entry->d_ino;
- trav->d_off = entry->d_off;
- trav->d_len = entry->d_len;
- trav->d_type = entry->d_type;
- trav->name = entry->d_name;
-
- gfx_stat_from_iattx (&trav->stat, &entry->d_stat);
- dict_to_xdr (entry->dict, &trav->dict);
-
- if (prev)
- prev->nextentry = trav;
- else
- rsp->reply = trav;
+ gf_dirent_t *entry = NULL;
+ gfx_dirplist *trav = NULL;
+ gfx_dirplist *prev = NULL;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO("server", entries, out);
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+
+ list_for_each_entry(entry, &entries->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_server_mt_dirent_rsp_t);
+ if (!trav)
+ goto out;
+
+ trav->d_ino = entry->d_ino;
+ trav->d_off = entry->d_off;
+ trav->d_len = entry->d_len;
+ trav->d_type = entry->d_type;
+ trav->name = entry->d_name;
+
+ gfx_stat_from_iattx(&trav->stat, &entry->d_stat);
+ dict_to_xdr(entry->dict, &trav->dict);
+
+ if (prev)
+ prev->nextentry = trav;
+ else
+ rsp->reply = trav;
- prev = trav;
- trav = NULL;
- }
+ prev = trav;
+ trav = NULL;
+ }
- ret = 0;
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
-
int
-serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp)
+serialize_rsp_dirent(gf_dirent_t *entries, gfs3_readdir_rsp *rsp)
{
- gf_dirent_t *entry = NULL;
- gfs3_dirlist *trav = NULL;
- gfs3_dirlist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
- GF_VALIDATE_OR_GOTO ("server", entries, out);
-
- list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
- if (!trav)
- goto out;
- trav->d_ino = entry->d_ino;
- trav->d_off = entry->d_off;
- trav->d_len = entry->d_len;
- trav->d_type = entry->d_type;
- trav->name = entry->d_name;
- if (prev)
- prev->nextentry = trav;
- else
- rsp->reply = trav;
-
- prev = trav;
- }
+ gf_dirent_t *entry = NULL;
+ gfs3_dirlist *trav = NULL;
+ gfs3_dirlist *prev = NULL;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+ GF_VALIDATE_OR_GOTO("server", entries, out);
+
+ list_for_each_entry(entry, &entries->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_server_mt_dirent_rsp_t);
+ if (!trav)
+ goto out;
+ trav->d_ino = entry->d_ino;
+ trav->d_off = entry->d_off;
+ trav->d_len = entry->d_len;
+ trav->d_type = entry->d_type;
+ trav->name = entry->d_name;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ rsp->reply = trav;
- ret = 0;
+ prev = trav;
+ }
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-serialize_rsp_dirent_v2 (gf_dirent_t *entries, gfx_readdir_rsp *rsp)
+serialize_rsp_dirent_v2(gf_dirent_t *entries, gfx_readdir_rsp *rsp)
{
- gf_dirent_t *entry = NULL;
- gfx_dirlist *trav = NULL;
- gfx_dirlist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
- GF_VALIDATE_OR_GOTO ("server", entries, out);
-
- list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
- if (!trav)
- goto out;
- trav->d_ino = entry->d_ino;
- trav->d_off = entry->d_off;
- trav->d_len = entry->d_len;
- trav->d_type = entry->d_type;
- trav->name = entry->d_name;
- if (prev)
- prev->nextentry = trav;
- else
- rsp->reply = trav;
-
- prev = trav;
- }
+ gf_dirent_t *entry = NULL;
+ gfx_dirlist *trav = NULL;
+ gfx_dirlist *prev = NULL;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+ GF_VALIDATE_OR_GOTO("server", entries, out);
+
+ list_for_each_entry(entry, &entries->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_server_mt_dirent_rsp_t);
+ if (!trav)
+ goto out;
+ trav->d_ino = entry->d_ino;
+ trav->d_off = entry->d_off;
+ trav->d_len = entry->d_len;
+ trav->d_type = entry->d_type;
+ trav->name = entry->d_name;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ rsp->reply = trav;
- ret = 0;
+ prev = trav;
+ }
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
-
int
-readdir_rsp_cleanup (gfs3_readdir_rsp *rsp)
+readdir_rsp_cleanup(gfs3_readdir_rsp *rsp)
{
- gfs3_dirlist *prev = NULL;
- gfs3_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirlist *prev = NULL;
+ gfs3_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
-
int
-readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp)
+readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp)
{
- gfs3_dirplist *prev = NULL;
- gfs3_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirplist *prev = NULL;
+ gfs3_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev->dict.dict_val);
+ GF_FREE(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev->dict.dict_val);
- GF_FREE (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp)
+readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp)
{
- gfx_dirlist *prev = NULL;
- gfx_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirlist *prev = NULL;
+ gfx_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
-
int
-readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp)
+readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp)
{
- gfx_dirplist *prev = NULL;
- gfx_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirplist *prev = NULL;
+ gfx_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev->dict.pairs.pairs_val);
+ GF_FREE(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev->dict.pairs.pairs_val);
- GF_FREE (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
-
static int
-common_rsp_locklist (lock_migration_info_t *locklist,
- gfs3_locklist **reply) {
- lock_migration_info_t *tmp = NULL;
- gfs3_locklist *trav = NULL;
- gfs3_locklist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", locklist, out);
-
- list_for_each_entry (tmp, &locklist->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_lock_mig_t);
- if (!trav)
- goto out;
-
- switch (tmp->flock.l_type) {
- case F_RDLCK:
- tmp->flock.l_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- tmp->flock.l_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- tmp->flock.l_type = GF_LK_F_UNLCK;
- break;
+common_rsp_locklist(lock_migration_info_t *locklist, gfs3_locklist **reply)
+{
+ lock_migration_info_t *tmp = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ int ret = -1;
- default:
- gf_msg (THIS->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
- "Unknown lock type: %"PRId32"!",
- tmp->flock.l_type);
- break;
- }
+ GF_VALIDATE_OR_GOTO("server", locklist, out);
+
+ list_for_each_entry(tmp, &locklist->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_server_mt_lock_mig_t);
+ if (!trav)
+ goto out;
- gf_proto_flock_from_flock (&trav->flock, &tmp->flock);
+ switch (tmp->flock.l_type) {
+ case F_RDLCK:
+ tmp->flock.l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ tmp->flock.l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ tmp->flock.l_type = GF_LK_F_UNLCK;
+ break;
- trav->lk_flags = tmp->lk_flags;
+ default:
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
+ "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ break;
+ }
- trav->client_uid = tmp->client_uid;
+ gf_proto_flock_from_flock(&trav->flock, &tmp->flock);
- if (prev)
- prev->nextentry = trav;
- else
- *reply = trav;
+ trav->lk_flags = tmp->lk_flags;
- prev = trav;
- trav = NULL;
- }
+ trav->client_uid = tmp->client_uid;
- ret = 0;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ *reply = trav;
+
+ prev = trav;
+ trav = NULL;
+ }
+
+ ret = 0;
out:
- GF_FREE (trav);
- return ret;
+ GF_FREE(trav);
+ return ret;
}
int
-serialize_rsp_locklist (lock_migration_info_t *locklist,
- gfs3_getactivelk_rsp *rsp)
+serialize_rsp_locklist(lock_migration_info_t *locklist,
+ gfs3_getactivelk_rsp *rsp)
{
- int ret = 0;
+ int ret = 0;
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
- ret = common_rsp_locklist (locklist, &rsp->reply);
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+ ret = common_rsp_locklist(locklist, &rsp->reply);
out:
- return ret;
+ return ret;
}
int
-serialize_rsp_locklist_v2 (lock_migration_info_t *locklist,
- gfx_getactivelk_rsp *rsp)
+serialize_rsp_locklist_v2(lock_migration_info_t *locklist,
+ gfx_getactivelk_rsp *rsp)
{
- int ret = 0;
+ int ret = 0;
- GF_VALIDATE_OR_GOTO ("server", rsp, out);
- ret = common_rsp_locklist (locklist, &rsp->reply);
+ GF_VALIDATE_OR_GOTO("server", rsp, out);
+ ret = common_rsp_locklist(locklist, &rsp->reply);
out:
- return ret;
+ return ret;
}
-
int
-getactivelkinfo_rsp_cleanup (gfs3_getactivelk_rsp *rsp)
+getactivelkinfo_rsp_cleanup(gfs3_getactivelk_rsp *rsp)
{
- gfs3_locklist *prev = NULL;
- gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ gfs3_locklist *trav = NULL;
- trav = rsp->reply;
- prev = trav;
+ trav = rsp->reply;
+ prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev);
- prev = trav;
- }
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev);
+ prev = trav;
+ }
- return 0;
+ return 0;
}
int
-getactivelkinfo_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp)
+getactivelkinfo_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp)
{
- gfs3_locklist *prev = NULL;
- gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ gfs3_locklist *trav = NULL;
- trav = rsp->reply;
- prev = trav;
+ trav = rsp->reply;
+ prev = trav;
- while (trav) {
- trav = trav->nextentry;
- GF_FREE (prev);
- prev = trav;
- }
+ while (trav) {
+ trav = trav->nextentry;
+ GF_FREE(prev);
+ prev = trav;
+ }
- return 0;
+ return 0;
}
int
-gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key)
+gf_server_check_getxattr_cmd(call_frame_t *frame, const char *key)
{
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
-
- conf = frame->this->private;
- if (!conf)
- return 0;
+ conf = frame->this->private;
+ if (!conf)
+ return 0;
- if (fnmatch ("*list*mount*point*", key, 0) == 0) {
- /* list all the client protocol connecting to this process */
- pthread_mutex_lock (&conf->mutex);
- {
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- gf_msg ("mount-point-list", GF_LOG_INFO, 0,
- PS_MSG_MOUNT_PT_FAIL,
- "%s", xprt->peerinfo.identifier);
- }
- }
- pthread_mutex_unlock (&conf->mutex);
+ if (fnmatch("*list*mount*point*", key, 0) == 0) {
+ /* list all the client protocol connecting to this process */
+ pthread_mutex_lock(&conf->mutex);
+ {
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ gf_msg("mount-point-list", GF_LOG_INFO, 0, PS_MSG_MOUNT_PT_FAIL,
+ "%s", xprt->peerinfo.identifier);
+ }
}
+ pthread_mutex_unlock(&conf->mutex);
+ }
- /* Add more options/keys here */
+ /* Add more options/keys here */
- return 0;
+ return 0;
}
-
int
-gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict)
+gf_server_check_setxattr_cmd(call_frame_t *frame, dict_t *dict)
{
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ uint64_t total_read = 0;
+ uint64_t total_write = 0;
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
- uint64_t total_read = 0;
- uint64_t total_write = 0;
-
- conf = frame->this->private;
- if (!conf || !dict)
- return 0;
+ conf = frame->this->private;
+ if (!conf || !dict)
+ return 0;
- if (dict_foreach_fnmatch (dict, "*io*stat*dump",
- dict_null_foreach_fn, NULL ) > 0) {
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- total_read += xprt->total_bytes_read;
- total_write += xprt->total_bytes_write;
- }
- gf_msg ("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT,
- "total-read %"PRIu64", total-write %"PRIu64,
- total_read, total_write);
+ if (dict_foreach_fnmatch(dict, "*io*stat*dump", dict_null_foreach_fn,
+ NULL) > 0) {
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ total_read += xprt->total_bytes_read;
+ total_write += xprt->total_bytes_write;
}
+ gf_msg("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT,
+ "total-read %" PRIu64 ", total-write %" PRIu64, total_read,
+ total_write);
+ }
- return 0;
+ return 0;
}
-server_ctx_t*
-server_ctx_get (client_t *client, xlator_t *xlator)
+server_ctx_t *
+server_ctx_get(client_t *client, xlator_t *xlator)
{
- void *tmp = NULL;
- server_ctx_t *ctx = NULL;
- server_ctx_t *setted_ctx = NULL;
+ void *tmp = NULL;
+ server_ctx_t *ctx = NULL;
+ server_ctx_t *setted_ctx = NULL;
- client_ctx_get (client, xlator, &tmp);
+ client_ctx_get(client, xlator, &tmp);
- ctx = tmp;
+ ctx = tmp;
- if (ctx != NULL)
- goto out;
+ if (ctx != NULL)
+ goto out;
- ctx = GF_CALLOC (1, sizeof (server_ctx_t), gf_server_mt_server_conf_t);
+ ctx = GF_CALLOC(1, sizeof(server_ctx_t), gf_server_mt_server_conf_t);
- if (ctx == NULL)
- goto out;
+ if (ctx == NULL)
+ goto out;
- ctx->fdtable = gf_fd_fdtable_alloc ();
+ ctx->fdtable = gf_fd_fdtable_alloc();
- if (ctx->fdtable == NULL) {
- GF_FREE (ctx);
- ctx = NULL;
- goto out;
- }
+ if (ctx->fdtable == NULL) {
+ GF_FREE(ctx);
+ ctx = NULL;
+ goto out;
+ }
- LOCK_INIT (&ctx->fdtable_lock);
+ LOCK_INIT(&ctx->fdtable_lock);
- setted_ctx = client_ctx_set (client, xlator, ctx);
- if (ctx != setted_ctx) {
- LOCK_DESTROY (&ctx->fdtable_lock);
- GF_FREE (ctx->fdtable);
- GF_FREE (ctx);
- ctx = setted_ctx;
- }
+ setted_ctx = client_ctx_set(client, xlator, ctx);
+ if (ctx != setted_ctx) {
+ LOCK_DESTROY(&ctx->fdtable_lock);
+ GF_FREE(ctx->fdtable);
+ GF_FREE(ctx);
+ ctx = setted_ctx;
+ }
out:
- return ctx;
+ return ctx;
}
int
-auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
- client_t *client)
+auth_set_username_passwd(dict_t *input_params, dict_t *config_params,
+ client_t *client)
{
- int ret = 0;
- data_t *allow_user = NULL;
- data_t *passwd_data = NULL;
- char *username = NULL;
- char *password = NULL;
- char *brick_name = NULL;
- char *searchstr = NULL;
- char *username_str = NULL;
- char *tmp = NULL;
- char *username_cpy = NULL;
-
- ret = dict_get_str (input_params, "username", &username);
- if (ret) {
- gf_msg_debug ("auth/login", 0, "username not found, returning "
- "DONT-CARE");
- /* For non trusted clients username and password
- will not be there. So don't reject the client.
- */
- ret = 0;
- goto out;
- }
-
- ret = dict_get_str (input_params, "password", &password);
- if (ret) {
- gf_msg ("auth/login", GF_LOG_WARNING, 0,
- PS_MSG_DICT_GET_FAILED,
- "password not found, returning DONT-CARE");
- goto out;
- }
-
- ret = dict_get_str (input_params, "remote-subvolume", &brick_name);
- if (ret) {
- gf_msg ("auth/login", GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
- "remote-subvolume not specified");
- ret = -1;
- goto out;
- }
-
- ret = gf_asprintf (&searchstr, "auth.login.%s.allow", brick_name);
- if (-1 == ret) {
- ret = 0;
- goto out;
- }
-
- allow_user = dict_get (config_params, searchstr);
- GF_FREE (searchstr);
-
- if (allow_user) {
- username_cpy = gf_strdup (allow_user->data);
- if (!username_cpy)
- goto out;
-
- username_str = strtok_r (username_cpy, " ,", &tmp);
-
- while (username_str) {
- if (!fnmatch (username_str, username, 0)) {
- ret = gf_asprintf (&searchstr,
- "auth.login.%s.password",
- username);
- if (-1 == ret)
- goto out;
-
- passwd_data = dict_get (config_params,
- searchstr);
- GF_FREE (searchstr);
-
- if (!passwd_data) {
- gf_msg ("auth/login", GF_LOG_ERROR, 0,
- PS_MSG_LOGIN_ERROR, "wrong "
- "username/password "
- "combination");
- ret = -1;
- goto out;
- }
-
- ret = strcmp (data_to_str (passwd_data),
- password);
- if (!ret) {
- client->auth.username =
- gf_strdup (username);
- client->auth.passwd =
- gf_strdup (password);
- } else {
- gf_msg ("auth/login", GF_LOG_ERROR, 0,
- PS_MSG_LOGIN_ERROR, "wrong "
- "password for user %s",
- username);
- }
- break;
- }
- username_str = strtok_r (NULL, " ,", &tmp);
+ int ret = 0;
+ data_t *allow_user = NULL;
+ data_t *passwd_data = NULL;
+ char *username = NULL;
+ char *password = NULL;
+ char *brick_name = NULL;
+ char *searchstr = NULL;
+ char *username_str = NULL;
+ char *tmp = NULL;
+ char *username_cpy = NULL;
+
+ ret = dict_get_str(input_params, "username", &username);
+ if (ret) {
+ gf_msg_debug("auth/login", 0,
+ "username not found, returning "
+ "DONT-CARE");
+ /* For non trusted clients username and password
+ will not be there. So don't reject the client.
+ */
+ ret = 0;
+ goto out;
+ }
+
+ ret = dict_get_str(input_params, "password", &password);
+ if (ret) {
+ gf_msg("auth/login", GF_LOG_WARNING, 0, PS_MSG_DICT_GET_FAILED,
+ "password not found, returning DONT-CARE");
+ goto out;
+ }
+
+ ret = dict_get_str(input_params, "remote-subvolume", &brick_name);
+ if (ret) {
+ gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
+ "remote-subvolume not specified");
+ ret = -1;
+ goto out;
+ }
+
+ ret = gf_asprintf(&searchstr, "auth.login.%s.allow", brick_name);
+ if (-1 == ret) {
+ ret = 0;
+ goto out;
+ }
+
+ allow_user = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ if (allow_user) {
+ username_cpy = gf_strdup(allow_user->data);
+ if (!username_cpy)
+ goto out;
+
+ username_str = strtok_r(username_cpy, " ,", &tmp);
+
+ while (username_str) {
+ if (!fnmatch(username_str, username, 0)) {
+ ret = gf_asprintf(&searchstr, "auth.login.%s.password",
+ username);
+ if (-1 == ret)
+ goto out;
+
+ passwd_data = dict_get(config_params, searchstr);
+ GF_FREE(searchstr);
+
+ if (!passwd_data) {
+ gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
+ "wrong "
+ "username/password "
+ "combination");
+ ret = -1;
+ goto out;
+ }
+
+ ret = strcmp(data_to_str(passwd_data), password);
+ if (!ret) {
+ client->auth.username = gf_strdup(username);
+ client->auth.passwd = gf_strdup(password);
+ } else {
+ gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
+ "wrong "
+ "password for user %s",
+ username);
}
+ break;
+ }
+ username_str = strtok_r(NULL, " ,", &tmp);
}
+ }
out:
- GF_FREE (username_cpy);
+ GF_FREE(username_cpy);
- return ret;
+ return ret;
}
inode_t *
-server_inode_new (inode_table_t *itable, uuid_t gfid) {
- if (__is_root_gfid (gfid))
- return itable->root;
- else
- return inode_new (itable);
+server_inode_new(inode_table_t *itable, uuid_t gfid)
+{
+ if (__is_root_gfid(gfid))
+ return itable->root;
+ else
+ return inode_new(itable);
}
int
-unserialize_req_locklist (gfs3_setactivelk_req *req,
- lock_migration_info_t *lmi)
+unserialize_req_locklist(gfs3_setactivelk_req *req, lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
- trav = req->request;
+ trav = req->request;
- INIT_LIST_HEAD (&lmi->list);
+ INIT_LIST_HEAD(&lmi->list);
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-unserialize_req_locklist_v2 (gfx_setactivelk_req *req,
- lock_migration_info_t *lmi)
+unserialize_req_locklist_v2(gfx_setactivelk_req *req,
+ lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
- trav = req->request;
+ trav = req->request;
- INIT_LIST_HEAD (&lmi->list);
+ INIT_LIST_HEAD(&lmi->list);
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
- default_args_t *this_args,
- int index)
+server_populate_compound_request(gfs3_compound_req *req, call_frame_t *frame,
+ default_args_t *this_args, int index)
{
- int op_errno = 0;
- int ret = -1;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec req_iovec[MAX_IOVEC] = { {0,} };
- compound_req *this_req = NULL;
- server_state_t *state = CALL_STATE (frame);
-
- this_req = &req->compound_req_array.compound_req_array_val[index];
-
- switch (this_req->fop_enum) {
- case GF_FOP_STAT:
- {
- gfs3_stat_req *args = NULL;
+ int op_errno = 0;
+ int ret = -1;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec req_iovec[MAX_IOVEC] = {{
+ 0,
+ }};
+ compound_req *this_req = NULL;
+ server_state_t *state = CALL_STATE(frame);
- args = &this_req->compound_req_u.compound_stat_req;
+ this_req = &req->compound_req_array.compound_req_array_val[index];
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_stat_store (this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READLINK:
- {
- gfs3_readlink_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_readlink_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_readlink_store (this_args, &state->loc, args->size, xdata);
- break;
- }
- case GF_FOP_MKNOD:
- {
- gfs3_mknod_req *args = NULL;
+ switch (this_req->fop_enum) {
+ case GF_FOP_STAT: {
+ gfs3_stat_req *args = NULL;
- args = &this_req->compound_req_u.compound_mknod_req;
+ args = &this_req->compound_req_u.compound_stat_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_mknod_store (this_args, &state->loc, args->mode, args->dev,
- args->umask, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_stat_store(this_args, &state->loc, xdata);
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_req *args = NULL;
+ case GF_FOP_READLINK: {
+ gfs3_readlink_req *args = NULL;
- args = &this_req->compound_req_u.compound_mkdir_req;
+ args = &this_req->compound_req_u.compound_readlink_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_mkdir_store (this_args, &state->loc, args->mode,
- args->umask, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_readlink_store(this_args, &state->loc, args->size, xdata);
+ break;
}
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_req *args = NULL;
+ case GF_FOP_MKNOD: {
+ gfs3_mknod_req *args = NULL;
- args = &this_req->compound_req_u.compound_unlink_req;
+ args = &this_req->compound_req_u.compound_mknod_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_unlink_store (this_args, &state->loc, args->xflags, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_mknod_store(this_args, &state->loc, args->mode, args->dev,
+ args->umask, xdata);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_req *args = NULL;
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_req *args = NULL;
- args = &this_req->compound_req_u.compound_rmdir_req;
+ args = &this_req->compound_req_u.compound_mkdir_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_rmdir_store (this_args, &state->loc, args->xflags, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_mkdir_store(this_args, &state->loc, args->mode, args->umask,
+ xdata);
+ break;
}
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_req *args = NULL;
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_req *args = NULL;
- args = &this_req->compound_req_u.compound_symlink_req;
+ args = &this_req->compound_req_u.compound_unlink_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_symlink_store (this_args, args->linkname, &state->loc,
- args->umask, xdata);
-
- this_args->loc.inode = inode_new (state->itable);
-
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_unlink_store(this_args, &state->loc, args->xflags, xdata);
+ break;
}
- case GF_FOP_RENAME:
- {
- gfs3_rename_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_rename_req;
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_req *args = NULL;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ args = &this_req->compound_req_u.compound_rmdir_req;
- args_rename_store (this_args, &state->loc, &state->loc2, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_rmdir_store(this_args, &state->loc, args->xflags, xdata);
+ break;
}
- case GF_FOP_LINK:
- {
- gfs3_link_req *args = NULL;
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_req *args = NULL;
- args = &this_req->compound_req_u.compound_link_req;
+ args = &this_req->compound_req_u.compound_symlink_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_link_store (this_args, &state->loc, &state->loc2, xdata);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_symlink_store(this_args, args->linkname, &state->loc,
+ args->umask, xdata);
- this_args->loc2.inode = inode_ref (this_args->loc.inode);
+ this_args->loc.inode = inode_new(state->itable);
- break;
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfs3_truncate_req *args = NULL;
+ case GF_FOP_RENAME: {
+ gfs3_rename_req *args = NULL;
- args = &this_req->compound_req_u.compound_truncate_req;
+ args = &this_req->compound_req_u.compound_rename_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_truncate_store (this_args, &state->loc, args->offset,
- xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+
+ args_rename_store(this_args, &state->loc, &state->loc2, xdata);
+ break;
}
- case GF_FOP_OPEN:
- {
- gfs3_open_req *args = NULL;
+ case GF_FOP_LINK: {
+ gfs3_link_req *args = NULL;
- args = &this_req->compound_req_u.compound_open_req;
+ args = &this_req->compound_req_u.compound_link_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_open_store (this_args, &state->loc, args->flags, state->fd,
- xdata);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_link_store(this_args, &state->loc, &state->loc2, xdata);
- this_args->fd = fd_create (this_args->loc.inode,
- frame->root->pid);
- this_args->fd->flags = this_args->flags;
+ this_args->loc2.inode = inode_ref(this_args->loc.inode);
- break;
+ break;
}
- case GF_FOP_READ:
- {
- gfs3_read_req *args = NULL;
+ case GF_FOP_TRUNCATE: {
+ gfs3_truncate_req *args = NULL;
- args = &this_req->compound_req_u.compound_read_req;
+ args = &this_req->compound_req_u.compound_truncate_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_readv_store (this_args, state->fd, args->size,
- args->offset, args->flag, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_truncate_store(this_args, &state->loc, args->offset, xdata);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfs3_write_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_write_req;
-
- /*TODO : What happens when payload count is more than one? */
- req_iovec[0].iov_base = state->payload_vector[0].iov_base +
- state->write_length;
- req_iovec[0].iov_len = args->size;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- /* The way writev fop works :
- * xdr args of write along with other args contains
- * write length not count. But when the call is wound to posix,
- * this length is not used. It is taken from the request
- * write vector that is passed down. Posix needs the vector
- * count to determine the amount of write to be done.
- * This count for writes that come as part of compound fops
- * will be 1. The vectors are merged into one under
- * GF_FOP_WRITE section of client_handle_fop_requirements()
- * in protocol client.
- */
- args_writev_store (this_args, state->fd, req_iovec, 1,
- args->offset, args->flag, state->iobref,
- xdata);
- state->write_length += req_iovec[0].iov_len;
- break;
- }
- case GF_FOP_STATFS:
- {
- gfs3_statfs_req *args = NULL;
+ case GF_FOP_OPEN: {
+ gfs3_open_req *args = NULL;
- args = &this_req->compound_req_u.compound_statfs_req;
+ args = &this_req->compound_req_u.compound_open_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_statfs_store (this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gfs3_flush_req *args = NULL;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_open_store(this_args, &state->loc, args->flags, state->fd,
+ xdata);
- args = &this_req->compound_req_u.compound_flush_req;
+ this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
+ this_args->fd->flags = this_args->flags;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_flush_store (this_args, state->fd, xdata);
- break;
+ break;
}
- case GF_FOP_FSYNC:
- {
- gfs3_fsync_req *args = NULL;
+ case GF_FOP_READ: {
+ gfs3_read_req *args = NULL;
- args = &this_req->compound_req_u.compound_fsync_req;
+ args = &this_req->compound_req_u.compound_read_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_fsync_store (this_args, state->fd, args->data, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_readv_store(this_args, state->fd, args->size, args->offset,
+ args->flag, xdata);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gfs3_setxattr_req *args = NULL;
+ case GF_FOP_WRITE: {
+ gfs3_write_req *args = NULL;
- args = &this_req->compound_req_u.compound_setxattr_req;
+ args = &this_req->compound_req_u.compound_write_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xattr, args->dict.dict_val,
- args->dict.dict_len, ret,
- op_errno, out);
- args_setxattr_store (this_args, &state->loc, xattr, args->flags,
- xdata);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_req *args = NULL;
+ /*TODO : What happens when payload count is more than one? */
+ req_iovec[0].iov_base = state->payload_vector[0].iov_base +
+ state->write_length;
+ req_iovec[0].iov_len = args->size;
- args = &this_req->compound_req_u.compound_getxattr_req;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ /* The way writev fop works :
+ * xdr args of write along with other args contains
+ * write length not count. But when the call is wound to posix,
+ * this length is not used. It is taken from the request
+ * write vector that is passed down. Posix needs the vector
+ * count to determine the amount of write to be done.
+ * This count for writes that come as part of compound fops
+ * will be 1. The vectors are merged into one under
+ * GF_FOP_WRITE section of client_handle_fop_requirements()
+ * in protocol client.
+ */
+ args_writev_store(this_args, state->fd, req_iovec, 1, args->offset,
+ args->flag, state->iobref, xdata);
+ state->write_length += req_iovec[0].iov_len;
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfs3_statfs_req *args = NULL;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- gf_server_check_getxattr_cmd (frame, args->name);
+ args = &this_req->compound_req_u.compound_statfs_req;
- args_getxattr_store (this_args, &state->loc, args->name, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_statfs_store(this_args, &state->loc, xdata);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gfs3_removexattr_req *args = NULL;
+ case GF_FOP_FLUSH: {
+ gfs3_flush_req *args = NULL;
- args = &this_req->compound_req_u.compound_removexattr_req;
+ args = &this_req->compound_req_u.compound_flush_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_removexattr_store (this_args, &state->loc, args->name,
- xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_flush_store(this_args, state->fd, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfs3_opendir_req *args = NULL;
+ case GF_FOP_FSYNC: {
+ gfs3_fsync_req *args = NULL;
- args = &this_req->compound_req_u.compound_opendir_req;
+ args = &this_req->compound_req_u.compound_fsync_req;
- this_args->fd = fd_create (this_args->loc.inode,
- frame->root->pid);
- if (!this_args->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0,
- PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto out;
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata,
- args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_opendir_store (this_args, &state->loc, state->fd, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_fsync_store(this_args, state->fd, args->data, xdata);
+ break;
+ }
+ case GF_FOP_SETXATTR: {
+ gfs3_setxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_setxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xattr, args->dict.dict_val,
+ args->dict.dict_len, ret, op_errno, out);
+ args_setxattr_store(this_args, &state->loc, xattr, args->flags,
+ xdata);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_getxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ gf_server_check_getxattr_cmd(frame, args->name);
+
+ args_getxattr_store(this_args, &state->loc, args->name, xdata);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR: {
+ gfs3_removexattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_removexattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_removexattr_store(this_args, &state->loc, args->name, xdata);
+ break;
+ }
+ case GF_FOP_OPENDIR: {
+ gfs3_opendir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_opendir_req;
+
+ this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
+ if (!this_args->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
+ goto out;
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_opendir_store(this_args, &state->loc, state->fd, xdata);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gfs3_fsyncdir_req *args = NULL;
+ case GF_FOP_FSYNCDIR: {
+ gfs3_fsyncdir_req *args = NULL;
- args = &this_req->compound_req_u.compound_fsyncdir_req;
+ args = &this_req->compound_req_u.compound_fsyncdir_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_fsyncdir_store (this_args, state->fd, args->data, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_fsyncdir_store(this_args, state->fd, args->data, xdata);
+ break;
}
- case GF_FOP_ACCESS:
- {
- gfs3_access_req *args = NULL;
+ case GF_FOP_ACCESS: {
+ gfs3_access_req *args = NULL;
- args = &this_req->compound_req_u.compound_access_req;
+ args = &this_req->compound_req_u.compound_access_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_access_store (this_args, &state->loc, args->mask, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_access_store(this_args, &state->loc, args->mask, xdata);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfs3_create_req *args = NULL;
+ case GF_FOP_CREATE: {
+ gfs3_create_req *args = NULL;
- args = &this_req->compound_req_u.compound_create_req;
+ args = &this_req->compound_req_u.compound_create_req;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0,
- PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ?
- uuid_utoa (state->loc.inode->gfid):NULL);
- goto out;
- }
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ? uuid_utoa(state->loc.inode->gfid)
+ : NULL);
+ goto out;
+ }
+ state->fd->flags = state->flags;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_create_store (this_args, &state->loc, args->flags,
- args->mode, args->umask, state->fd, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_create_store(this_args, &state->loc, args->flags, args->mode,
+ args->umask, state->fd, xdata);
+ break;
}
- case GF_FOP_FTRUNCATE:
- {
- gfs3_ftruncate_req *args = NULL;
+ case GF_FOP_FTRUNCATE: {
+ gfs3_ftruncate_req *args = NULL;
- args = &this_req->compound_req_u.compound_ftruncate_req;
+ args = &this_req->compound_req_u.compound_ftruncate_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_ftruncate_store (this_args, state->fd, args->offset,
- xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_ftruncate_store(this_args, state->fd, args->offset, xdata);
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfs3_fstat_req *args = NULL;
+ case GF_FOP_FSTAT: {
+ gfs3_fstat_req *args = NULL;
- args = &this_req->compound_req_u.compound_fstat_req;
+ args = &this_req->compound_req_u.compound_fstat_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_fstat_store (this_args, state->fd, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_fstat_store(this_args, state->fd, xdata);
+ break;
}
- case GF_FOP_LK:
- {
- gfs3_lk_req *args = NULL;
+ case GF_FOP_LK: {
+ gfs3_lk_req *args = NULL;
- args = &this_req->compound_req_u.compound_lk_req;
+ args = &this_req->compound_req_u.compound_lk_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- switch (args->cmd) {
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
+ this_args->cmd = F_SETLKW;
+ break;
case GF_LK_RESLK_LCK:
- this_args->cmd = F_RESLK_LCK;
- break;
+ this_args->cmd = F_RESLK_LCK;
+ break;
case GF_LK_RESLK_LCKW:
- this_args->cmd = F_RESLK_LCKW;
- break;
+ this_args->cmd = F_RESLK_LCKW;
+ break;
case GF_LK_RESLK_UNLCK:
- this_args->cmd = F_RESLK_UNLCK;
- break;
+ this_args->cmd = F_RESLK_UNLCK;
+ break;
case GF_LK_GETLK_FD:
- this_args->cmd = F_GETLK_FD;
- break;
- }
+ this_args->cmd = F_GETLK_FD;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
+ this_args->lock.l_type = F_UNLCK;
+ break;
default:
- gf_msg (frame->root->client->bound_xl->name,
- GF_LOG_ERROR,
- 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s):"
- " Unknown "
- "lock type: %"PRId32"!", state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid),
- args->type);
- break;
- }
- args_lk_store (this_args, state->fd, this_args->cmd,
- &this_args->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_lookup_req;
-
- if (this_args->loc.inode)
- this_args->loc.inode = server_inode_new (state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_lookup_store (this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READDIR:
- {
- gfs3_readdir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_readdir_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_readdir_store (this_args, state->fd, args->size,
- args->offset, xdata);
- break;
- }
- case GF_FOP_INODELK:
- {
- gfs3_inodelk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_inodelk_req;
-
- switch (args->cmd) {
+ gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_LOCK_ERROR,
+ "fd - %" PRId64
+ " (%s):"
+ " Unknown "
+ "lock type: %" PRId32 "!",
+ state->resolve.fd_no,
+ uuid_utoa(state->fd->inode->gfid), args->type);
+ break;
+ }
+ args_lk_store(this_args, state->fd, this_args->cmd,
+ &this_args->lock, xdata);
+ break;
+ }
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_lookup_req;
+
+ if (this_args->loc.inode)
+ this_args->loc.inode = server_inode_new(state->itable,
+ state->loc.gfid);
+ else
+ state->is_revalidate = 1;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_lookup_store(this_args, &state->loc, xdata);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfs3_readdir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_readdir_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_readdir_store(this_args, state->fd, args->size, args->offset,
+ xdata);
+ break;
+ }
+ case GF_FOP_INODELK: {
+ gfs3_inodelk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_inodelk_req;
+
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
+ this_args->cmd = F_SETLKW;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_inodelk_store (this_args, args->volume, &state->loc,
- this_args->cmd, &this_args->lock, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_inodelk_store(this_args, args->volume, &state->loc,
+ this_args->cmd, &this_args->lock, xdata);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gfs3_finodelk_req *args = NULL;
+ case GF_FOP_FINODELK: {
+ gfs3_finodelk_req *args = NULL;
- args = &this_req->compound_req_u.compound_finodelk_req;
+ args = &this_req->compound_req_u.compound_finodelk_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- switch (args->cmd) {
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
+ this_args->cmd = F_SETLKW;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
- args_finodelk_store (this_args, args->volume, state->fd,
- this_args->cmd, &this_args->lock, xdata);
- break;
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
+ args_finodelk_store(this_args, args->volume, state->fd,
+ this_args->cmd, &this_args->lock, xdata);
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gfs3_entrylk_req *args = NULL;
+ case GF_FOP_ENTRYLK: {
+ gfs3_entrylk_req *args = NULL;
- args = &this_req->compound_req_u.compound_entrylk_req;
+ args = &this_req->compound_req_u.compound_entrylk_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_entrylk_store (this_args, args->volume, &state->loc,
- args->name, args->cmd, args->type, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_entrylk_store(this_args, args->volume, &state->loc, args->name,
+ args->cmd, args->type, xdata);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gfs3_fentrylk_req *args = NULL;
+ case GF_FOP_FENTRYLK: {
+ gfs3_fentrylk_req *args = NULL;
- args = &this_req->compound_req_u.compound_fentrylk_req;
+ args = &this_req->compound_req_u.compound_fentrylk_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_fentrylk_store (this_args, args->volume, state->fd,
- args->name, args->cmd, args->type, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_fentrylk_store(this_args, args->volume, state->fd, args->name,
+ args->cmd, args->type, xdata);
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_req *args = NULL;
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_req *args = NULL;
- args = &this_req->compound_req_u.compound_xattrop_req;
+ args = &this_req->compound_req_u.compound_xattrop_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret,
- op_errno, out);
- args_xattrop_store (this_args, &state->loc, args->flags,
- xattr, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xattr, (args->dict.dict_val),
+ (args->dict.dict_len), ret, op_errno, out);
+ args_xattrop_store(this_args, &state->loc, args->flags, xattr,
+ xdata);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_req *args = NULL;
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_req *args = NULL;
- args = &this_req->compound_req_u.compound_fxattrop_req;
+ args = &this_req->compound_req_u.compound_fxattrop_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xattr, (args->dict.dict_val),
+ (args->dict.dict_len), ret, op_errno, out);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_fxattrop_store (this_args, state->fd, args->flags, xattr,
- xdata);
- break;
+ args_fxattrop_store(this_args, state->fd, args->flags, xattr,
+ xdata);
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_req *args = NULL;
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_req *args = NULL;
- args = &this_req->compound_req_u.compound_fgetxattr_req;
+ args = &this_req->compound_req_u.compound_fgetxattr_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_fgetxattr_store (this_args, state->fd, args->name, xdata);
- break;
+ args_fgetxattr_store(this_args, state->fd, args->name, xdata);
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gfs3_fsetxattr_req *args = NULL;
+ case GF_FOP_FSETXATTR: {
+ gfs3_fsetxattr_req *args = NULL;
- args = &this_req->compound_req_u.compound_fsetxattr_req;
+ args = &this_req->compound_req_u.compound_fsetxattr_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xattr, (args->dict.dict_val),
+ (args->dict.dict_len), ret, op_errno, out);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_fsetxattr_store (this_args, state->fd, xattr, args->flags,
- xdata);
- break;
+ args_fsetxattr_store(this_args, state->fd, xattr, args->flags,
+ xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfs3_rchecksum_req *args = NULL;
+ case GF_FOP_RCHECKSUM: {
+ gfs3_rchecksum_req *args = NULL;
- args = &this_req->compound_req_u.compound_rchecksum_req;
+ args = &this_req->compound_req_u.compound_rchecksum_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_rchecksum_store (this_args, state->fd, args->offset,
- args->len, xdata);
- break;
+ args_rchecksum_store(this_args, state->fd, args->offset, args->len,
+ xdata);
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfs3_setattr_req *args = NULL;
+ case GF_FOP_SETATTR: {
+ gfs3_setattr_req *args = NULL;
- args = &this_req->compound_req_u.compound_setattr_req;
+ args = &this_req->compound_req_u.compound_setattr_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- gf_stat_to_iatt (&args->stbuf, &this_args->stat);
+ gf_stat_to_iatt(&args->stbuf, &this_args->stat);
- args_setattr_store (this_args, &state->loc, &this_args->stat,
- args->valid, xdata);
- break;
+ args_setattr_store(this_args, &state->loc, &this_args->stat,
+ args->valid, xdata);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfs3_fsetattr_req *args = NULL;
+ case GF_FOP_FSETATTR: {
+ gfs3_fsetattr_req *args = NULL;
- args = &this_req->compound_req_u.compound_fsetattr_req;
+ args = &this_req->compound_req_u.compound_fsetattr_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- gf_stat_to_iatt (&args->stbuf, &this_args->stat);
+ gf_stat_to_iatt(&args->stbuf, &this_args->stat);
- args_fsetattr_store (this_args, state->fd, &this_args->stat,
- args->valid, xdata);
- break;
+ args_fsetattr_store(this_args, state->fd, &this_args->stat,
+ args->valid, xdata);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_req *args = NULL;
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_req *args = NULL;
- args = &this_req->compound_req_u.compound_readdirp_req;
+ args = &this_req->compound_req_u.compound_readdirp_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xattr, (args->dict.dict_val),
+ (args->dict.dict_len), ret, op_errno, out);
- args_readdirp_store (this_args, state->fd, args->size,
- args->offset, xattr);
- break;
+ args_readdirp_store(this_args, state->fd, args->size, args->offset,
+ xattr);
+ break;
}
- case GF_FOP_FREMOVEXATTR:
- {
- gfs3_fremovexattr_req *args = NULL;
+ case GF_FOP_FREMOVEXATTR: {
+ gfs3_fremovexattr_req *args = NULL;
- args = &this_req->compound_req_u.compound_fremovexattr_req;
+ args = &this_req->compound_req_u.compound_fremovexattr_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_fremovexattr_store (this_args, state->fd, args->name,
- xdata);
- break;
+ args_fremovexattr_store(this_args, state->fd, args->name, xdata);
+ break;
}
- case GF_FOP_FALLOCATE:
- {
- gfs3_fallocate_req *args = NULL;
+ case GF_FOP_FALLOCATE: {
+ gfs3_fallocate_req *args = NULL;
- args = &this_req->compound_req_u.compound_fallocate_req;
+ args = &this_req->compound_req_u.compound_fallocate_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_fallocate_store (this_args, state->fd, args->flags,
- args->offset, args->size, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_fallocate_store(this_args, state->fd, args->flags,
+ args->offset, args->size, xdata);
+ break;
}
- case GF_FOP_DISCARD:
- {
- gfs3_discard_req *args = NULL;
+ case GF_FOP_DISCARD: {
+ gfs3_discard_req *args = NULL;
- args = &this_req->compound_req_u.compound_discard_req;
+ args = &this_req->compound_req_u.compound_discard_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- args_discard_store (this_args, state->fd, args->offset,
- args->size, xdata);
- break;
+ args_discard_store(this_args, state->fd, args->offset, args->size,
+ xdata);
+ break;
}
- case GF_FOP_ZEROFILL:
- {
- gfs3_zerofill_req *args = NULL;
+ case GF_FOP_ZEROFILL: {
+ gfs3_zerofill_req *args = NULL;
- args = &this_req->compound_req_u.compound_zerofill_req;
+ args = &this_req->compound_req_u.compound_zerofill_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_zerofill_store (this_args, state->fd, args->offset,
- args->size, xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_zerofill_store(this_args, state->fd, args->offset, args->size,
+ xdata);
+ break;
}
- case GF_FOP_SEEK:
- {
- gfs3_seek_req *args = NULL;
+ case GF_FOP_SEEK: {
+ gfs3_seek_req *args = NULL;
- args = &this_req->compound_req_u.compound_seek_req;
+ args = &this_req->compound_req_u.compound_seek_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
- args_seek_store (this_args, state->fd, args->offset, args->what,
- xdata);
- break;
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
+ args_seek_store(this_args, state->fd, args->offset, args->what,
+ xdata);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfs3_lease_req *args = NULL;
+ case GF_FOP_LEASE: {
+ gfs3_lease_req *args = NULL;
- args = &this_req->compound_req_u.compound_lease_req;
+ args = &this_req->compound_req_u.compound_lease_req;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(
+ frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
+ args->xdata.xdata_len, ret, op_errno, out);
- gf_proto_lease_to_lease (&args->lease, &state->lease);
+ gf_proto_lease_to_lease(&args->lease, &state->lease);
- args_lease_store (this_args, &state->loc, &state->lease, xdata);
- break;
+ args_lease_store(this_args, &state->loc, &state->lease, xdata);
+ break;
}
default:
- return ENOTSUP;
- }
+ return ENOTSUP;
+ }
out:
- if (xattr)
- dict_unref (xattr);
- if (xdata)
- dict_unref (xdata);
- return op_errno;
+ if (xattr)
+ dict_unref(xattr);
+ if (xdata)
+ dict_unref(xdata);
+ return op_errno;
}
int
-server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index)
+server_populate_compound_response(xlator_t *this, gfs3_compound_rsp *rsp,
+ call_frame_t *frame,
+ compound_args_cbk_t *args_cbk, int index)
{
- int op_errno = EINVAL;
- default_args_cbk_t *this_args_cbk = NULL;
- compound_rsp *this_rsp = NULL;
- server_state_t *state = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ int op_errno = EINVAL;
+ default_args_cbk_t *this_args_cbk = NULL;
+ compound_rsp *this_rsp = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+
+ this_args_cbk = &args_cbk->rsp_list[index];
+ this_rsp->fop_enum = args_cbk->enum_list[index];
+
+ switch (this_rsp->fop_enum) {
+ case GF_FOP_STAT: {
+ gfs3_stat_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_stat_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_stat(state, rsp_args, &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfs3_readlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_readlink(rsp_args, &this_args_cbk->stat,
+ this_args_cbk->buf);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ if (!rsp_args->path)
+ rsp_args->path = "";
+ break;
+ }
+ case GF_FOP_MKNOD: {
+ gfs3_mknod_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_mknod(state, rsp_args, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ this_args_cbk->inode);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_mkdir(
+ state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+
+ if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_unlink(state, rsp_args, &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_rmdir(state, rsp_args, &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_symlink(
+ state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfs3_rename_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rename_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_rename(
+ frame, state, rsp_args, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_LINK: {
+ gfs3_link_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_link_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_link(
+ state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_TRUNCATE: {
+ gfs3_truncate_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_truncate(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_OPEN: {
+ gfs3_open_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_open_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_open(frame, this, rsp_args, this_args_cbk->fd);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READ: {
+ gfs3_read_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_read_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_readv(rsp_args, &this_args_cbk->stat,
+ this_args_cbk->op_ret);
+
+ if (!state->rsp_iobref) {
+ state->rsp_iobref = this_args_cbk->iobref;
+ state->rsp_count = 0;
+ }
+ iobref_merge(state->rsp_iobref, this_args_cbk->iobref);
+ memcpy(&state->rsp_vector[state->rsp_count],
+ this_args_cbk->vector,
+ (this_args_cbk->count * sizeof(state->rsp_vector[0])));
+ state->rsp_count += this_args_cbk->count;
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_WRITE: {
+ gfs3_write_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_write_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_writev(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfs3_statfs_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_statfs_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_statfs(rsp_args, &this_args_cbk->statvfs);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FLUSH: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_flush_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSYNC: {
+ gfs3_fsync_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_fsync(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SETXATTR: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
- this_args_cbk = &args_cbk->rsp_list[index];
- this_rsp->fop_enum = args_cbk->enum_list[index];
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_rsp *rsp_args = NULL;
- switch (this_rsp->fop_enum) {
- case GF_FOP_STAT:
- {
- gfs3_stat_rsp *rsp_args = NULL;
+ rsp_args = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
- rsp_args = &this_rsp->compound_rsp_u.compound_stat_rsp;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_stat (state, rsp_args,
- &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (-1 != this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len, rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfs3_readlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+ case GF_FOP_REMOVEXATTR: {
+ gf_common_rsp *rsp_args = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (this_args_cbk->op_ret >= 0) {
- server_post_readlink (rsp_args, &this_args_cbk->stat,
- this_args_cbk->buf);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- if (!rsp_args->path)
- rsp_args->path = "";
- break;
- }
- case GF_FOP_MKNOD:
- {
- gfs3_mknod_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_mknod_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_mknod (state, rsp_args,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- this_args_cbk->inode);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_mkdir (state, rsp_args,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_rsp *rsp_args = NULL;
+ rsp_args = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
- rsp_args = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+ if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_OPENDIR: {
+ gfs3_opendir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_opendir_rsp;
- if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_unlink (state, rsp_args,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server_post_opendir(frame, this, rsp_args, this_args_cbk->fd);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_rmdir (state, rsp_args,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_symlink_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_symlink (state, rsp_args,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_RENAME:
- {
- gfs3_rename_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rename_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_rename (frame, state, rsp_args,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LINK:
- {
- gfs3_link_rsp *rsp_args = NULL;
+ case GF_FOP_FSYNCDIR: {
+ gf_common_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_link_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_link (state, rsp_args,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_ACCESS: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_access_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfs3_truncate_rsp *rsp_args = NULL;
+ case GF_FOP_CREATE: {
+ gfs3_create_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_create_rsp;
- rsp_args = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- if (!this_args_cbk->op_ret) {
- server_post_truncate (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
+ if (!this_args_cbk->op_ret) {
+ rsp_args->op_ret = server_post_create(
+ frame, rsp_args, state, this, this_args_cbk->fd,
+ this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent);
+ if (rsp_args->op_ret) {
+ rsp_args->op_errno = -rsp_args->op_ret;
+ rsp_args->op_ret = -1;
}
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ }
+ break;
}
- case GF_FOP_OPEN:
- {
- gfs3_open_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_open_rsp;
+ case GF_FOP_FTRUNCATE: {
+ gfs3_ftruncate_rsp *rsp_args = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ rsp_args = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
- if (!this_args_cbk->op_ret) {
- server_post_open (frame, this, rsp_args,
- this_args_cbk->fd);
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server_post_ftruncate(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_READ:
- {
- gfs3_read_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_read_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret >= 0) {
- server_post_readv (rsp_args, &this_args_cbk->stat,
- this_args_cbk->op_ret);
-
- if (!state->rsp_iobref) {
- state->rsp_iobref = this_args_cbk->iobref;
- state->rsp_count = 0;
- }
- iobref_merge (state->rsp_iobref,
- this_args_cbk->iobref);
- memcpy (&state->rsp_vector[state->rsp_count],
- this_args_cbk->vector,
- (this_args_cbk->count *
- sizeof(state->rsp_vector[0])));
- state->rsp_count += this_args_cbk->count;
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_WRITE:
- {
- gfs3_write_rsp *rsp_args = NULL;
+ case GF_FOP_FSTAT: {
+ gfs3_fstat_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_write_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_fstat_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret >= 0) {
- server_post_writev (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_fstat(state, rsp_args, &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_STATFS:
- {
- gfs3_statfs_rsp *rsp_args = NULL;
+ case GF_FOP_LK: {
+ gfs3_lk_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_statfs_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_lk_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_statfs (rsp_args,
- &this_args_cbk->statvfs);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gf_common_rsp *rsp_args = NULL;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args = &this_rsp->compound_rsp_u.compound_flush_rsp;
+ if (!this_args_cbk->op_ret) {
+ server_post_lk(this, rsp_args, &this_args_cbk->lock);
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_FSYNC:
- {
- gfs3_fsync_rsp *rsp_args = NULL;
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_lookup_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_fsync (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_lookup(rsp_args, frame, state, this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_READDIR: {
+ gfs3_readdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (this_args_cbk->op_ret > 0) {
+ ret = server_post_readdir(rsp_args, &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
+ }
+ }
+ break;
+ }
+ case GF_FOP_INODELK: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+ case GF_FOP_FINODELK: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_ENTRYLK: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FENTRYLK: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
- if (-1 != this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE (this,
- this_args_cbk->xattr,
- &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len,
- rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
- if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len, rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len, rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfs3_opendir_rsp *rsp_args = NULL;
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (-1 != this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len, rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSETXATTR: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RCHECKSUM: {
+ gfs3_rchecksum_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_rchecksum(rsp_args, this_args_cbk->weak_checksum,
+ this_args_cbk->strong_checksum);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SETATTR: {
+ gfs3_setattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_setattr(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSETATTR: {
+ gfs3_fsetattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_fsetattr(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret > 0) {
+ ret = server_post_readdirp(rsp_args, &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
+ goto out;
+ }
+ gf_link_inodes_from_dirent(this, state->fd->inode,
+ &this_args_cbk->entries);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR: {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
+
+ if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
- rsp_args = &this_rsp->compound_rsp_u.compound_opendir_rsp;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FALLOCATE: {
+ gfs3_fallocate_rsp *rsp_args = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ rsp_args = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
- if (!this_args_cbk->op_ret) {
- server_post_opendir (frame, this, rsp_args,
- this_args_cbk->fd);
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server_post_fallocate(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
+ case GF_FOP_DISCARD: {
+ gfs3_discard_rsp *rsp_args = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_ACCESS:
- {
- gf_common_rsp *rsp_args = NULL;
+ rsp_args = &this_rsp->compound_rsp_u.compound_discard_rsp;
- rsp_args = &this_rsp->compound_rsp_u.compound_access_rsp;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server_post_discard(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfs3_create_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_create_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
-
- if (!this_args_cbk->op_ret) {
- rsp_args->op_ret = server_post_create (frame,
- rsp_args, state, this,
- this_args_cbk->fd,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- if (rsp_args->op_ret) {
- rsp_args->op_errno = -rsp_args->op_ret;
- rsp_args->op_ret = -1;
- }
- }
- break;
- }
- case GF_FOP_FTRUNCATE:
- {
- gfs3_ftruncate_rsp *rsp_args = NULL;
+ case GF_FOP_ZEROFILL: {
+ gfs3_zerofill_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_ftruncate (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server_post_zerofill(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfs3_fstat_rsp *rsp_args = NULL;
+ case GF_FOP_SEEK: {
+ gfs3_seek_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_fstat_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_seek_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_fstat (state, rsp_args,
- &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_LK:
- {
- gfs3_lk_rsp *rsp_args = NULL;
+ case GF_FOP_LEASE: {
+ gfs3_lease_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_u.compound_lk_rsp;
+ rsp_args = &this_rsp->compound_rsp_u.compound_lease_rsp;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(
+ this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_lk (this, rsp_args, &this_args_cbk->lock);
- }
+ if (!this_args_cbk->op_ret) {
+ server_post_lease(rsp_args, &this_args_cbk->lease);
+ }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_rsp *rsp_args = NULL;
+ default:
+ return ENOTSUP;
+ }
+ op_errno = 0;
+out:
+ return op_errno;
+}
+/* This works only when the compound fop acts on one loc/inode/gfid.
+ * If compound fops on more than one inode is required, multiple
+ * resolve and resumes will have to be done. This will have to change.
+ * Right now, multiple unlinks, rmdirs etc is are not supported.
+ * This can be added for future enhancements.
+ */
+int
+server_get_compound_resolve(server_state_t *state, gfs3_compound_req *req)
+{
+ int i = 0;
+ compound_req *array = &req->compound_req_array.compound_req_array_val[i];
- rsp_args = &this_rsp->compound_rsp_u.compound_lookup_rsp;
+ switch (array->fop_enum) {
+ case GF_FOP_STAT: {
+ gfs3_stat_req this_req = {{
+ 0,
+ }};
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ this_req = array[i].compound_req_u.compound_stat_req;
- if (!this_args_cbk->op_ret) {
- server_post_lookup (rsp_args, frame, state,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READDIR:
- {
- gfs3_readdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server_post_readdir (rsp_args,
- &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- }
- }
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_INODELK:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_READLINK: {
+ gfs3_readlink_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
+ this_req = array[i].compound_req_u.compound_readlink_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_MKNOD: {
+ gfs3_mknod_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
+ this_req = array[i].compound_req_u.compound_mknod_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
+ this_req = array[i].compound_req_u.compound_mkdir_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
+ this_req = array[i].compound_req_u.compound_unlink_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_req this_req = {{
+ 0,
+ }};
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ this_req = array[i].compound_req_u.compound_rmdir_req;
- if (!this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE (this,
- this_args_cbk->xattr,
- &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len,
- rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_rsp *rsp_args = NULL;
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
+ this_req = array[i].compound_req_u.compound_symlink_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE (this,
- this_args_cbk->xattr,
- &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len,
- rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_rsp *rsp_args = NULL;
+ case GF_FOP_RENAME: {
+ gfs3_rename_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
+ this_req = array[i].compound_req_u.compound_rename_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(this_req.oldbname);
+ memcpy(state->resolve.pargfid, this_req.oldgfid, 16);
- if (-1 != this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xattr,
- &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len,
- rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve2.type = RESOLVE_MAY;
+ state->resolve2.bname = gf_strdup(this_req.newbname);
+ memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_LINK: {
+ gfs3_link_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ this_req = array[i].compound_req_u.compound_link_req;
- if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.oldgfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve2.type = RESOLVE_NOT;
+ state->resolve2.bname = gf_strdup(this_req.newbname);
+ memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfs3_rchecksum_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
+ case GF_FOP_TRUNCATE: {
+ gfs3_truncate_req this_req = {{
+ 0,
+ }};
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ this_req = array[i].compound_req_u.compound_truncate_req;
- if (!this_args_cbk->op_ret) {
- server_post_rchecksum (rsp_args,
- this_args_cbk->weak_checksum,
- this_args_cbk->strong_checksum);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfs3_setattr_rsp *rsp_args = NULL;
+ case GF_FOP_OPEN: {
+ gfs3_open_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_setattr_rsp;
+ this_req = array[i].compound_req_u.compound_open_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_setattr (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfs3_fsetattr_rsp *rsp_args = NULL;
+ case GF_FOP_READ: {
+ gfs3_read_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
+ this_req = array[i].compound_req_u.compound_read_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_fsetattr (rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server_post_readdirp (rsp_args,
- &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- goto out;
- }
- gf_link_inodes_from_dirent (this, state->fd->inode,
- &this_args_cbk->entries);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gf_common_rsp *rsp_args = NULL;
+ case GF_FOP_WRITE: {
+ gfs3_write_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
-
- if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
+ this_req = array[i].compound_req_u.compound_write_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FALLOCATE:
- {
- gfs3_fallocate_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
+ case GF_FOP_STATFS: {
+ gfs3_statfs_req this_req = {{
+ 0,
+ }};
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
+ this_req = array[i].compound_req_u.compound_statfs_req;
- if (!this_args_cbk->op_ret) {
- server_post_fallocate (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_DISCARD:
- {
- gfs3_discard_rsp *rsp_args = NULL;
+ case GF_FOP_FLUSH: {
+ gfs3_flush_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_discard_rsp;
+ this_req = array[i].compound_req_u.compound_flush_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_discard (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_ZEROFILL:
- {
- gfs3_zerofill_rsp *rsp_args = NULL;
+ case GF_FOP_FSYNC: {
+ gfs3_fsync_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
+ this_req = array[i].compound_req_u.compound_fsync_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_zerofill (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_SEEK:
- {
- gfs3_seek_rsp *rsp_args = NULL;
+ case GF_FOP_SETXATTR: {
+ gfs3_setxattr_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_seek_rsp;
+ this_req = array[i].compound_req_u.compound_setxattr_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfs3_lease_rsp *rsp_args = NULL;
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_req this_req = {{
+ 0,
+ }};
- rsp_args = &this_rsp->compound_rsp_u.compound_lease_rsp;
+ this_req = array[i].compound_req_u.compound_getxattr_req;
- GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
- &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len,
- rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_lease (rsp_args, &this_args_cbk->lease);
- }
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- default:
- return ENOTSUP;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- op_errno = 0;
-out:
- return op_errno;
-}
-/* This works only when the compound fop acts on one loc/inode/gfid.
- * If compound fops on more than one inode is required, multiple
- * resolve and resumes will have to be done. This will have to change.
- * Right now, multiple unlinks, rmdirs etc is are not supported.
- * This can be added for future enhancements.
- */
-int
-server_get_compound_resolve (server_state_t *state, gfs3_compound_req *req)
-{
- int i = 0;
- compound_req *array = &req->compound_req_array.compound_req_array_val[i];
+ case GF_FOP_REMOVEXATTR: {
+ gfs3_removexattr_req this_req = {{
+ 0,
+ }};
- switch (array->fop_enum) {
- case GF_FOP_STAT:
- {
- gfs3_stat_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_stat_req;
+ this_req = array[i].compound_req_u.compound_removexattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfs3_readlink_req this_req = { {0,} };
+ case GF_FOP_OPENDIR: {
+ gfs3_opendir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_readlink_req;
+ this_req = array[i].compound_req_u.compound_opendir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_MKNOD:
- {
- gfs3_mknod_req this_req = { {0,} };
+ case GF_FOP_FSYNCDIR: {
+ gfs3_fsyncdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_mknod_req;
+ this_req = array[i].compound_req_u.compound_fsyncdir_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_req this_req = { {0,} };
+ case GF_FOP_ACCESS: {
+ gfs3_access_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_mkdir_req;
+ this_req = array[i].compound_req_u.compound_access_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_unlink_req;
+ case GF_FOP_CREATE: {
+ gfs3_create_req this_req = {{
+ 0,
+ }};
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
- }
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_req this_req = { {0,} };
+ this_req = array[i].compound_req_u.compound_create_req;
- this_req = array[i].compound_req_u.compound_rmdir_req;
+ state->flags = gf_flags_to_flags(this_req.flags);
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_req this_req = { {0,} };
+ case GF_FOP_FTRUNCATE: {
+ gfs3_ftruncate_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_symlink_req;
+ this_req = array[i].compound_req_u.compound_ftruncate_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_RENAME:
- {
- gfs3_rename_req this_req = { {0,} };
+ case GF_FOP_FSTAT: {
+ gfs3_fstat_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_rename_req;
+ this_req = array[i].compound_req_u.compound_fstat_req;
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup
- (this_req.oldbname);
- memcpy (state->resolve.pargfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup
- (this_req.newbname);
- memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LINK:
- {
- gfs3_link_req this_req = { {0,} };
+ case GF_FOP_LK: {
+ gfs3_lk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_link_req;
+ this_req = array[i].compound_req_u.compound_lk_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup
- (this_req.newbname);
- memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
- break;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfs3_truncate_req this_req = { {0,} };
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_truncate_req;
+ this_req = array[i].compound_req_u.compound_lookup_req;
+ state->resolve.type = RESOLVE_DONTCARE;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ if (this_req.bname && strcmp(this_req.bname, "")) {
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ } else {
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ }
+ break;
}
- case GF_FOP_OPEN:
- {
- gfs3_open_req this_req = { {0,} };
+ case GF_FOP_READDIR: {
+ gfs3_readdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_open_req;
+ this_req = array[i].compound_req_u.compound_readdir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_READ:
- {
- gfs3_read_req this_req = { {0,} };
+ case GF_FOP_INODELK: {
+ gfs3_inodelk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_read_req;
+ this_req = array[i].compound_req_u.compound_inodelk_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfs3_write_req this_req = { {0,} };
+ case GF_FOP_FINODELK: {
+ gfs3_finodelk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_write_req;
+ this_req = array[i].compound_req_u.compound_finodelk_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_STATFS:
- {
- gfs3_statfs_req this_req = { {0,} };
+ case GF_FOP_ENTRYLK: {
+ gfs3_entrylk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_statfs_req;
+ this_req = array[i].compound_req_u.compound_entrylk_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FLUSH:
- {
- gfs3_flush_req this_req = { {0,} };
+ case GF_FOP_FENTRYLK: {
+ gfs3_fentrylk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_flush_req;
+ this_req = array[i].compound_req_u.compound_fentrylk_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSYNC:
- {
- gfs3_fsync_req this_req = { {0,} };
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_fsync_req;
+ this_req = array[i].compound_req_u.compound_xattrop_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gfs3_setxattr_req this_req = { {0,} };
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_setxattr_req;
+ this_req = array[i].compound_req_u.compound_fxattrop_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_req this_req = { {0,} };
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_getxattr_req;
+ this_req = array[i].compound_req_u.compound_fgetxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gfs3_removexattr_req this_req = { {0,} };
+ case GF_FOP_FSETXATTR: {
+ gfs3_fsetxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_removexattr_req;
+ this_req = array[i].compound_req_u.compound_fsetxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfs3_opendir_req this_req = { {0,} };
+ case GF_FOP_RCHECKSUM: {
+ gfs3_rchecksum_req this_req = {
+ 0,
+ };
- this_req = array[i].compound_req_u.compound_opendir_req;
+ this_req = array[i].compound_req_u.compound_rchecksum_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MAY;
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gfs3_fsyncdir_req this_req = { {0,} };
+ case GF_FOP_SETATTR: {
+ gfs3_setattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_fsyncdir_req;
+ this_req = array[i].compound_req_u.compound_setattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_ACCESS:
- {
- gfs3_access_req this_req = { {0,} };
+ case GF_FOP_FSETATTR: {
+ gfs3_fsetattr_req this_req = {
+ 0,
+ };
- this_req = array[i].compound_req_u.compound_access_req;
+ this_req = array[i].compound_req_u.compound_fsetattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_CREATE:
- {
- gfs3_create_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_create_req;
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_req this_req = {{
+ 0,
+ }};
- state->flags = gf_flags_to_flags (this_req.flags);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
+ this_req = array[i].compound_req_u.compound_readdirp_req;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FTRUNCATE:
- {
- gfs3_ftruncate_req this_req = { {0,} };
+ case GF_FOP_FREMOVEXATTR: {
+ gfs3_fremovexattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_ftruncate_req;
+ this_req = array[i].compound_req_u.compound_fremovexattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfs3_fstat_req this_req = { {0,} };
+ case GF_FOP_FALLOCATE: {
+ gfs3_fallocate_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_fstat_req;
+ this_req = array[i].compound_req_u.compound_fallocate_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LK:
- {
- gfs3_lk_req this_req = { {0,} };
+ case GF_FOP_DISCARD: {
+ gfs3_discard_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_lk_req;
+ this_req = array[i].compound_req_u.compound_discard_req;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_req this_req = { {0,} };
+ case GF_FOP_ZEROFILL: {
+ gfs3_zerofill_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_lookup_req;
- state->resolve.type = RESOLVE_DONTCARE;
+ this_req = array[i].compound_req_u.compound_zerofill_req;
- if (this_req.bname && strcmp (this_req.bname, "")) {
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- } else {
- memcpy (state->resolve.gfid, this_req.gfid, 16);
- }
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_READDIR:
- {
- gfs3_readdir_req this_req = { {0,} };
+ case GF_FOP_SEEK: {
+ gfs3_seek_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_readdir_req;
+ this_req = array[i].compound_req_u.compound_seek_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_INODELK:
- {
- gfs3_inodelk_req this_req = { {0,} };
+ case GF_FOP_LEASE: {
+ gfs3_lease_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_u.compound_inodelk_req;
+ this_req = array[i].compound_req_u.compound_lease_req;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gfs3_finodelk_req this_req = { {0,} };
+ default:
+ return ENOTSUP;
+ }
+ return 0;
+}
- this_req = array[i].compound_req_u.compound_finodelk_req;
+void
+server_compound_rsp_cleanup(gfs3_compound_rsp *rsp, compound_args_cbk_t *args)
+{
+ int i, len = 0;
+ compound_rsp *this_rsp = NULL;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ENTRYLK:
- {
- gfs3_entrylk_req this_req = { {0,} };
+ if (!rsp->compound_rsp_array.compound_rsp_array_val)
+ return;
- this_req = array[i].compound_req_u.compound_entrylk_req;
+ len = rsp->compound_rsp_array.compound_rsp_array_len;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (args->enum_list[i]) {
+ case GF_FOP_STAT:
+ SERVER_FOP_RSP_CLEANUP(rsp, stat, i);
break;
- }
- case GF_FOP_FENTRYLK:
- {
- gfs3_fentrylk_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fentrylk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_MKNOD:
+ SERVER_FOP_RSP_CLEANUP(rsp, mknod, i);
break;
- }
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_xattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
+ case GF_FOP_MKDIR:
+ SERVER_FOP_RSP_CLEANUP(rsp, mkdir, i);
break;
- }
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fxattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_UNLINK:
+ SERVER_FOP_RSP_CLEANUP(rsp, unlink, i);
break;
- }
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fgetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_RMDIR:
+ SERVER_FOP_RSP_CLEANUP(rsp, rmdir, i);
break;
- }
- case GF_FOP_FSETXATTR:
- {
- gfs3_fsetxattr_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fsetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_SYMLINK:
+ SERVER_FOP_RSP_CLEANUP(rsp, symlink, i);
break;
- }
- case GF_FOP_RCHECKSUM:
- {
- gfs3_rchecksum_req this_req = {0,};
-
- this_req = array[i].compound_req_u.compound_rchecksum_req;
-
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_RENAME:
+ SERVER_FOP_RSP_CLEANUP(rsp, rename, i);
break;
- }
- case GF_FOP_SETATTR:
- {
- gfs3_setattr_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_setattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
+ case GF_FOP_LINK:
+ SERVER_FOP_RSP_CLEANUP(rsp, link, i);
break;
- }
- case GF_FOP_FSETATTR:
- {
- gfs3_fsetattr_req this_req = {0,};
-
- this_req = array[i].compound_req_u.compound_fsetattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_TRUNCATE:
+ SERVER_FOP_RSP_CLEANUP(rsp, truncate, i);
break;
- }
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_readdirp_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_OPEN:
+ SERVER_FOP_RSP_CLEANUP(rsp, open, i);
break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gfs3_fremovexattr_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fremovexattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_READ:
+ SERVER_FOP_RSP_CLEANUP(rsp, read, i);
break;
- }
- case GF_FOP_FALLOCATE:
- {
- gfs3_fallocate_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_fallocate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_WRITE:
+ SERVER_FOP_RSP_CLEANUP(rsp, write, i);
break;
- }
- case GF_FOP_DISCARD:
- {
- gfs3_discard_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_discard_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_STATFS:
+ SERVER_FOP_RSP_CLEANUP(rsp, statfs, i);
break;
- }
- case GF_FOP_ZEROFILL:
- {
- gfs3_zerofill_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_zerofill_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_FSYNC:
+ SERVER_FOP_RSP_CLEANUP(rsp, fsync, i);
break;
- }
- case GF_FOP_SEEK:
- {
- gfs3_seek_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_seek_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
+ case GF_FOP_OPENDIR:
+ SERVER_FOP_RSP_CLEANUP(rsp, opendir, i);
break;
- }
- case GF_FOP_LEASE:
- {
- gfs3_lease_req this_req = { {0,} };
-
- this_req = array[i].compound_req_u.compound_lease_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, this_req.gfid, 16);
+ case GF_FOP_CREATE:
+ SERVER_FOP_RSP_CLEANUP(rsp, create, i);
+ break;
+ case GF_FOP_FTRUNCATE:
+ SERVER_FOP_RSP_CLEANUP(rsp, ftruncate, i);
+ break;
+ case GF_FOP_FSTAT:
+ SERVER_FOP_RSP_CLEANUP(rsp, fstat, i);
+ break;
+ case GF_FOP_LK:
+ SERVER_FOP_RSP_CLEANUP(rsp, lk, i);
+ break;
+ case GF_FOP_LOOKUP:
+ SERVER_FOP_RSP_CLEANUP(rsp, lookup, i);
+ break;
+ case GF_FOP_SETATTR:
+ SERVER_FOP_RSP_CLEANUP(rsp, setattr, i);
+ break;
+ case GF_FOP_FSETATTR:
+ SERVER_FOP_RSP_CLEANUP(rsp, fsetattr, i);
+ break;
+ case GF_FOP_FALLOCATE:
+ SERVER_FOP_RSP_CLEANUP(rsp, fallocate, i);
+ break;
+ case GF_FOP_DISCARD:
+ SERVER_FOP_RSP_CLEANUP(rsp, discard, i);
+ break;
+ case GF_FOP_ZEROFILL:
+ SERVER_FOP_RSP_CLEANUP(rsp, zerofill, i);
+ break;
+ case GF_FOP_IPC:
+ SERVER_FOP_RSP_CLEANUP(rsp, ipc, i);
+ break;
+ case GF_FOP_SEEK:
+ SERVER_FOP_RSP_CLEANUP(rsp, seek, i);
+ break;
+ case GF_FOP_LEASE:
+ SERVER_FOP_RSP_CLEANUP(rsp, lease, i);
+ break;
+ /* fops that use gf_common_rsp */
+ case GF_FOP_FLUSH:
+ SERVER_COMMON_RSP_CLEANUP(rsp, flush, i);
+ break;
+ case GF_FOP_SETXATTR:
+ SERVER_COMMON_RSP_CLEANUP(rsp, setxattr, i);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ SERVER_COMMON_RSP_CLEANUP(rsp, removexattr, i);
+ break;
+ case GF_FOP_FSETXATTR:
+ SERVER_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ SERVER_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
+ break;
+ case GF_FOP_FSYNCDIR:
+ SERVER_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
+ break;
+ case GF_FOP_ACCESS:
+ SERVER_COMMON_RSP_CLEANUP(rsp, access, i);
+ break;
+ case GF_FOP_INODELK:
+ SERVER_COMMON_RSP_CLEANUP(rsp, inodelk, i);
+ break;
+ case GF_FOP_FINODELK:
+ SERVER_COMMON_RSP_CLEANUP(rsp, finodelk, i);
+ break;
+ case GF_FOP_ENTRYLK:
+ SERVER_COMMON_RSP_CLEANUP(rsp, entrylk, i);
+ break;
+ case GF_FOP_FENTRYLK:
+ SERVER_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
+ break;
+ case GF_FOP_READLINK:
+ SERVER_FOP_RSP_CLEANUP(rsp, readlink, i);
+ break;
+ case GF_FOP_RCHECKSUM:
+ SERVER_FOP_RSP_CLEANUP(rsp, rchecksum, i);
+ break;
+ /* fops that need extra cleanup */
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, xattrop);
+ SERVER_FOP_RSP_CLEANUP(rsp, xattrop, i);
+ GF_FREE(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, fxattrop);
+ SERVER_FOP_RSP_CLEANUP(rsp, fxattrop, i);
+ GF_FREE(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdir);
+ SERVER_FOP_RSP_CLEANUP(rsp, readdir, i);
+ readdir_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdirp);
+ SERVER_FOP_RSP_CLEANUP(rsp, readdir, i);
+ readdirp_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, getxattr);
+ SERVER_FOP_RSP_CLEANUP(rsp, getxattr, i);
+ GF_FREE(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ fgetxattr);
+ SERVER_FOP_RSP_CLEANUP(rsp, fgetxattr, i);
+ GF_FREE(tmp_rsp->dict.dict_val);
+ break;
+ }
+ default:
break;
}
- default:
- return ENOTSUP;
- }
- return 0;
+ }
+ GF_FREE(rsp->compound_rsp_array.compound_rsp_array_val);
+ return;
}
void
-server_compound_rsp_cleanup (gfs3_compound_rsp *rsp, compound_args_cbk_t *args)
+server_compound_req_cleanup(gfs3_compound_req *req, int len)
{
- int i, len = 0;
- compound_rsp *this_rsp = NULL;
-
- if (!rsp->compound_rsp_array.compound_rsp_array_val)
- return;
-
- len = rsp->compound_rsp_array.compound_rsp_array_len;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (args->enum_list[i]) {
- case GF_FOP_STAT:
- SERVER_FOP_RSP_CLEANUP (rsp, stat, i);
- break;
- case GF_FOP_MKNOD:
- SERVER_FOP_RSP_CLEANUP (rsp, mknod, i);
- break;
- case GF_FOP_MKDIR:
- SERVER_FOP_RSP_CLEANUP (rsp, mkdir, i);
- break;
- case GF_FOP_UNLINK:
- SERVER_FOP_RSP_CLEANUP (rsp, unlink, i);
- break;
- case GF_FOP_RMDIR:
- SERVER_FOP_RSP_CLEANUP (rsp, rmdir, i);
- break;
- case GF_FOP_SYMLINK:
- SERVER_FOP_RSP_CLEANUP (rsp, symlink, i);
- break;
- case GF_FOP_RENAME:
- SERVER_FOP_RSP_CLEANUP (rsp, rename, i);
- break;
- case GF_FOP_LINK:
- SERVER_FOP_RSP_CLEANUP (rsp, link, i);
- break;
- case GF_FOP_TRUNCATE:
- SERVER_FOP_RSP_CLEANUP (rsp, truncate, i);
- break;
- case GF_FOP_OPEN:
- SERVER_FOP_RSP_CLEANUP (rsp, open, i);
- break;
- case GF_FOP_READ:
- SERVER_FOP_RSP_CLEANUP (rsp, read, i);
- break;
- case GF_FOP_WRITE:
- SERVER_FOP_RSP_CLEANUP (rsp, write, i);
- break;
- case GF_FOP_STATFS:
- SERVER_FOP_RSP_CLEANUP (rsp, statfs, i);
- break;
- case GF_FOP_FSYNC:
- SERVER_FOP_RSP_CLEANUP (rsp, fsync, i);
- break;
- case GF_FOP_OPENDIR:
- SERVER_FOP_RSP_CLEANUP (rsp, opendir, i);
- break;
- case GF_FOP_CREATE:
- SERVER_FOP_RSP_CLEANUP (rsp, create, i);
- break;
- case GF_FOP_FTRUNCATE:
- SERVER_FOP_RSP_CLEANUP (rsp, ftruncate, i);
- break;
- case GF_FOP_FSTAT:
- SERVER_FOP_RSP_CLEANUP (rsp, fstat, i);
- break;
- case GF_FOP_LK:
- SERVER_FOP_RSP_CLEANUP (rsp, lk, i);
- break;
- case GF_FOP_LOOKUP:
- SERVER_FOP_RSP_CLEANUP (rsp, lookup, i);
- break;
- case GF_FOP_SETATTR:
- SERVER_FOP_RSP_CLEANUP (rsp, setattr, i);
- break;
- case GF_FOP_FSETATTR:
- SERVER_FOP_RSP_CLEANUP (rsp, fsetattr, i);
- break;
- case GF_FOP_FALLOCATE:
- SERVER_FOP_RSP_CLEANUP (rsp, fallocate, i);
- break;
- case GF_FOP_DISCARD:
- SERVER_FOP_RSP_CLEANUP (rsp, discard, i);
- break;
- case GF_FOP_ZEROFILL:
- SERVER_FOP_RSP_CLEANUP (rsp, zerofill, i);
- break;
- case GF_FOP_IPC:
- SERVER_FOP_RSP_CLEANUP (rsp, ipc, i);
- break;
- case GF_FOP_SEEK:
- SERVER_FOP_RSP_CLEANUP (rsp, seek, i);
- break;
- case GF_FOP_LEASE:
- SERVER_FOP_RSP_CLEANUP (rsp, lease, i);
- break;
- /* fops that use gf_common_rsp */
- case GF_FOP_FLUSH:
- SERVER_COMMON_RSP_CLEANUP (rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- SERVER_COMMON_RSP_CLEANUP (rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- SERVER_COMMON_RSP_CLEANUP (rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- SERVER_COMMON_RSP_CLEANUP (rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- SERVER_COMMON_RSP_CLEANUP (rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER_COMMON_RSP_CLEANUP (rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- SERVER_COMMON_RSP_CLEANUP (rsp, access, i);
- break;
- case GF_FOP_INODELK:
- SERVER_COMMON_RSP_CLEANUP (rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- SERVER_COMMON_RSP_CLEANUP (rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- SERVER_COMMON_RSP_CLEANUP (rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- SERVER_COMMON_RSP_CLEANUP (rsp, fentrylk, i);
- break;
- case GF_FOP_READLINK:
- SERVER_FOP_RSP_CLEANUP (rsp, readlink, i);
- break;
- case GF_FOP_RCHECKSUM:
- SERVER_FOP_RSP_CLEANUP (rsp, rchecksum, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- xattrop);
- SERVER_FOP_RSP_CLEANUP (rsp, xattrop, i);
- GF_FREE (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fxattrop);
- SERVER_FOP_RSP_CLEANUP (rsp, fxattrop, i);
- GF_FREE (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_READDIR:
- {
- gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdir);
- SERVER_FOP_RSP_CLEANUP (rsp, readdir, i);
- readdir_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdirp);
- SERVER_FOP_RSP_CLEANUP (rsp, readdir, i);
- readdirp_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- getxattr);
- SERVER_FOP_RSP_CLEANUP (rsp, getxattr, i);
- GF_FREE (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fgetxattr);
- SERVER_FOP_RSP_CLEANUP (rsp, fgetxattr, i);
- GF_FREE (tmp_rsp->dict.dict_val);
- break;
- }
- default:
- break;
- }
- }
- GF_FREE (rsp->compound_rsp_array.compound_rsp_array_val);
+ int i = 0;
+ compound_req *curr_req = NULL;
+
+ if (!req->compound_req_array.compound_req_array_val)
return;
-}
-void
-server_compound_req_cleanup (gfs3_compound_req *req, int len)
-{
- int i = 0;
- compound_req *curr_req = NULL;
-
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < len; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, stat);
- break;
- case GF_FOP_READLINK:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_req *args = &CPD_REQ_FIELD (curr_req, mkdir);
+ for (i = 0; i < len; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, mkdir);
- free (args->bname);
- break;
- }
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_req *args = &CPD_REQ_FIELD (curr_req,
- unlink);
+ switch (curr_req->fop_enum) {
+ case GF_FOP_STAT:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, stat);
+ break;
+ case GF_FOP_READLINK:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, readlink);
+ break;
+ case GF_FOP_MKNOD:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, mknod);
+ break;
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_req *args = &CPD_REQ_FIELD(curr_req, mkdir);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, unlink);
- free (args->bname);
- break;
- }
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_req *args = &CPD_REQ_FIELD (curr_req,
- rmdir);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_req *args = &CPD_REQ_FIELD(curr_req, unlink);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, rmdir);
- free (args->bname);
- break;
- }
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_req *args = &CPD_REQ_FIELD (curr_req,
- symlink);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, unlink);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_req *args = &CPD_REQ_FIELD(curr_req, rmdir);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, symlink);
- free (args->bname);
- free (args->linkname);
- break;
- }
- case GF_FOP_RENAME:
- {
- gfs3_rename_req *args = &CPD_REQ_FIELD (curr_req,
- rename);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_req *args = &CPD_REQ_FIELD(curr_req, symlink);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, rename);
- free (args->oldbname);
- free (args->newbname);
- break;
- }
- case GF_FOP_LINK:
- {
- gfs3_link_req *args = &CPD_REQ_FIELD (curr_req,
- link);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, symlink);
+ free(args->bname);
+ free(args->linkname);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfs3_rename_req *args = &CPD_REQ_FIELD(curr_req, rename);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, link);
- free (args->newbname);
- break;
- }
- case GF_FOP_TRUNCATE:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, open);
- break;
- case GF_FOP_READ:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, read);
- break;
- case GF_FOP_WRITE:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, write);
- break;
- case GF_FOP_STATFS:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fsync);
- break;
- case GF_FOP_SETXATTR:
- {
- gfs3_setxattr_req *args = &CPD_REQ_FIELD (curr_req,
- setxattr);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, rename);
+ free(args->oldbname);
+ free(args->newbname);
+ break;
+ }
+ case GF_FOP_LINK: {
+ gfs3_link_req *args = &CPD_REQ_FIELD(curr_req, link);
- free (args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_req *args = &CPD_REQ_FIELD (curr_req,
- getxattr);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, link);
+ free(args->newbname);
+ break;
+ }
+ case GF_FOP_TRUNCATE:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, truncate);
+ break;
+ case GF_FOP_OPEN:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, open);
+ break;
+ case GF_FOP_READ:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, read);
+ break;
+ case GF_FOP_WRITE:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, write);
+ break;
+ case GF_FOP_STATFS:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, statfs);
+ break;
+ case GF_FOP_FLUSH:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, flush);
+ break;
+ case GF_FOP_FSYNC:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsync);
+ break;
+ case GF_FOP_SETXATTR: {
+ gfs3_setxattr_req *args = &CPD_REQ_FIELD(curr_req, setxattr);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, getxattr);
- free (args->name);
- break;
- }
- case GF_FOP_REMOVEXATTR:
- {
- gfs3_removexattr_req *args = &CPD_REQ_FIELD (curr_req,
- removexattr);
+ free(args->dict.dict_val);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_req *args = &CPD_REQ_FIELD(curr_req, getxattr);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, removexattr);
- free (args->name);
- break;
- }
- case GF_FOP_OPENDIR:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, access);
- break;
- case GF_FOP_CREATE:
- {
- gfs3_create_req *args = &CPD_REQ_FIELD (curr_req,
- create);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR: {
+ gfs3_removexattr_req *args = &CPD_REQ_FIELD(curr_req,
+ removexattr);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, create);
- free (args->bname);
- break;
- }
- case GF_FOP_FTRUNCATE:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fstat);
- break;
- case GF_FOP_LK:
- {
- gfs3_lk_req *args = &CPD_REQ_FIELD (curr_req, lk);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_OPENDIR:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, opendir);
+ break;
+ case GF_FOP_FSYNCDIR:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
+ break;
+ case GF_FOP_ACCESS:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, access);
+ break;
+ case GF_FOP_CREATE: {
+ gfs3_create_req *args = &CPD_REQ_FIELD(curr_req, create);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, lk);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_req *args = &CPD_REQ_FIELD (curr_req,
- lookup);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, create);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_FTRUNCATE:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
+ break;
+ case GF_FOP_FSTAT:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fstat);
+ break;
+ case GF_FOP_LK: {
+ gfs3_lk_req *args = &CPD_REQ_FIELD(curr_req, lk);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, lookup);
- free (args->bname);
- break;
- }
- case GF_FOP_READDIR:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- {
- gfs3_inodelk_req *args = &CPD_REQ_FIELD (curr_req,
- inodelk);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, lk);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_req *args = &CPD_REQ_FIELD(curr_req, lookup);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, inodelk);
- free (args->volume);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_FINODELK:
- {
- gfs3_finodelk_req *args = &CPD_REQ_FIELD (curr_req,
- finodelk);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, lookup);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_READDIR:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, readdir);
+ break;
+ case GF_FOP_INODELK: {
+ gfs3_inodelk_req *args = &CPD_REQ_FIELD(curr_req, inodelk);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, finodelk);
- free (args->volume);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_ENTRYLK:
- {
- gfs3_entrylk_req *args = &CPD_REQ_FIELD (curr_req,
- entrylk);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
+ free(args->volume);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_FINODELK: {
+ gfs3_finodelk_req *args = &CPD_REQ_FIELD(curr_req, finodelk);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, entrylk);
- free (args->volume);
- free (args->name);
- break;
- }
- case GF_FOP_FENTRYLK:
- {
- gfs3_fentrylk_req *args = &CPD_REQ_FIELD (curr_req,
- fentrylk);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
+ free(args->volume);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_ENTRYLK: {
+ gfs3_entrylk_req *args = &CPD_REQ_FIELD(curr_req, entrylk);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fentrylk);
- free (args->volume);
- free (args->name);
- break;
- }
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_req *args = &CPD_REQ_FIELD (curr_req,
- xattrop);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
+ free(args->volume);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FENTRYLK: {
+ gfs3_fentrylk_req *args = &CPD_REQ_FIELD(curr_req, fentrylk);
- free (args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_req *args = &CPD_REQ_FIELD (curr_req,
- fxattrop);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
+ free(args->volume);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_req *args = &CPD_REQ_FIELD(curr_req, xattrop);
- free (args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_req *args = &CPD_REQ_FIELD (curr_req,
- fgetxattr);
+ free(args->dict.dict_val);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_req *args = &CPD_REQ_FIELD(curr_req, fxattrop);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fgetxattr);
- free (args->name);
- break;
- }
- case GF_FOP_FSETXATTR:
- {
- gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req,
- fsetxattr);
+ free(args->dict.dict_val);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_req *args = &CPD_REQ_FIELD(curr_req, fgetxattr);
- free (args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_req *args = &CPD_REQ_FIELD (curr_req,
- readdirp);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FSETXATTR: {
+ gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req, fsetxattr);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- free (args->dict.dict_val);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gfs3_fremovexattr_req *args = &CPD_REQ_FIELD(curr_req,
- fremovexattr);
+ free(args->dict.dict_val);
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
+ break;
+ case GF_FOP_SETATTR:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, setattr);
+ break;
+ case GF_FOP_FSETATTR:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
+ break;
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req, readdirp);
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- free (args->name);
- break;
- }
- case GF_FOP_FALLOCATE:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- SERVER_COMPOUND_FOP_CLEANUP (curr_req, seek);
- break;
- default:
- break;
- }
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
+ free(args->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR: {
+ gfs3_fremovexattr_req *args = &CPD_REQ_FIELD(curr_req,
+ fremovexattr);
+
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FALLOCATE:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
+ break;
+ case GF_FOP_DISCARD:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, discard);
+ break;
+ case GF_FOP_ZEROFILL:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
+ break;
+ case GF_FOP_IPC:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, ipc);
+ break;
+ case GF_FOP_SEEK:
+ SERVER_COMPOUND_FOP_CLEANUP(curr_req, seek);
+ break;
+ default:
+ break;
}
+ }
- return;
+ return;
}
/* compound v2 */
int
-server_populate_compound_request_v2 (gfx_compound_req *req, call_frame_t *frame,
- default_args_t *this_args,
- int index)
+server_populate_compound_request_v2(gfx_compound_req *req, call_frame_t *frame,
+ default_args_t *this_args, int index)
{
- int op_errno = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec req_iovec[MAX_IOVEC] = { {0,} };
- compound_req_v2 *this_req = NULL;
- server_state_t *state = CALL_STATE (frame);
+ int op_errno = 0;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec req_iovec[MAX_IOVEC] = {{
+ 0,
+ }};
+ compound_req_v2 *this_req = NULL;
+ server_state_t *state = CALL_STATE(frame);
- this_req = &req->compound_req_array.compound_req_array_val[index];
+ this_req = &req->compound_req_array.compound_req_array_val[index];
- switch (this_req->fop_enum) {
- case GF_FOP_STAT:
- {
- gfx_stat_req *args = NULL;
+ switch (this_req->fop_enum) {
+ case GF_FOP_STAT: {
+ gfx_stat_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_stat_req;
+ args = &this_req->compound_req_v2_u.compound_stat_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_stat_store (this_args, &state->loc, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_stat_store(this_args, &state->loc, xdata);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfx_readlink_req *args = NULL;
+ case GF_FOP_READLINK: {
+ gfx_readlink_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_readlink_req;
+ args = &this_req->compound_req_v2_u.compound_readlink_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_readlink_store (this_args, &state->loc, args->size, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_readlink_store(this_args, &state->loc, args->size, xdata);
+ break;
}
- case GF_FOP_MKNOD:
- {
- gfx_mknod_req *args = NULL;
+ case GF_FOP_MKNOD: {
+ gfx_mknod_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_mknod_req;
+ args = &this_req->compound_req_v2_u.compound_mknod_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_mknod_store (this_args, &state->loc, args->mode, args->dev,
- args->umask, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_mknod_store(this_args, &state->loc, args->mode, args->dev,
+ args->umask, xdata);
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfx_mkdir_req *args = NULL;
+ case GF_FOP_MKDIR: {
+ gfx_mkdir_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_mkdir_req;
+ args = &this_req->compound_req_v2_u.compound_mkdir_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_mkdir_store (this_args, &state->loc, args->mode,
- args->umask, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_mkdir_store(this_args, &state->loc, args->mode, args->umask,
+ xdata);
+ break;
}
- case GF_FOP_UNLINK:
- {
- gfx_unlink_req *args = NULL;
+ case GF_FOP_UNLINK: {
+ gfx_unlink_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_unlink_req;
+ args = &this_req->compound_req_v2_u.compound_unlink_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_unlink_store (this_args, &state->loc, args->xflags, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_unlink_store(this_args, &state->loc, args->xflags, xdata);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfx_rmdir_req *args = NULL;
+ case GF_FOP_RMDIR: {
+ gfx_rmdir_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_rmdir_req;
+ args = &this_req->compound_req_v2_u.compound_rmdir_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_rmdir_store (this_args, &state->loc, args->xflags, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_rmdir_store(this_args, &state->loc, args->xflags, xdata);
+ break;
}
- case GF_FOP_SYMLINK:
- {
- gfx_symlink_req *args = NULL;
+ case GF_FOP_SYMLINK: {
+ gfx_symlink_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_symlink_req;
+ args = &this_req->compound_req_v2_u.compound_symlink_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_symlink_store (this_args, args->linkname, &state->loc,
- args->umask, xdata);
+ xdr_to_dict(&args->xdata, &xdata);
+ args_symlink_store(this_args, args->linkname, &state->loc,
+ args->umask, xdata);
- this_args->loc.inode = inode_new (state->itable);
+ this_args->loc.inode = inode_new(state->itable);
- break;
+ break;
}
- case GF_FOP_RENAME:
- {
- gfx_rename_req *args = NULL;
+ case GF_FOP_RENAME: {
+ gfx_rename_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_rename_req;
+ args = &this_req->compound_req_v2_u.compound_rename_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_rename_store (this_args, &state->loc, &state->loc2, xdata);
- break;
+ args_rename_store(this_args, &state->loc, &state->loc2, xdata);
+ break;
}
- case GF_FOP_LINK:
- {
- gfx_link_req *args = NULL;
+ case GF_FOP_LINK: {
+ gfx_link_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_link_req;
+ args = &this_req->compound_req_v2_u.compound_link_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_link_store (this_args, &state->loc, &state->loc2, xdata);
+ xdr_to_dict(&args->xdata, &xdata);
+ args_link_store(this_args, &state->loc, &state->loc2, xdata);
- this_args->loc2.inode = inode_ref (this_args->loc.inode);
+ this_args->loc2.inode = inode_ref(this_args->loc.inode);
- break;
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfx_truncate_req *args = NULL;
+ case GF_FOP_TRUNCATE: {
+ gfx_truncate_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_truncate_req;
+ args = &this_req->compound_req_v2_u.compound_truncate_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_truncate_store (this_args, &state->loc, args->offset,
- xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_truncate_store(this_args, &state->loc, args->offset, xdata);
+ break;
}
- case GF_FOP_OPEN:
- {
- gfx_open_req *args = NULL;
+ case GF_FOP_OPEN: {
+ gfx_open_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_open_req;
+ args = &this_req->compound_req_v2_u.compound_open_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_open_store (this_args, &state->loc, args->flags, state->fd,
- xdata);
+ xdr_to_dict(&args->xdata, &xdata);
+ args_open_store(this_args, &state->loc, args->flags, state->fd,
+ xdata);
- this_args->fd = fd_create (this_args->loc.inode,
- frame->root->pid);
- this_args->fd->flags = this_args->flags;
+ this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
+ this_args->fd->flags = this_args->flags;
- break;
+ break;
}
- case GF_FOP_READ:
- {
- gfx_read_req *args = NULL;
+ case GF_FOP_READ: {
+ gfx_read_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_read_req;
+ args = &this_req->compound_req_v2_u.compound_read_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_readv_store (this_args, state->fd, args->size,
- args->offset, args->flag, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_readv_store(this_args, state->fd, args->size, args->offset,
+ args->flag, xdata);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfx_write_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_write_req;
-
- /*TODO : What happens when payload count is more than one? */
- req_iovec[0].iov_base = state->payload_vector[0].iov_base +
- state->write_length;
- req_iovec[0].iov_len = args->size;
-
- xdr_to_dict (&args->xdata, &xdata);
- /* The way writev fop works :
- * xdr args of write along with other args contains
- * write length not count. But when the call is wound to posix,
- * this length is not used. It is taken from the request
- * write vector that is passed down. Posix needs the vector
- * count to determine the amount of write to be done.
- * This count for writes that come as part of compound fops
- * will be 1. The vectors are merged into one under
- * GF_FOP_WRITE section of client_handle_fop_requirements()
- * in protocol client.
- */
- args_writev_store (this_args, state->fd, req_iovec, 1,
- args->offset, args->flag, state->iobref,
- xdata);
- state->write_length += req_iovec[0].iov_len;
- break;
- }
- case GF_FOP_STATFS:
- {
- gfx_statfs_req *args = NULL;
+ case GF_FOP_WRITE: {
+ gfx_write_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_statfs_req;
+ args = &this_req->compound_req_v2_u.compound_write_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_statfs_store (this_args, &state->loc, xdata);
- break;
+ /*TODO : What happens when payload count is more than one? */
+ req_iovec[0].iov_base = state->payload_vector[0].iov_base +
+ state->write_length;
+ req_iovec[0].iov_len = args->size;
+
+ xdr_to_dict(&args->xdata, &xdata);
+ /* The way writev fop works :
+ * xdr args of write along with other args contains
+ * write length not count. But when the call is wound to posix,
+ * this length is not used. It is taken from the request
+ * write vector that is passed down. Posix needs the vector
+ * count to determine the amount of write to be done.
+ * This count for writes that come as part of compound fops
+ * will be 1. The vectors are merged into one under
+ * GF_FOP_WRITE section of client_handle_fop_requirements()
+ * in protocol client.
+ */
+ args_writev_store(this_args, state->fd, req_iovec, 1, args->offset,
+ args->flag, state->iobref, xdata);
+ state->write_length += req_iovec[0].iov_len;
+ break;
}
- case GF_FOP_FLUSH:
- {
- gfx_flush_req *args = NULL;
+ case GF_FOP_STATFS: {
+ gfx_statfs_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_flush_req;
+ args = &this_req->compound_req_v2_u.compound_statfs_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_flush_store (this_args, state->fd, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_statfs_store(this_args, &state->loc, xdata);
+ break;
}
- case GF_FOP_FSYNC:
- {
- gfx_fsync_req *args = NULL;
+ case GF_FOP_FLUSH: {
+ gfx_flush_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fsync_req;
+ args = &this_req->compound_req_v2_u.compound_flush_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_fsync_store (this_args, state->fd, args->data, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_flush_store(this_args, state->fd, xdata);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gfx_setxattr_req *args = NULL;
+ case GF_FOP_FSYNC: {
+ gfx_fsync_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_setxattr_req;
+ args = &this_req->compound_req_v2_u.compound_fsync_req;
- xdr_to_dict (&args->dict, &xattr);
- xdr_to_dict (&args->xdata, &xdata);
- args_setxattr_store (this_args, &state->loc, xattr, args->flags,
- xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_fsync_store(this_args, state->fd, args->data, xdata);
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfx_getxattr_req *args = NULL;
+ case GF_FOP_SETXATTR: {
+ gfx_setxattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_getxattr_req;
+ args = &this_req->compound_req_v2_u.compound_setxattr_req;
- xdr_to_dict (&args->xdata, &xdata);
- gf_server_check_getxattr_cmd (frame, args->name);
+ xdr_to_dict(&args->dict, &xattr);
+ xdr_to_dict(&args->xdata, &xdata);
+ args_setxattr_store(this_args, &state->loc, xattr, args->flags,
+ xdata);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfx_getxattr_req *args = NULL;
- args_getxattr_store (this_args, &state->loc, args->name, xdata);
- break;
+ args = &this_req->compound_req_v2_u.compound_getxattr_req;
+
+ xdr_to_dict(&args->xdata, &xdata);
+ gf_server_check_getxattr_cmd(frame, args->name);
+
+ args_getxattr_store(this_args, &state->loc, args->name, xdata);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gfx_removexattr_req *args = NULL;
+ case GF_FOP_REMOVEXATTR: {
+ gfx_removexattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_removexattr_req;
+ args = &this_req->compound_req_v2_u.compound_removexattr_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_removexattr_store (this_args, &state->loc, args->name,
- xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_removexattr_store(this_args, &state->loc, args->name, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfx_opendir_req *args = NULL;
+ case GF_FOP_OPENDIR: {
+ gfx_opendir_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_opendir_req;
+ args = &this_req->compound_req_v2_u.compound_opendir_req;
- this_args->fd = fd_create (this_args->loc.inode,
- frame->root->pid);
- if (!this_args->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0,
- PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto out;
- }
- xdr_to_dict (&args->xdata, &xdata);
+ this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
+ if (!this_args->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
+ goto out;
+ }
+ xdr_to_dict(&args->xdata, &xdata);
- args_opendir_store (this_args, &state->loc, state->fd, xdata);
- break;
+ args_opendir_store(this_args, &state->loc, state->fd, xdata);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gfx_fsyncdir_req *args = NULL;
+ case GF_FOP_FSYNCDIR: {
+ gfx_fsyncdir_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fsyncdir_req;
+ args = &this_req->compound_req_v2_u.compound_fsyncdir_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_fsyncdir_store (this_args, state->fd, args->data, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_fsyncdir_store(this_args, state->fd, args->data, xdata);
+ break;
}
- case GF_FOP_ACCESS:
- {
- gfx_access_req *args = NULL;
+ case GF_FOP_ACCESS: {
+ gfx_access_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_access_req;
+ args = &this_req->compound_req_v2_u.compound_access_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_access_store (this_args, &state->loc, args->mask, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_access_store(this_args, &state->loc, args->mask, xdata);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfx_create_req *args = NULL;
+ case GF_FOP_CREATE: {
+ gfx_create_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_create_req;
+ args = &this_req->compound_req_v2_u.compound_create_req;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0,
- PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ?
- uuid_utoa (state->loc.inode->gfid):NULL);
- goto out;
- }
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ? uuid_utoa(state->loc.inode->gfid)
+ : NULL);
+ goto out;
+ }
+ state->fd->flags = state->flags;
- xdr_to_dict (&args->xdata, &xdata);
- args_create_store (this_args, &state->loc, args->flags,
- args->mode, args->umask, state->fd, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_create_store(this_args, &state->loc, args->flags, args->mode,
+ args->umask, state->fd, xdata);
+ break;
}
- case GF_FOP_FTRUNCATE:
- {
- gfx_ftruncate_req *args = NULL;
+ case GF_FOP_FTRUNCATE: {
+ gfx_ftruncate_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_ftruncate_req;
+ args = &this_req->compound_req_v2_u.compound_ftruncate_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_ftruncate_store (this_args, state->fd, args->offset,
- xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_ftruncate_store(this_args, state->fd, args->offset, xdata);
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfx_fstat_req *args = NULL;
+ case GF_FOP_FSTAT: {
+ gfx_fstat_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fstat_req;
+ args = &this_req->compound_req_v2_u.compound_fstat_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_fstat_store (this_args, state->fd, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_fstat_store(this_args, state->fd, xdata);
+ break;
}
- case GF_FOP_LK:
- {
- gfx_lk_req *args = NULL;
+ case GF_FOP_LK: {
+ gfx_lk_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_lk_req;
+ args = &this_req->compound_req_v2_u.compound_lk_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- switch (args->cmd) {
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
+ this_args->cmd = F_SETLKW;
+ break;
case GF_LK_RESLK_LCK:
- this_args->cmd = F_RESLK_LCK;
- break;
+ this_args->cmd = F_RESLK_LCK;
+ break;
case GF_LK_RESLK_LCKW:
- this_args->cmd = F_RESLK_LCKW;
- break;
+ this_args->cmd = F_RESLK_LCKW;
+ break;
case GF_LK_RESLK_UNLCK:
- this_args->cmd = F_RESLK_UNLCK;
- break;
+ this_args->cmd = F_RESLK_UNLCK;
+ break;
case GF_LK_GETLK_FD:
- this_args->cmd = F_GETLK_FD;
- break;
- }
+ this_args->cmd = F_GETLK_FD;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
+ this_args->lock.l_type = F_UNLCK;
+ break;
default:
- gf_msg (frame->root->client->bound_xl->name,
- GF_LOG_ERROR,
- 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s):"
- " Unknown "
- "lock type: %"PRId32"!", state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid),
- args->type);
- break;
- }
- args_lk_store (this_args, state->fd, this_args->cmd,
- &this_args->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfx_lookup_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_lookup_req;
-
- if (this_args->loc.inode)
- this_args->loc.inode = server_inode_new (state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
-
- xdr_to_dict (&args->xdata, &xdata);
- args_lookup_store (this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READDIR:
- {
- gfx_readdir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_readdir_req;
-
- xdr_to_dict (&args->xdata, &xdata);
- args_readdir_store (this_args, state->fd, args->size,
- args->offset, xdata);
- break;
- }
- case GF_FOP_INODELK:
- {
- gfx_inodelk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_inodelk_req;
-
- switch (args->cmd) {
+ gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_LOCK_ERROR,
+ "fd - %" PRId64
+ " (%s):"
+ " Unknown "
+ "lock type: %" PRId32 "!",
+ state->resolve.fd_no,
+ uuid_utoa(state->fd->inode->gfid), args->type);
+ break;
+ }
+ args_lk_store(this_args, state->fd, this_args->cmd,
+ &this_args->lock, xdata);
+ break;
+ }
+ case GF_FOP_LOOKUP: {
+ gfx_lookup_req *args = NULL;
+
+ args = &this_req->compound_req_v2_u.compound_lookup_req;
+
+ if (this_args->loc.inode)
+ this_args->loc.inode = server_inode_new(state->itable,
+ state->loc.gfid);
+ else
+ state->is_revalidate = 1;
+
+ xdr_to_dict(&args->xdata, &xdata);
+ args_lookup_store(this_args, &state->loc, xdata);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfx_readdir_req *args = NULL;
+
+ args = &this_req->compound_req_v2_u.compound_readdir_req;
+
+ xdr_to_dict(&args->xdata, &xdata);
+ args_readdir_store(this_args, state->fd, args->size, args->offset,
+ xdata);
+ break;
+ }
+ case GF_FOP_INODELK: {
+ gfx_inodelk_req *args = NULL;
+
+ args = &this_req->compound_req_v2_u.compound_inodelk_req;
+
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
+ this_args->cmd = F_SETLKW;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
- xdr_to_dict (&args->xdata, &xdata);
- args_inodelk_store (this_args, args->volume, &state->loc,
- this_args->cmd, &this_args->lock, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_inodelk_store(this_args, args->volume, &state->loc,
+ this_args->cmd, &this_args->lock, xdata);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gfx_finodelk_req *args = NULL;
+ case GF_FOP_FINODELK: {
+ gfx_finodelk_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_finodelk_req;
+ args = &this_req->compound_req_v2_u.compound_finodelk_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- switch (args->cmd) {
+ switch (args->cmd) {
case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
+ this_args->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
+ this_args->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
+ this_args->cmd = F_SETLKW;
+ break;
+ }
- gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+ gf_proto_flock_to_flock(&args->flock, &this_args->lock);
- switch (args->type) {
+ switch (args->type) {
case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
+ this_args->lock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
+ this_args->lock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
- args_finodelk_store (this_args, args->volume, state->fd,
- this_args->cmd, &this_args->lock, xdata);
- break;
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
+ args_finodelk_store(this_args, args->volume, state->fd,
+ this_args->cmd, &this_args->lock, xdata);
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gfx_entrylk_req *args = NULL;
+ case GF_FOP_ENTRYLK: {
+ gfx_entrylk_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_entrylk_req;
+ args = &this_req->compound_req_v2_u.compound_entrylk_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_entrylk_store (this_args, args->volume, &state->loc,
- args->name, args->cmd, args->type, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_entrylk_store(this_args, args->volume, &state->loc, args->name,
+ args->cmd, args->type, xdata);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gfx_fentrylk_req *args = NULL;
+ case GF_FOP_FENTRYLK: {
+ gfx_fentrylk_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fentrylk_req;
+ args = &this_req->compound_req_v2_u.compound_fentrylk_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_fentrylk_store (this_args, args->volume, state->fd,
- args->name, args->cmd, args->type, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_fentrylk_store(this_args, args->volume, state->fd, args->name,
+ args->cmd, args->type, xdata);
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfx_xattrop_req *args = NULL;
+ case GF_FOP_XATTROP: {
+ gfx_xattrop_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_xattrop_req;
+ args = &this_req->compound_req_v2_u.compound_xattrop_req;
- xdr_to_dict (&args->dict, &xattr);
+ xdr_to_dict(&args->dict, &xattr);
- xdr_to_dict (&args->xdata, &xdata);
- args_xattrop_store (this_args, &state->loc, args->flags,
- xattr, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_xattrop_store(this_args, &state->loc, args->flags, xattr,
+ xdata);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfx_fxattrop_req *args = NULL;
+ case GF_FOP_FXATTROP: {
+ gfx_fxattrop_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fxattrop_req;
+ args = &this_req->compound_req_v2_u.compound_fxattrop_req;
- xdr_to_dict (&args->dict, &xattr);
+ xdr_to_dict(&args->dict, &xattr);
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_fxattrop_store (this_args, state->fd, args->flags, xattr,
- xdata);
- break;
+ args_fxattrop_store(this_args, state->fd, args->flags, xattr,
+ xdata);
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfx_fgetxattr_req *args = NULL;
+ case GF_FOP_FGETXATTR: {
+ gfx_fgetxattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fgetxattr_req;
+ args = &this_req->compound_req_v2_u.compound_fgetxattr_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_fgetxattr_store (this_args, state->fd, args->name, xdata);
- break;
+ args_fgetxattr_store(this_args, state->fd, args->name, xdata);
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gfx_fsetxattr_req *args = NULL;
+ case GF_FOP_FSETXATTR: {
+ gfx_fsetxattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fsetxattr_req;
+ args = &this_req->compound_req_v2_u.compound_fsetxattr_req;
- xdr_to_dict (&args->dict, &xattr);
+ xdr_to_dict(&args->dict, &xattr);
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_fsetxattr_store (this_args, state->fd, xattr, args->flags,
- xdata);
- break;
+ args_fsetxattr_store(this_args, state->fd, xattr, args->flags,
+ xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfx_rchecksum_req *args = NULL;
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_rchecksum_req;
+ args = &this_req->compound_req_v2_u.compound_rchecksum_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_rchecksum_store (this_args, state->fd, args->offset,
- args->len, xdata);
- break;
+ args_rchecksum_store(this_args, state->fd, args->offset, args->len,
+ xdata);
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfx_setattr_req *args = NULL;
+ case GF_FOP_SETATTR: {
+ gfx_setattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_setattr_req;
+ args = &this_req->compound_req_v2_u.compound_setattr_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- gfx_stat_to_iattx (&args->stbuf, &this_args->stat);
+ gfx_stat_to_iattx(&args->stbuf, &this_args->stat);
- args_setattr_store (this_args, &state->loc, &this_args->stat,
- args->valid, xdata);
- break;
+ args_setattr_store(this_args, &state->loc, &this_args->stat,
+ args->valid, xdata);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfx_fsetattr_req *args = NULL;
+ case GF_FOP_FSETATTR: {
+ gfx_fsetattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fsetattr_req;
+ args = &this_req->compound_req_v2_u.compound_fsetattr_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- gfx_stat_to_iattx (&args->stbuf, &this_args->stat);
+ gfx_stat_to_iattx(&args->stbuf, &this_args->stat);
- args_fsetattr_store (this_args, state->fd, &this_args->stat,
- args->valid, xdata);
- break;
+ args_fsetattr_store(this_args, state->fd, &this_args->stat,
+ args->valid, xdata);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_req *args = NULL;
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_readdirp_req;
+ args = &this_req->compound_req_v2_u.compound_readdirp_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_readdirp_store (this_args, state->fd, args->size,
- args->offset, xattr);
- break;
+ args_readdirp_store(this_args, state->fd, args->size, args->offset,
+ xattr);
+ break;
}
- case GF_FOP_FREMOVEXATTR:
- {
- gfx_fremovexattr_req *args = NULL;
+ case GF_FOP_FREMOVEXATTR: {
+ gfx_fremovexattr_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fremovexattr_req;
+ args = &this_req->compound_req_v2_u.compound_fremovexattr_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_fremovexattr_store (this_args, state->fd, args->name,
- xdata);
- break;
+ args_fremovexattr_store(this_args, state->fd, args->name, xdata);
+ break;
}
- case GF_FOP_FALLOCATE:
- {
- gfx_fallocate_req *args = NULL;
+ case GF_FOP_FALLOCATE: {
+ gfx_fallocate_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_fallocate_req;
+ args = &this_req->compound_req_v2_u.compound_fallocate_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_fallocate_store (this_args, state->fd, args->flags,
- args->offset, args->size, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_fallocate_store(this_args, state->fd, args->flags,
+ args->offset, args->size, xdata);
+ break;
}
- case GF_FOP_DISCARD:
- {
- gfx_discard_req *args = NULL;
+ case GF_FOP_DISCARD: {
+ gfx_discard_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_discard_req;
+ args = &this_req->compound_req_v2_u.compound_discard_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- args_discard_store (this_args, state->fd, args->offset,
- args->size, xdata);
- break;
+ args_discard_store(this_args, state->fd, args->offset, args->size,
+ xdata);
+ break;
}
- case GF_FOP_ZEROFILL:
- {
- gfx_zerofill_req *args = NULL;
+ case GF_FOP_ZEROFILL: {
+ gfx_zerofill_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_zerofill_req;
+ args = &this_req->compound_req_v2_u.compound_zerofill_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_zerofill_store (this_args, state->fd, args->offset,
- args->size, xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_zerofill_store(this_args, state->fd, args->offset, args->size,
+ xdata);
+ break;
}
- case GF_FOP_SEEK:
- {
- gfx_seek_req *args = NULL;
+ case GF_FOP_SEEK: {
+ gfx_seek_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_seek_req;
+ args = &this_req->compound_req_v2_u.compound_seek_req;
- xdr_to_dict (&args->xdata, &xdata);
- args_seek_store (this_args, state->fd, args->offset, args->what,
- xdata);
- break;
+ xdr_to_dict(&args->xdata, &xdata);
+ args_seek_store(this_args, state->fd, args->offset, args->what,
+ xdata);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfx_lease_req *args = NULL;
+ case GF_FOP_LEASE: {
+ gfx_lease_req *args = NULL;
- args = &this_req->compound_req_v2_u.compound_lease_req;
+ args = &this_req->compound_req_v2_u.compound_lease_req;
- xdr_to_dict (&args->xdata, &xdata);
+ xdr_to_dict(&args->xdata, &xdata);
- gf_proto_lease_to_lease (&args->lease, &state->lease);
+ gf_proto_lease_to_lease(&args->lease, &state->lease);
- args_lease_store (this_args, &state->loc, &state->lease, xdata);
- break;
+ args_lease_store(this_args, &state->loc, &state->lease, xdata);
+ break;
}
default:
- return ENOTSUP;
- }
+ return ENOTSUP;
+ }
out:
- if (xattr)
- dict_unref (xattr);
- if (xdata)
- dict_unref (xdata);
- return op_errno;
+ if (xattr)
+ dict_unref(xattr);
+ if (xdata)
+ dict_unref(xdata);
+ return op_errno;
}
int
-server_populate_compound_response_v2 (xlator_t *this, gfx_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index)
+server_populate_compound_response_v2(xlator_t *this, gfx_compound_rsp *rsp,
+ call_frame_t *frame,
+ compound_args_cbk_t *args_cbk, int index)
{
- int op_errno = EINVAL;
- default_args_cbk_t *this_args_cbk = NULL;
- compound_rsp_v2 *this_rsp = NULL;
- server_state_t *state = NULL;
- int ret = 0;
+ int op_errno = EINVAL;
+ default_args_cbk_t *this_args_cbk = NULL;
+ compound_rsp_v2 *this_rsp = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
- state = CALL_STATE (frame);
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ state = CALL_STATE(frame);
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- this_args_cbk = &args_cbk->rsp_list[index];
- this_rsp->fop_enum = args_cbk->enum_list[index];
+ this_args_cbk = &args_cbk->rsp_list[index];
+ this_rsp->fop_enum = args_cbk->enum_list[index];
- switch (this_rsp->fop_enum) {
+ switch (this_rsp->fop_enum) {
case GF_FOP_FSTAT:
- case GF_FOP_STAT:
- {
- gfx_common_iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
-
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_common_iatt (state, rsp_args,
- &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READLINK:
- {
- gfx_readlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
-
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- if (this_args_cbk->op_ret >= 0) {
- server4_post_readlink (rsp_args, &this_args_cbk->stat,
- this_args_cbk->buf);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- if (!rsp_args->path)
- rsp_args->path = "";
- break;
+ case GF_FOP_STAT: {
+ gfx_common_iatt_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
+
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ if (!this_args_cbk->op_ret) {
+ server4_post_common_iatt(state, rsp_args, &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfx_readlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
+
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ if (this_args_cbk->op_ret >= 0) {
+ server4_post_readlink(rsp_args, &this_args_cbk->stat,
+ this_args_cbk->buf);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ if (!rsp_args->path)
+ rsp_args->path = "";
+ break;
}
case GF_FOP_MKNOD:
case GF_FOP_MKDIR:
case GF_FOP_SYMLINK:
- case GF_FOP_LINK:
- {
- gfx_common_3iatt_rsp *rsp_args = NULL;
+ case GF_FOP_LINK: {
+ gfx_common_3iatt_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_common_3iatt (state, rsp_args,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ if (!this_args_cbk->op_ret) {
+ server4_post_common_3iatt(
+ state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
case GF_FOP_UNLINK:
- case GF_FOP_RMDIR:
- {
- gfx_common_2iatt_rsp *rsp_args = NULL;
+ case GF_FOP_RMDIR: {
+ gfx_common_2iatt_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_entry_remove (state, rsp_args,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ if (!this_args_cbk->op_ret) {
+ server4_post_entry_remove(state, rsp_args,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_RENAME:
- {
- gfx_rename_rsp *rsp_args = NULL;
+ case GF_FOP_RENAME: {
+ gfx_rename_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_rename (frame, state, rsp_args,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server4_post_rename(
+ frame, state, rsp_args, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_FALLOCATE:
- case GF_FOP_ZEROFILL:
- case GF_FOP_DISCARD:
+ case GF_FOP_FALLOCATE:
+ case GF_FOP_ZEROFILL:
+ case GF_FOP_DISCARD:
case GF_FOP_SETATTR:
case GF_FOP_FSETATTR:
case GF_FOP_FTRUNCATE:
case GF_FOP_TRUNCATE:
case GF_FOP_WRITE:
- case GF_FOP_FSYNC:
- {
- gfx_common_2iatt_rsp *rsp_args = NULL;
+ case GF_FOP_FSYNC: {
+ gfx_common_2iatt_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_common_2iatt (rsp_args,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server4_post_common_2iatt(rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
case GF_FOP_OPEN:
- case GF_FOP_OPENDIR:
- {
- gfx_open_rsp *rsp_args = NULL;
+ case GF_FOP_OPENDIR: {
+ gfx_open_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_open (frame, this, rsp_args,
- this_args_cbk->fd);
-
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server4_post_open(frame, this, rsp_args, this_args_cbk->fd);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_READ:
- {
- gfx_read_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
-
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
-
- if (this_args_cbk->op_ret >= 0) {
- server4_post_readv (rsp_args, &this_args_cbk->stat,
- this_args_cbk->op_ret);
-
- if (!state->rsp_iobref) {
- state->rsp_iobref = this_args_cbk->iobref;
- state->rsp_count = 0;
- }
- iobref_merge (state->rsp_iobref,
- this_args_cbk->iobref);
- memcpy (&state->rsp_vector[state->rsp_count],
- this_args_cbk->vector,
- (this_args_cbk->count *
- sizeof(state->rsp_vector[0])));
- state->rsp_count += this_args_cbk->count;
+ case GF_FOP_READ: {
+ gfx_read_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
+
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+
+ if (this_args_cbk->op_ret >= 0) {
+ server4_post_readv(rsp_args, &this_args_cbk->stat,
+ this_args_cbk->op_ret);
+
+ if (!state->rsp_iobref) {
+ state->rsp_iobref = this_args_cbk->iobref;
+ state->rsp_count = 0;
}
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ iobref_merge(state->rsp_iobref, this_args_cbk->iobref);
+ memcpy(&state->rsp_vector[state->rsp_count],
+ this_args_cbk->vector,
+ (this_args_cbk->count * sizeof(state->rsp_vector[0])));
+ state->rsp_count += this_args_cbk->count;
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_STATFS:
- {
- gfx_statfs_rsp *rsp_args = NULL;
+ case GF_FOP_STATFS: {
+ gfx_statfs_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_statfs (rsp_args,
- &this_args_cbk->statvfs);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ if (!this_args_cbk->op_ret) {
+ server4_post_statfs(rsp_args, &this_args_cbk->statvfs);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
case GF_FOP_FLUSH:
case GF_FOP_SETXATTR:
@@ -5317,200 +4858,173 @@ server_populate_compound_response_v2 (xlator_t *this, gfx_compound_rsp *rsp,
case GF_FOP_INODELK:
case GF_FOP_FINODELK:
case GF_FOP_ENTRYLK:
- case GF_FOP_FENTRYLK:
- {
- gfx_common_rsp *rsp_args = NULL;
+ case GF_FOP_FENTRYLK: {
+ gfx_common_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
case GF_FOP_FGETXATTR:
case GF_FOP_GETXATTR:
case GF_FOP_XATTROP:
- case GF_FOP_FXATTROP:
- {
- gfx_common_dict_rsp *rsp_args = NULL;
+ case GF_FOP_FXATTROP: {
+ gfx_common_dict_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (-1 != this_args_cbk->op_ret) {
- dict_to_xdr (this_args_cbk->xattr, &rsp_args->dict);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (-1 != this_args_cbk->op_ret) {
+ dict_to_xdr(this_args_cbk->xattr, &rsp_args->dict);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfx_create_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
-
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
-
- if (!this_args_cbk->op_ret) {
- rsp_args->op_ret = server4_post_create (frame,
- rsp_args, state, this,
- this_args_cbk->fd,
- this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- if (rsp_args->op_ret) {
- rsp_args->op_errno = -rsp_args->op_ret;
- rsp_args->op_ret = -1;
- }
+ case GF_FOP_CREATE: {
+ gfx_create_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
+
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+
+ if (!this_args_cbk->op_ret) {
+ rsp_args->op_ret = server4_post_create(
+ frame, rsp_args, state, this, this_args_cbk->fd,
+ this_args_cbk->inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent);
+ if (rsp_args->op_ret) {
+ rsp_args->op_errno = -rsp_args->op_ret;
+ rsp_args->op_ret = -1;
}
- break;
+ }
+ break;
}
- case GF_FOP_LK:
- {
- gfx_lk_rsp *rsp_args = NULL;
+ case GF_FOP_LK: {
+ gfx_lk_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_lk (this, rsp_args, &this_args_cbk->lock);
- }
+ if (!this_args_cbk->op_ret) {
+ server4_post_lk(this, rsp_args, &this_args_cbk->lock);
+ }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfx_common_2iatt_rsp *rsp_args = NULL;
+ case GF_FOP_LOOKUP: {
+ gfx_common_2iatt_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- gfx_stat_from_iattx (&rsp_args->poststat,
- &this_args_cbk->postparent);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ gfx_stat_from_iattx(&rsp_args->poststat,
+ &this_args_cbk->postparent);
- if (!this_args_cbk->op_ret) {
- server4_post_lookup (rsp_args, frame, state,
- this_args_cbk->inode,
- &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server4_post_lookup(rsp_args, frame, state,
+ this_args_cbk->inode, &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_READDIR:
- {
- gfx_readdir_rsp *rsp_args = NULL;
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- if (this_args_cbk->op_ret > 0) {
- ret = server4_post_readdir (rsp_args,
- &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- }
+ if (this_args_cbk->op_ret > 0) {
+ ret = server4_post_readdir(rsp_args, &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
}
- break;
+ }
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfx_rchecksum_rsp *rsp_args = NULL;
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_rchecksum (rsp_args,
- this_args_cbk->weak_checksum,
- this_args_cbk->strong_checksum);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ if (!this_args_cbk->op_ret) {
+ server4_post_rchecksum(rsp_args, this_args_cbk->weak_checksum,
+ this_args_cbk->strong_checksum);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
-
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server4_post_readdirp (rsp_args,
- &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- goto out;
- }
- gf_link_inodes_from_dirent (this, state->fd->inode,
- &this_args_cbk->entries);
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
+
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+
+ if (this_args_cbk->op_ret > 0) {
+ ret = server4_post_readdirp(rsp_args, &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
+ goto out;
}
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ gf_link_inodes_from_dirent(this, state->fd->inode,
+ &this_args_cbk->entries);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_SEEK:
- {
- gfx_seek_rsp *rsp_args = NULL;
+ case GF_FOP_SEEK: {
+ gfx_seek_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfx_lease_rsp *rsp_args = NULL;
+ case GF_FOP_LEASE: {
+ gfx_lease_rsp *rsp_args = NULL;
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
+ rsp_args = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
- dict_to_xdr (this_args_cbk->xdata, &rsp_args->xdata);
+ dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_lease (rsp_args, &this_args_cbk->lease);
- }
+ if (!this_args_cbk->op_ret) {
+ server4_post_lease(rsp_args, &this_args_cbk->lease);
+ }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error
- (this_args_cbk->op_errno);
- break;
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
+ break;
}
default:
- return ENOTSUP;
- }
- op_errno = 0;
+ return ENOTSUP;
+ }
+ op_errno = 0;
out:
- return op_errno;
+ return op_errno;
}
/* This works only when the compound fop acts on one loc/inode/gfid.
* If compound fops on more than one inode is required, multiple
@@ -5519,912 +5033,877 @@ out:
* This can be added for future enhancements.
*/
int
-server_get_compound_resolve_v2 (server_state_t *state, gfx_compound_req *req)
+server_get_compound_resolve_v2(server_state_t *state, gfx_compound_req *req)
{
- int i = 0;
- compound_req_v2 *array = NULL;
+ int i = 0;
+ compound_req_v2 *array = NULL;
- array = &req->compound_req_array.compound_req_array_val[i];
+ array = &req->compound_req_array.compound_req_array_val[i];
- switch (array->fop_enum) {
- case GF_FOP_STAT:
- {
- gfx_stat_req this_req = { {0,} };
+ switch (array->fop_enum) {
+ case GF_FOP_STAT: {
+ gfx_stat_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_stat_req;
+ this_req = array[i].compound_req_v2_u.compound_stat_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfx_readlink_req this_req = { {0,} };
+ case GF_FOP_READLINK: {
+ gfx_readlink_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_readlink_req;
+ this_req = array[i].compound_req_v2_u.compound_readlink_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_MKNOD:
- {
- gfx_mknod_req this_req = { {0,} };
+ case GF_FOP_MKNOD: {
+ gfx_mknod_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_mknod_req;
+ this_req = array[i].compound_req_v2_u.compound_mknod_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfx_mkdir_req this_req = { {0,} };
+ case GF_FOP_MKDIR: {
+ gfx_mkdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_mkdir_req;
+ this_req = array[i].compound_req_v2_u.compound_mkdir_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_UNLINK:
- {
- gfx_unlink_req this_req = { {0,} };
+ case GF_FOP_UNLINK: {
+ gfx_unlink_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_unlink_req;
+ this_req = array[i].compound_req_v2_u.compound_unlink_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfx_rmdir_req this_req = { {0,} };
+ case GF_FOP_RMDIR: {
+ gfx_rmdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_rmdir_req;
+ this_req = array[i].compound_req_v2_u.compound_rmdir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_SYMLINK:
- {
- gfx_symlink_req this_req = { {0,} };
+ case GF_FOP_SYMLINK: {
+ gfx_symlink_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_symlink_req;
+ this_req = array[i].compound_req_v2_u.compound_symlink_req;
- state->resolve.type = RESOLVE_NOT;
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ state->resolve.type = RESOLVE_NOT;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_RENAME:
- {
- gfx_rename_req this_req = { {0,} };
+ case GF_FOP_RENAME: {
+ gfx_rename_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_rename_req;
+ this_req = array[i].compound_req_v2_u.compound_rename_req;
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup
- (this_req.oldbname);
- memcpy (state->resolve.pargfid, this_req.oldgfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(this_req.oldbname);
+ memcpy(state->resolve.pargfid, this_req.oldgfid, 16);
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup
- (this_req.newbname);
- memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
- break;
+ state->resolve2.type = RESOLVE_MAY;
+ state->resolve2.bname = gf_strdup(this_req.newbname);
+ memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
}
- case GF_FOP_LINK:
- {
- gfx_link_req this_req = { {0,} };
+ case GF_FOP_LINK: {
+ gfx_link_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_link_req;
+ this_req = array[i].compound_req_v2_u.compound_link_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, this_req.oldgfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.oldgfid, 16);
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup
- (this_req.newbname);
- memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
- break;
+ state->resolve2.type = RESOLVE_NOT;
+ state->resolve2.bname = gf_strdup(this_req.newbname);
+ memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfx_truncate_req this_req = { {0,} };
+ case GF_FOP_TRUNCATE: {
+ gfx_truncate_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_truncate_req;
+ this_req = array[i].compound_req_v2_u.compound_truncate_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_OPEN:
- {
- gfx_open_req this_req = { {0,} };
+ case GF_FOP_OPEN: {
+ gfx_open_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_open_req;
+ this_req = array[i].compound_req_v2_u.compound_open_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_READ:
- {
- gfx_read_req this_req = { {0,} };
+ case GF_FOP_READ: {
+ gfx_read_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_read_req;
+ this_req = array[i].compound_req_v2_u.compound_read_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfx_write_req this_req = { {0,} };
+ case GF_FOP_WRITE: {
+ gfx_write_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_write_req;
+ this_req = array[i].compound_req_v2_u.compound_write_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_STATFS:
- {
- gfx_statfs_req this_req = { {0,} };
+ case GF_FOP_STATFS: {
+ gfx_statfs_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_statfs_req;
+ this_req = array[i].compound_req_v2_u.compound_statfs_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FLUSH:
- {
- gfx_flush_req this_req = { {0,} };
+ case GF_FOP_FLUSH: {
+ gfx_flush_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_flush_req;
+ this_req = array[i].compound_req_v2_u.compound_flush_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSYNC:
- {
- gfx_fsync_req this_req = { {0,} };
+ case GF_FOP_FSYNC: {
+ gfx_fsync_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fsync_req;
+ this_req = array[i].compound_req_v2_u.compound_fsync_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gfx_setxattr_req this_req = { {0,} };
+ case GF_FOP_SETXATTR: {
+ gfx_setxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_setxattr_req;
+ this_req = array[i].compound_req_v2_u.compound_setxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfx_getxattr_req this_req = { {0,} };
+ case GF_FOP_GETXATTR: {
+ gfx_getxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_getxattr_req;
+ this_req = array[i].compound_req_v2_u.compound_getxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gfx_removexattr_req this_req = { {0,} };
+ case GF_FOP_REMOVEXATTR: {
+ gfx_removexattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_removexattr_req;
+ this_req = array[i].compound_req_v2_u.compound_removexattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfx_opendir_req this_req = { {0,} };
+ case GF_FOP_OPENDIR: {
+ gfx_opendir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_opendir_req;
+ this_req = array[i].compound_req_v2_u.compound_opendir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gfx_fsyncdir_req this_req = { {0,} };
+ case GF_FOP_FSYNCDIR: {
+ gfx_fsyncdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fsyncdir_req;
+ this_req = array[i].compound_req_v2_u.compound_fsyncdir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_ACCESS:
- {
- gfx_access_req this_req = { {0,} };
+ case GF_FOP_ACCESS: {
+ gfx_access_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_access_req;
+ this_req = array[i].compound_req_v2_u.compound_access_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfx_create_req this_req = { {0,} };
+ case GF_FOP_CREATE: {
+ gfx_create_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_create_req;
+ this_req = array[i].compound_req_v2_u.compound_create_req;
- state->flags = gf_flags_to_flags (this_req.flags);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
+ state->flags = gf_flags_to_flags(this_req.flags);
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- break;
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ break;
}
- case GF_FOP_FTRUNCATE:
- {
- gfx_ftruncate_req this_req = { {0,} };
+ case GF_FOP_FTRUNCATE: {
+ gfx_ftruncate_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_ftruncate_req;
+ this_req = array[i].compound_req_v2_u.compound_ftruncate_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfx_fstat_req this_req = { {0,} };
+ case GF_FOP_FSTAT: {
+ gfx_fstat_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fstat_req;
+ this_req = array[i].compound_req_v2_u.compound_fstat_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LK:
- {
- gfx_lk_req this_req = { {0,} };
+ case GF_FOP_LK: {
+ gfx_lk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_lk_req;
+ this_req = array[i].compound_req_v2_u.compound_lk_req;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfx_lookup_req this_req = { {0,} };
+ case GF_FOP_LOOKUP: {
+ gfx_lookup_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_lookup_req;
- state->resolve.type = RESOLVE_DONTCARE;
+ this_req = array[i].compound_req_v2_u.compound_lookup_req;
+ state->resolve.type = RESOLVE_DONTCARE;
- if (this_req.bname && strcmp (this_req.bname, "")) {
- memcpy (state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup
- (this_req.bname);
- } else {
- memcpy (state->resolve.gfid, this_req.gfid, 16);
- }
- break;
+ if (this_req.bname && strcmp(this_req.bname, "")) {
+ memcpy(state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup(this_req.bname);
+ } else {
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ }
+ break;
}
- case GF_FOP_READDIR:
- {
- gfx_readdir_req this_req = { {0,} };
+ case GF_FOP_READDIR: {
+ gfx_readdir_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_readdir_req;
+ this_req = array[i].compound_req_v2_u.compound_readdir_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_INODELK:
- {
- gfx_inodelk_req this_req = { {0,} };
+ case GF_FOP_INODELK: {
+ gfx_inodelk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_inodelk_req;
+ this_req = array[i].compound_req_v2_u.compound_inodelk_req;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gfx_finodelk_req this_req = { {0,} };
-
- this_req = array[i].compound_req_v2_u.compound_finodelk_req;
+ case GF_FOP_FINODELK: {
+ gfx_finodelk_req this_req = {{
+ 0,
+ }};
+
+ this_req = array[i].compound_req_v2_u.compound_finodelk_req;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gfx_entrylk_req this_req = { {0,} };
-
- this_req = array[i].compound_req_v2_u.compound_entrylk_req;
+ case GF_FOP_ENTRYLK: {
+ gfx_entrylk_req this_req = {{
+ 0,
+ }};
+
+ this_req = array[i].compound_req_v2_u.compound_entrylk_req;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gfx_fentrylk_req this_req = { {0,} };
+ case GF_FOP_FENTRYLK: {
+ gfx_fentrylk_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fentrylk_req;
+ this_req = array[i].compound_req_v2_u.compound_fentrylk_req;
- state->resolve.type = RESOLVE_EXACT;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfx_xattrop_req this_req = { {0,} };
+ case GF_FOP_XATTROP: {
+ gfx_xattrop_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_xattrop_req;
+ this_req = array[i].compound_req_v2_u.compound_xattrop_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfx_fxattrop_req this_req = { {0,} };
+ case GF_FOP_FXATTROP: {
+ gfx_fxattrop_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fxattrop_req;
+ this_req = array[i].compound_req_v2_u.compound_fxattrop_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfx_fgetxattr_req this_req = { {0,} };
+ case GF_FOP_FGETXATTR: {
+ gfx_fgetxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fgetxattr_req;
+ this_req = array[i].compound_req_v2_u.compound_fgetxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gfx_fsetxattr_req this_req = { {0,} };
+ case GF_FOP_FSETXATTR: {
+ gfx_fsetxattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fsetxattr_req;
+ this_req = array[i].compound_req_v2_u.compound_fsetxattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfx_rchecksum_req this_req = { {0,},};
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_req this_req = {
+ {
+ 0,
+ },
+ };
- this_req = array[i].compound_req_v2_u.compound_rchecksum_req;
+ this_req = array[i].compound_req_v2_u.compound_rchecksum_req;
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MAY;
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfx_setattr_req this_req = { {0,} };
+ case GF_FOP_SETATTR: {
+ gfx_setattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_setattr_req;
+ this_req = array[i].compound_req_v2_u.compound_setattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfx_fsetattr_req this_req = { {0,} };
+ case GF_FOP_FSETATTR: {
+ gfx_fsetattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fsetattr_req;
+ this_req = array[i].compound_req_v2_u.compound_fsetattr_req;
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_req this_req = { {0,} };
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_readdirp_req;
+ this_req = array[i].compound_req_v2_u.compound_readdirp_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FREMOVEXATTR:
- {
- gfx_fremovexattr_req this_req = { {0,} };
+ case GF_FOP_FREMOVEXATTR: {
+ gfx_fremovexattr_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fremovexattr_req;
+ this_req = array[i].compound_req_v2_u.compound_fremovexattr_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_FALLOCATE:
- {
- gfx_fallocate_req this_req = { {0,} };
+ case GF_FOP_FALLOCATE: {
+ gfx_fallocate_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_fallocate_req;
+ this_req = array[i].compound_req_v2_u.compound_fallocate_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_DISCARD:
- {
- gfx_discard_req this_req = { {0,} };
+ case GF_FOP_DISCARD: {
+ gfx_discard_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_discard_req;
+ this_req = array[i].compound_req_v2_u.compound_discard_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_ZEROFILL:
- {
- gfx_zerofill_req this_req = { {0,} };
+ case GF_FOP_ZEROFILL: {
+ gfx_zerofill_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_zerofill_req;
+ this_req = array[i].compound_req_v2_u.compound_zerofill_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_SEEK:
- {
- gfx_seek_req this_req = { {0,} };
+ case GF_FOP_SEEK: {
+ gfx_seek_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_seek_req;
+ this_req = array[i].compound_req_v2_u.compound_seek_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid,
- this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
}
- case GF_FOP_LEASE:
- {
- gfx_lease_req this_req = { {0,} };
+ case GF_FOP_LEASE: {
+ gfx_lease_req this_req = {{
+ 0,
+ }};
- this_req = array[i].compound_req_v2_u.compound_lease_req;
+ this_req = array[i].compound_req_v2_u.compound_lease_req;
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, this_req.gfid, 16);
- break;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, this_req.gfid, 16);
+ break;
}
default:
- return ENOTSUP;
- }
- return 0;
+ return ENOTSUP;
+ }
+ return 0;
}
void
-server_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, compound_args_cbk_t *args)
+server_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, compound_args_cbk_t *args)
{
- int i, len = 0;
- compound_rsp_v2 *this_rsp = NULL;
-
- if (!rsp->compound_rsp_array.compound_rsp_array_val)
- return;
-
- len = rsp->compound_rsp_array.compound_rsp_array_len;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (args->enum_list[i]) {
- case GF_FOP_STAT:
- SERVER4_FOP_RSP_CLEANUP (rsp, stat, i, common_iatt);
- break;
- case GF_FOP_MKNOD:
- SERVER4_FOP_RSP_CLEANUP (rsp, mknod, i, common_3iatt);
- break;
- case GF_FOP_MKDIR:
- SERVER4_FOP_RSP_CLEANUP (rsp, mkdir, i, common_3iatt);
- break;
- case GF_FOP_UNLINK:
- SERVER4_FOP_RSP_CLEANUP (rsp, unlink, i, common_2iatt);
- break;
- case GF_FOP_RMDIR:
- SERVER4_FOP_RSP_CLEANUP (rsp, rmdir, i, common_2iatt);
- break;
- case GF_FOP_SYMLINK:
- SERVER4_FOP_RSP_CLEANUP (rsp, symlink, i, common_3iatt);
- break;
- case GF_FOP_RENAME:
- SERVER4_FOP_RSP_CLEANUP (rsp, rename, i, rename);
- break;
- case GF_FOP_LINK:
- SERVER4_FOP_RSP_CLEANUP (rsp, link, i, common_3iatt);
- break;
- case GF_FOP_TRUNCATE:
- SERVER4_FOP_RSP_CLEANUP (rsp, truncate, i, common_2iatt);
- break;
- case GF_FOP_OPEN:
- SERVER4_FOP_RSP_CLEANUP (rsp, open, i, open);
- break;
- case GF_FOP_READ:
- SERVER4_FOP_RSP_CLEANUP (rsp, read, i, read);
- break;
- case GF_FOP_WRITE:
- SERVER4_FOP_RSP_CLEANUP (rsp, write, i, common_2iatt);
- break;
- case GF_FOP_STATFS:
- SERVER4_FOP_RSP_CLEANUP (rsp, statfs, i, statfs);
- break;
- case GF_FOP_FSYNC:
- SERVER4_FOP_RSP_CLEANUP (rsp, fsync, i, common_2iatt);
- break;
- case GF_FOP_OPENDIR:
- SERVER4_FOP_RSP_CLEANUP (rsp, opendir, i, open);
- break;
- case GF_FOP_CREATE:
- SERVER4_FOP_RSP_CLEANUP (rsp, create, i, create);
- break;
- case GF_FOP_FTRUNCATE:
- SERVER4_FOP_RSP_CLEANUP (rsp, ftruncate, i, common_2iatt);
- break;
- case GF_FOP_FSTAT:
- SERVER4_FOP_RSP_CLEANUP (rsp, fstat, i, common_iatt);
- break;
- case GF_FOP_LK:
- SERVER4_FOP_RSP_CLEANUP (rsp, lk, i, lk);
- break;
- case GF_FOP_LOOKUP:
- SERVER4_FOP_RSP_CLEANUP (rsp, lookup, i, common_2iatt);
- break;
- case GF_FOP_SETATTR:
- SERVER4_FOP_RSP_CLEANUP (rsp, setattr, i, common_2iatt);
- break;
- case GF_FOP_FSETATTR:
- SERVER4_FOP_RSP_CLEANUP (rsp, fsetattr, i, common_2iatt);
- break;
- case GF_FOP_FALLOCATE:
- SERVER4_FOP_RSP_CLEANUP (rsp, fallocate, i, common_2iatt);
- break;
- case GF_FOP_DISCARD:
- SERVER4_FOP_RSP_CLEANUP (rsp, discard, i, common_2iatt);
- break;
- case GF_FOP_ZEROFILL:
- SERVER4_FOP_RSP_CLEANUP (rsp, zerofill, i, common_2iatt);
- break;
- case GF_FOP_SEEK:
- SERVER4_FOP_RSP_CLEANUP (rsp, seek, i, seek);
- break;
- case GF_FOP_LEASE:
- SERVER4_FOP_RSP_CLEANUP (rsp, lease, i, lease);
- break;
- case GF_FOP_READLINK:
- SERVER4_FOP_RSP_CLEANUP (rsp, readlink, i, readlink);
- break;
- case GF_FOP_RCHECKSUM:
- SERVER4_FOP_RSP_CLEANUP (rsp, rchecksum, i, rchecksum);
- break;
- /* fops that use gfx_common_rsp */
- case GF_FOP_IPC:
- SERVER4_COMMON_RSP_CLEANUP (rsp, ipc, i);
- break;
- case GF_FOP_FLUSH:
- SERVER4_COMMON_RSP_CLEANUP (rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- SERVER4_COMMON_RSP_CLEANUP (rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- SERVER4_COMMON_RSP_CLEANUP (rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- SERVER4_COMMON_RSP_CLEANUP (rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- SERVER4_COMMON_RSP_CLEANUP (rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER4_COMMON_RSP_CLEANUP (rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- SERVER4_COMMON_RSP_CLEANUP (rsp, access, i);
- break;
- case GF_FOP_INODELK:
- SERVER4_COMMON_RSP_CLEANUP (rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- SERVER4_COMMON_RSP_CLEANUP (rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- SERVER4_COMMON_RSP_CLEANUP (rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- SERVER4_COMMON_RSP_CLEANUP (rsp, fentrylk, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_XATTROP:
- {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- xattrop);
- SERVER4_FOP_RSP_CLEANUP (rsp, xattrop, i, common_dict);
- GF_FREE (tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- fxattrop);
- SERVER4_FOP_RSP_CLEANUP (rsp, fxattrop, i, common_dict);
- GF_FREE (tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_READDIR:
- {
- gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdir);
- SERVER4_FOP_RSP_CLEANUP (rsp, readdir, i, readdir);
- readdir_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdirp);
- SERVER4_FOP_RSP_CLEANUP (rsp, readdirp, i, readdirp);
- readdirp_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- getxattr);
- SERVER4_FOP_RSP_CLEANUP (rsp, getxattr, i, common_dict);
- GF_FREE (tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- fgetxattr);
- SERVER4_FOP_RSP_CLEANUP (rsp, fgetxattr, i, common_dict);
- GF_FREE (tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- default:
- break;
- }
- }
- GF_FREE (rsp->compound_rsp_array.compound_rsp_array_val);
+ int i, len = 0;
+ compound_rsp_v2 *this_rsp = NULL;
+
+ if (!rsp->compound_rsp_array.compound_rsp_array_val)
return;
+
+ len = rsp->compound_rsp_array.compound_rsp_array_len;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (args->enum_list[i]) {
+ case GF_FOP_STAT:
+ SERVER4_FOP_RSP_CLEANUP(rsp, stat, i, common_iatt);
+ break;
+ case GF_FOP_MKNOD:
+ SERVER4_FOP_RSP_CLEANUP(rsp, mknod, i, common_3iatt);
+ break;
+ case GF_FOP_MKDIR:
+ SERVER4_FOP_RSP_CLEANUP(rsp, mkdir, i, common_3iatt);
+ break;
+ case GF_FOP_UNLINK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, unlink, i, common_2iatt);
+ break;
+ case GF_FOP_RMDIR:
+ SERVER4_FOP_RSP_CLEANUP(rsp, rmdir, i, common_2iatt);
+ break;
+ case GF_FOP_SYMLINK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, symlink, i, common_3iatt);
+ break;
+ case GF_FOP_RENAME:
+ SERVER4_FOP_RSP_CLEANUP(rsp, rename, i, rename);
+ break;
+ case GF_FOP_LINK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, link, i, common_3iatt);
+ break;
+ case GF_FOP_TRUNCATE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, truncate, i, common_2iatt);
+ break;
+ case GF_FOP_OPEN:
+ SERVER4_FOP_RSP_CLEANUP(rsp, open, i, open);
+ break;
+ case GF_FOP_READ:
+ SERVER4_FOP_RSP_CLEANUP(rsp, read, i, read);
+ break;
+ case GF_FOP_WRITE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, write, i, common_2iatt);
+ break;
+ case GF_FOP_STATFS:
+ SERVER4_FOP_RSP_CLEANUP(rsp, statfs, i, statfs);
+ break;
+ case GF_FOP_FSYNC:
+ SERVER4_FOP_RSP_CLEANUP(rsp, fsync, i, common_2iatt);
+ break;
+ case GF_FOP_OPENDIR:
+ SERVER4_FOP_RSP_CLEANUP(rsp, opendir, i, open);
+ break;
+ case GF_FOP_CREATE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, create, i, create);
+ break;
+ case GF_FOP_FTRUNCATE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, ftruncate, i, common_2iatt);
+ break;
+ case GF_FOP_FSTAT:
+ SERVER4_FOP_RSP_CLEANUP(rsp, fstat, i, common_iatt);
+ break;
+ case GF_FOP_LK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, lk, i, lk);
+ break;
+ case GF_FOP_LOOKUP:
+ SERVER4_FOP_RSP_CLEANUP(rsp, lookup, i, common_2iatt);
+ break;
+ case GF_FOP_SETATTR:
+ SERVER4_FOP_RSP_CLEANUP(rsp, setattr, i, common_2iatt);
+ break;
+ case GF_FOP_FSETATTR:
+ SERVER4_FOP_RSP_CLEANUP(rsp, fsetattr, i, common_2iatt);
+ break;
+ case GF_FOP_FALLOCATE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, fallocate, i, common_2iatt);
+ break;
+ case GF_FOP_DISCARD:
+ SERVER4_FOP_RSP_CLEANUP(rsp, discard, i, common_2iatt);
+ break;
+ case GF_FOP_ZEROFILL:
+ SERVER4_FOP_RSP_CLEANUP(rsp, zerofill, i, common_2iatt);
+ break;
+ case GF_FOP_SEEK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, seek, i, seek);
+ break;
+ case GF_FOP_LEASE:
+ SERVER4_FOP_RSP_CLEANUP(rsp, lease, i, lease);
+ break;
+ case GF_FOP_READLINK:
+ SERVER4_FOP_RSP_CLEANUP(rsp, readlink, i, readlink);
+ break;
+ case GF_FOP_RCHECKSUM:
+ SERVER4_FOP_RSP_CLEANUP(rsp, rchecksum, i, rchecksum);
+ break;
+ /* fops that use gfx_common_rsp */
+ case GF_FOP_IPC:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, ipc, i);
+ break;
+ case GF_FOP_FLUSH:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, flush, i);
+ break;
+ case GF_FOP_SETXATTR:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, setxattr, i);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, removexattr, i);
+ break;
+ case GF_FOP_FSETXATTR:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
+ break;
+ case GF_FOP_FSYNCDIR:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
+ break;
+ case GF_FOP_ACCESS:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, access, i);
+ break;
+ case GF_FOP_INODELK:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, inodelk, i);
+ break;
+ case GF_FOP_FINODELK:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, finodelk, i);
+ break;
+ case GF_FOP_ENTRYLK:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, entrylk, i);
+ break;
+ case GF_FOP_FENTRYLK:
+ SERVER4_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
+ break;
+ /* fops that need extra cleanup */
+ case GF_FOP_XATTROP: {
+ gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
+ xattrop);
+ SERVER4_FOP_RSP_CLEANUP(rsp, xattrop, i, common_dict);
+ GF_FREE(tmp_rsp->dict.pairs.pairs_val);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
+ fxattrop);
+ SERVER4_FOP_RSP_CLEANUP(rsp, fxattrop, i, common_dict);
+ GF_FREE(tmp_rsp->dict.pairs.pairs_val);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdir);
+ SERVER4_FOP_RSP_CLEANUP(rsp, readdir, i, readdir);
+ readdir_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdirp);
+ SERVER4_FOP_RSP_CLEANUP(rsp, readdirp, i, readdirp);
+ readdirp_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
+ getxattr);
+ SERVER4_FOP_RSP_CLEANUP(rsp, getxattr, i, common_dict);
+ GF_FREE(tmp_rsp->dict.pairs.pairs_val);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
+ fgetxattr);
+ SERVER4_FOP_RSP_CLEANUP(rsp, fgetxattr, i, common_dict);
+ GF_FREE(tmp_rsp->dict.pairs.pairs_val);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ GF_FREE(rsp->compound_rsp_array.compound_rsp_array_val);
+ return;
}
void
-server_compound_req_cleanup_v2 (gfx_compound_req *req, int len)
+server_compound_req_cleanup_v2(gfx_compound_req *req, int len)
{
- int i = 0;
- compound_req_v2 *curr_req = NULL;
+ int i = 0;
+ compound_req_v2 *curr_req = NULL;
+ if (!req->compound_req_array.compound_req_array_val)
+ return;
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < len; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
+ for (i = 0; i < len; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
- switch (curr_req->fop_enum) {
- case GF_FOP_MKDIR:
- {
- gfx_mkdir_req *args = &CPD4_REQ_FIELD (curr_req, mkdir);
+ switch (curr_req->fop_enum) {
+ case GF_FOP_MKDIR: {
+ gfx_mkdir_req *args = &CPD4_REQ_FIELD(curr_req, mkdir);
- free (args->bname);
- break;
- }
- case GF_FOP_UNLINK:
- {
- gfx_unlink_req *args = &CPD4_REQ_FIELD (curr_req,
- unlink);
- free (args->bname);
- break;
- }
- case GF_FOP_RMDIR:
- {
- gfx_rmdir_req *args = &CPD4_REQ_FIELD (curr_req,
- rmdir);
- free (args->bname);
- break;
- }
- case GF_FOP_SYMLINK:
- {
- gfx_symlink_req *args = &CPD4_REQ_FIELD (curr_req,
- symlink);
- free (args->bname);
- free (args->linkname);
- break;
- }
- case GF_FOP_RENAME:
- {
- gfx_rename_req *args = &CPD4_REQ_FIELD (curr_req,
- rename);
- free (args->oldbname);
- free (args->newbname);
- break;
- }
- case GF_FOP_LINK:
- {
- gfx_link_req *args = &CPD4_REQ_FIELD (curr_req,
- link);
- free (args->newbname);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- gfx_getxattr_req *args = &CPD4_REQ_FIELD (curr_req,
- getxattr);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_UNLINK: {
+ gfx_unlink_req *args = &CPD4_REQ_FIELD(curr_req, unlink);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_RMDIR: {
+ gfx_rmdir_req *args = &CPD4_REQ_FIELD(curr_req, rmdir);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_SYMLINK: {
+ gfx_symlink_req *args = &CPD4_REQ_FIELD(curr_req, symlink);
+ free(args->bname);
+ free(args->linkname);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfx_rename_req *args = &CPD4_REQ_FIELD(curr_req, rename);
+ free(args->oldbname);
+ free(args->newbname);
+ break;
+ }
+ case GF_FOP_LINK: {
+ gfx_link_req *args = &CPD4_REQ_FIELD(curr_req, link);
+ free(args->newbname);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfx_getxattr_req *args = &CPD4_REQ_FIELD(curr_req, getxattr);
- free (args->name);
- break;
- }
- case GF_FOP_REMOVEXATTR:
- {
- gfx_removexattr_req *args = &CPD4_REQ_FIELD (curr_req,
- removexattr);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR: {
+ gfx_removexattr_req *args = &CPD4_REQ_FIELD(curr_req,
+ removexattr);
- free (args->name);
- break;
- }
- case GF_FOP_CREATE:
- {
- gfx_create_req *args = &CPD4_REQ_FIELD (curr_req,
- create);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_CREATE: {
+ gfx_create_req *args = &CPD4_REQ_FIELD(curr_req, create);
- free (args->bname);
- break;
- }
- case GF_FOP_LK:
- {
- gfx_lk_req *args = &CPD4_REQ_FIELD (curr_req, lk);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfx_lookup_req *args = &CPD4_REQ_FIELD (curr_req,
- lookup);
- free (args->bname);
- break;
- }
- case GF_FOP_INODELK:
- {
- gfx_inodelk_req *args = &CPD4_REQ_FIELD (curr_req,
- inodelk);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_LK: {
+ gfx_lk_req *args = &CPD4_REQ_FIELD(curr_req, lk);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_LOOKUP: {
+ gfx_lookup_req *args = &CPD4_REQ_FIELD(curr_req, lookup);
+ free(args->bname);
+ break;
+ }
+ case GF_FOP_INODELK: {
+ gfx_inodelk_req *args = &CPD4_REQ_FIELD(curr_req, inodelk);
- free (args->volume);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_FINODELK:
- {
- gfx_finodelk_req *args = &CPD4_REQ_FIELD (curr_req,
- finodelk);
+ free(args->volume);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_FINODELK: {
+ gfx_finodelk_req *args = &CPD4_REQ_FIELD(curr_req, finodelk);
- free (args->volume);
- free (args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_ENTRYLK:
- {
- gfx_entrylk_req *args = &CPD4_REQ_FIELD (curr_req,
- entrylk);
+ free(args->volume);
+ free(args->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_ENTRYLK: {
+ gfx_entrylk_req *args = &CPD4_REQ_FIELD(curr_req, entrylk);
- free (args->volume);
- free (args->name);
- break;
- }
- case GF_FOP_FENTRYLK:
- {
- gfx_fentrylk_req *args = &CPD4_REQ_FIELD (curr_req,
- fentrylk);
+ free(args->volume);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FENTRYLK: {
+ gfx_fentrylk_req *args = &CPD4_REQ_FIELD(curr_req, fentrylk);
- free (args->volume);
- free (args->name);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- gfx_fgetxattr_req *args = &CPD4_REQ_FIELD (curr_req,
- fgetxattr);
+ free(args->volume);
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ gfx_fgetxattr_req *args = &CPD4_REQ_FIELD(curr_req, fgetxattr);
- free (args->name);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gfx_fremovexattr_req *args = &CPD4_REQ_FIELD(curr_req,
- fremovexattr);
- free (args->name);
- break;
- }
- default:
- break;
- }
+ free(args->name);
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR: {
+ gfx_fremovexattr_req *args = &CPD4_REQ_FIELD(curr_req,
+ fremovexattr);
+ free(args->name);
+ break;
+ }
+ default:
+ break;
}
+ }
- return;
+ return;
}
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index b3eda0e4c9e..ba4d2f16a93 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -12,271 +12,257 @@
#include "server-helpers.h"
#include "server-messages.h"
-
int
-server_resolve_all (call_frame_t *frame);
+server_resolve_all(call_frame_t *frame);
int
-resolve_entry_simple (call_frame_t *frame);
+resolve_entry_simple(call_frame_t *frame);
int
-resolve_inode_simple (call_frame_t *frame);
+resolve_inode_simple(call_frame_t *frame);
int
-resolve_continue (call_frame_t *frame);
+resolve_continue(call_frame_t *frame);
int
-resolve_anonfd_simple (call_frame_t *frame);
+resolve_anonfd_simple(call_frame_t *frame);
int
-resolve_loc_touchup (call_frame_t *frame)
+resolve_loc_touchup(call_frame_t *frame)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
- loc_t *loc = NULL;
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
+ loc_t *loc = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- resolve = state->resolve_now;
- loc = state->loc_now;
+ resolve = state->resolve_now;
+ loc = state->loc_now;
- loc_touchup (loc, resolve->bname);
- return 0;
+ loc_touchup(loc, resolve->bname);
+ return 0;
}
-
int
-resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, inode_t *inode,
- struct iatt *buf, dict_t *xdata,
- struct iatt *postparent)
+resolve_gfid_entry_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, inode_t *inode,
+ struct iatt *buf, dict_t *xdata, struct iatt *postparent)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
- inode_t *link_inode = NULL;
- loc_t *resolve_loc = NULL;
-
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
- resolve_loc = &resolve->resolve_loc;
-
- if (op_ret == -1) {
- if (op_errno == ENOENT) {
- gf_msg_debug (this->name, 0,
- "%s/%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->pargfid),
- resolve_loc->name, strerror (op_errno));
- if (resolve->type == RESOLVE_NOT) {
- do {
- inode = inode_grep (state->itable,
- resolve_loc->parent,
- resolve->bname);
-
- if (inode) {
- gf_msg_debug (this->name, 0, "%s/%s: "
- "removing stale dentry",
- uuid_utoa (resolve_loc->pargfid),
- resolve->bname);
- inode_unlink (inode,
- resolve_loc->parent,
- resolve->bname);
- }
- } while (inode);
- }
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PS_MSG_GFID_RESOLVE_FAILED, "%s/%s: failed to "
- "resolve (%s)",
- uuid_utoa (resolve_loc->pargfid),
- resolve_loc->name, strerror (op_errno));
- }
- goto out;
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
+ inode_t *link_inode = NULL;
+ loc_t *resolve_loc = NULL;
+
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
+ resolve_loc = &resolve->resolve_loc;
+
+ if (op_ret == -1) {
+ if (op_errno == ENOENT) {
+ gf_msg_debug(this->name, 0, "%s/%s: failed to resolve (%s)",
+ uuid_utoa(resolve_loc->pargfid), resolve_loc->name,
+ strerror(op_errno));
+ if (resolve->type == RESOLVE_NOT) {
+ do {
+ inode = inode_grep(state->itable, resolve_loc->parent,
+ resolve->bname);
+
+ if (inode) {
+ gf_msg_debug(this->name, 0,
+ "%s/%s: "
+ "removing stale dentry",
+ uuid_utoa(resolve_loc->pargfid),
+ resolve->bname);
+ inode_unlink(inode, resolve_loc->parent,
+ resolve->bname);
+ }
+ } while (inode);
+ }
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED,
+ "%s/%s: failed to "
+ "resolve (%s)",
+ uuid_utoa(resolve_loc->pargfid), resolve_loc->name,
+ strerror(op_errno));
}
+ goto out;
+ }
- link_inode = inode_link (inode, resolve_loc->parent,
- resolve_loc->name, buf);
+ link_inode = inode_link(inode, resolve_loc->parent, resolve_loc->name, buf);
- if (!link_inode)
- goto out;
+ if (!link_inode)
+ goto out;
- inode_lookup (link_inode);
+ inode_lookup(link_inode);
- inode_unref (link_inode);
+ inode_unref(link_inode);
out:
- loc_wipe (resolve_loc);
+ loc_wipe(resolve_loc);
- resolve_continue (frame);
- return 0;
+ resolve_continue(frame);
+ return 0;
}
-
int
-resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, inode_t *inode, struct iatt *buf,
- dict_t *xdata, struct iatt *postparent)
+resolve_gfid_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
+ int op_errno, inode_t *inode, struct iatt *buf, dict_t *xdata,
+ struct iatt *postparent)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
- inode_t *link_inode = NULL;
- loc_t *resolve_loc = NULL;
- dict_t *dict = NULL;
-
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
- resolve_loc = &resolve->resolve_loc;
-
- if (op_ret == -1) {
- if (op_errno == ENOENT) {
- gf_msg_debug (this->name, GF_LOG_DEBUG,
- "%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->gfid),
- strerror (op_errno));
- } else {
- gf_msg (this->name, GF_LOG_WARNING, op_errno,
- PS_MSG_GFID_RESOLVE_FAILED,
- "%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->gfid),
- strerror (op_errno));
- }
- loc_wipe (&resolve->resolve_loc);
- goto out;
- }
-
- link_inode = inode_link (inode, NULL, NULL, buf);
-
- if (!link_inode) {
- loc_wipe (resolve_loc);
- goto out;
- }
-
- inode_lookup (link_inode);
-
- /* wipe the loc only after the inode has been linked to the inode
- table. Otherwise before inode gets linked to the inode table,
- inode would have been unrefed (this might have been destroyed
- if refcount becomes 0, and put back to mempool). So once the
- inode gets destroyed, inode_link is a redundant operation. But
- without knowing that the destroyed inode's pointer is saved in
- the resolved_loc as parent (while constructing loc for resolving
- the entry) and the inode_new call for resolving the entry will
- return the same pointer to the inode as the parent (because in
- reality the inode is a free inode present in cold list of the
- inode mem-pool).
- */
- loc_wipe (resolve_loc);
-
- if (gf_uuid_is_null (resolve->pargfid)) {
- inode_unref (link_inode);
- goto out;
- }
-
- resolve_loc->parent = link_inode;
- gf_uuid_copy (resolve_loc->pargfid, resolve_loc->parent->gfid);
-
- resolve_loc->name = resolve->bname;
-
- resolve_loc->inode = server_inode_new (state->itable,
- resolve_loc->gfid);
-
- inode_path (resolve_loc->parent, resolve_loc->name,
- (char **) &resolve_loc->path);
-
- if (state->xdata) {
- dict = dict_copy_with_ref (state->xdata, NULL);
- if (!dict)
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
- "BUG: dict allocation failed (pargfid: %s, name: %s), "
- "still continuing", uuid_utoa (resolve_loc->gfid),
- resolve_loc->name);
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
+ inode_t *link_inode = NULL;
+ loc_t *resolve_loc = NULL;
+ dict_t *dict = NULL;
+
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
+ resolve_loc = &resolve->resolve_loc;
+
+ if (op_ret == -1) {
+ if (op_errno == ENOENT) {
+ gf_msg_debug(this->name, GF_LOG_DEBUG, "%s: failed to resolve (%s)",
+ uuid_utoa(resolve_loc->gfid), strerror(op_errno));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED, "%s: failed to resolve (%s)",
+ uuid_utoa(resolve_loc->gfid), strerror(op_errno));
}
-
- STACK_WIND (frame, resolve_gfid_entry_cbk,
- frame->root->client->bound_xl,
- frame->root->client->bound_xl->fops->lookup,
- &resolve->resolve_loc, dict);
- if (dict)
- dict_unref (dict);
- return 0;
+ loc_wipe(&resolve->resolve_loc);
+ goto out;
+ }
+
+ link_inode = inode_link(inode, NULL, NULL, buf);
+
+ if (!link_inode) {
+ loc_wipe(resolve_loc);
+ goto out;
+ }
+
+ inode_lookup(link_inode);
+
+ /* wipe the loc only after the inode has been linked to the inode
+ table. Otherwise before inode gets linked to the inode table,
+ inode would have been unrefed (this might have been destroyed
+ if refcount becomes 0, and put back to mempool). So once the
+ inode gets destroyed, inode_link is a redundant operation. But
+ without knowing that the destroyed inode's pointer is saved in
+ the resolved_loc as parent (while constructing loc for resolving
+ the entry) and the inode_new call for resolving the entry will
+ return the same pointer to the inode as the parent (because in
+ reality the inode is a free inode present in cold list of the
+ inode mem-pool).
+ */
+ loc_wipe(resolve_loc);
+
+ if (gf_uuid_is_null(resolve->pargfid)) {
+ inode_unref(link_inode);
+ goto out;
+ }
+
+ resolve_loc->parent = link_inode;
+ gf_uuid_copy(resolve_loc->pargfid, resolve_loc->parent->gfid);
+
+ resolve_loc->name = resolve->bname;
+
+ resolve_loc->inode = server_inode_new(state->itable, resolve_loc->gfid);
+
+ inode_path(resolve_loc->parent, resolve_loc->name,
+ (char **)&resolve_loc->path);
+
+ if (state->xdata) {
+ dict = dict_copy_with_ref(state->xdata, NULL);
+ if (!dict)
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "BUG: dict allocation failed (pargfid: %s, name: %s), "
+ "still continuing",
+ uuid_utoa(resolve_loc->gfid), resolve_loc->name);
+ }
+
+ STACK_WIND(frame, resolve_gfid_entry_cbk, frame->root->client->bound_xl,
+ frame->root->client->bound_xl->fops->lookup,
+ &resolve->resolve_loc, dict);
+ if (dict)
+ dict_unref(dict);
+ return 0;
out:
- resolve_continue (frame);
- return 0;
+ resolve_continue(frame);
+ return 0;
}
-
int
-resolve_gfid (call_frame_t *frame)
+resolve_gfid(call_frame_t *frame)
{
- server_state_t *state = NULL;
- xlator_t *this = NULL;
- server_resolve_t *resolve = NULL;
- loc_t *resolve_loc = NULL;
- dict_t *xdata = NULL;
-
- state = CALL_STATE (frame);
- this = frame->this;
- resolve = state->resolve_now;
- resolve_loc = &resolve->resolve_loc;
-
- if (!gf_uuid_is_null (resolve->pargfid))
- gf_uuid_copy (resolve_loc->gfid, resolve->pargfid);
- else if (!gf_uuid_is_null (resolve->gfid))
- gf_uuid_copy (resolve_loc->gfid, resolve->gfid);
-
- resolve_loc->inode = server_inode_new (state->itable,
- resolve_loc->gfid);
- (void) loc_path (resolve_loc, NULL);
-
- if (state->xdata) {
- xdata = dict_copy_with_ref (state->xdata, NULL);
- if (!xdata)
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
- "BUG: dict allocation failed (gfid: %s), "
- "still continuing",
- uuid_utoa (resolve_loc->gfid));
- }
-
- STACK_WIND (frame, resolve_gfid_cbk,
- frame->root->client->bound_xl,
- frame->root->client->bound_xl->fops->lookup,
- &resolve->resolve_loc, xdata);
-
- if (xdata)
- dict_unref (xdata);
-
- return 0;
+ server_state_t *state = NULL;
+ xlator_t *this = NULL;
+ server_resolve_t *resolve = NULL;
+ loc_t *resolve_loc = NULL;
+ dict_t *xdata = NULL;
+
+ state = CALL_STATE(frame);
+ this = frame->this;
+ resolve = state->resolve_now;
+ resolve_loc = &resolve->resolve_loc;
+
+ if (!gf_uuid_is_null(resolve->pargfid))
+ gf_uuid_copy(resolve_loc->gfid, resolve->pargfid);
+ else if (!gf_uuid_is_null(resolve->gfid))
+ gf_uuid_copy(resolve_loc->gfid, resolve->gfid);
+
+ resolve_loc->inode = server_inode_new(state->itable, resolve_loc->gfid);
+ (void)loc_path(resolve_loc, NULL);
+
+ if (state->xdata) {
+ xdata = dict_copy_with_ref(state->xdata, NULL);
+ if (!xdata)
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "BUG: dict allocation failed (gfid: %s), "
+ "still continuing",
+ uuid_utoa(resolve_loc->gfid));
+ }
+
+ STACK_WIND(frame, resolve_gfid_cbk, frame->root->client->bound_xl,
+ frame->root->client->bound_xl->fops->lookup,
+ &resolve->resolve_loc, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
}
int
-resolve_continue (call_frame_t *frame)
+resolve_continue(call_frame_t *frame)
{
- server_state_t *state = NULL;
- xlator_t *this = NULL;
- server_resolve_t *resolve = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
- this = frame->this;
- resolve = state->resolve_now;
-
- resolve->op_ret = 0;
- resolve->op_errno = 0;
-
- if (resolve->fd_no != -1) {
- ret = resolve_anonfd_simple (frame);
- goto out;
- } else if (!gf_uuid_is_null (resolve->pargfid))
- ret = resolve_entry_simple (frame);
- else if (!gf_uuid_is_null (resolve->gfid))
- ret = resolve_inode_simple (frame);
- if (ret)
- gf_msg_debug (this->name, 0, "return value of resolve_*_"
- "simple %d", ret);
-
- resolve_loc_touchup (frame);
+ server_state_t *state = NULL;
+ xlator_t *this = NULL;
+ server_resolve_t *resolve = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+ this = frame->this;
+ resolve = state->resolve_now;
+
+ resolve->op_ret = 0;
+ resolve->op_errno = 0;
+
+ if (resolve->fd_no != -1) {
+ ret = resolve_anonfd_simple(frame);
+ goto out;
+ } else if (!gf_uuid_is_null(resolve->pargfid))
+ ret = resolve_entry_simple(frame);
+ else if (!gf_uuid_is_null(resolve->gfid))
+ ret = resolve_inode_simple(frame);
+ if (ret)
+ gf_msg_debug(this->name, 0,
+ "return value of resolve_*_"
+ "simple %d",
+ ret);
+
+ resolve_loc_touchup(frame);
out:
- server_resolve_all (frame);
+ server_resolve_all(frame);
- return 0;
+ return 0;
}
-
/*
Check if the requirements are fulfilled by entries in the inode cache itself
Return value:
@@ -285,392 +271,375 @@ out:
*/
int
-resolve_entry_simple (call_frame_t *frame)
+resolve_entry_simple(call_frame_t *frame)
{
- server_state_t *state = NULL;
- xlator_t *this = NULL;
- server_resolve_t *resolve = NULL;
- inode_t *parent = NULL;
- inode_t *inode = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
- this = frame->this;
- resolve = state->resolve_now;
-
- parent = inode_find (state->itable, resolve->pargfid);
- if (!parent) {
- /* simple resolution is indecisive. need to perform
- deep resolution */
- resolve->op_ret = -1;
- resolve->op_errno = ESTALE;
+ server_state_t *state = NULL;
+ xlator_t *this = NULL;
+ server_resolve_t *resolve = NULL;
+ inode_t *parent = NULL;
+ inode_t *inode = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+ this = frame->this;
+ resolve = state->resolve_now;
+
+ parent = inode_find(state->itable, resolve->pargfid);
+ if (!parent) {
+ /* simple resolution is indecisive. need to perform
+ deep resolution */
+ resolve->op_ret = -1;
+ resolve->op_errno = ESTALE;
+ ret = 1;
+ goto out;
+ }
+
+ /* expected @parent was found from the inode cache */
+ gf_uuid_copy(state->loc_now->pargfid, resolve->pargfid);
+ state->loc_now->parent = inode_ref(parent);
+
+ if (strstr(resolve->bname, "../")) {
+ /* Resolving outside the parent's tree is not allowed */
+ gf_msg(this->name, GF_LOG_ERROR, EPERM, PS_MSG_GFID_RESOLVE_FAILED,
+ "%s: path sent by client not allowed", resolve->bname);
+ resolve->op_ret = -1;
+ resolve->op_errno = EPERM;
+ ret = 1;
+ goto out;
+ }
+ state->loc_now->name = resolve->bname;
+
+ inode = inode_grep(state->itable, parent, resolve->bname);
+ if (!inode) {
+ switch (resolve->type) {
+ case RESOLVE_DONTCARE:
+ case RESOLVE_NOT:
+ ret = 0;
+ break;
+ case RESOLVE_MAY:
ret = 1;
- goto out;
- }
-
- /* expected @parent was found from the inode cache */
- gf_uuid_copy (state->loc_now->pargfid, resolve->pargfid);
- state->loc_now->parent = inode_ref (parent);
-
- if (strstr (resolve->bname, "../")) {
- /* Resolving outside the parent's tree is not allowed */
- gf_msg (this->name, GF_LOG_ERROR, EPERM,
- PS_MSG_GFID_RESOLVE_FAILED,
- "%s: path sent by client not allowed",
- resolve->bname);
- resolve->op_ret = -1;
- resolve->op_errno = EPERM;
+ break;
+ default:
+ resolve->op_ret = -1;
+ resolve->op_errno = ENOENT;
ret = 1;
- goto out;
- }
- state->loc_now->name = resolve->bname;
-
- inode = inode_grep (state->itable, parent, resolve->bname);
- if (!inode) {
- switch (resolve->type) {
- case RESOLVE_DONTCARE:
- case RESOLVE_NOT:
- ret = 0;
- break;
- case RESOLVE_MAY:
- ret = 1;
- break;
- default:
- resolve->op_ret = -1;
- resolve->op_errno = ENOENT;
- ret = 1;
- break;
- }
-
- goto out;
+ break;
}
- if (resolve->type == RESOLVE_NOT) {
- gf_msg_debug (this->name, 0, "inode (pointer: %p gfid:%s found"
- " for path (%s) while type is RESOLVE_NOT. "
- "Performing lookup on backend to rule out any "
- "possible stale dentries in inode table",
- inode, uuid_utoa (inode->gfid), resolve->path);
- resolve->op_ret = -1;
- resolve->op_errno = EEXIST;
- ret = 1;
- goto out;
- }
+ goto out;
+ }
+
+ if (resolve->type == RESOLVE_NOT) {
+ gf_msg_debug(this->name, 0,
+ "inode (pointer: %p gfid:%s found"
+ " for path (%s) while type is RESOLVE_NOT. "
+ "Performing lookup on backend to rule out any "
+ "possible stale dentries in inode table",
+ inode, uuid_utoa(inode->gfid), resolve->path);
+ resolve->op_ret = -1;
+ resolve->op_errno = EEXIST;
+ ret = 1;
+ goto out;
+ }
- ret = 0;
+ ret = 0;
- state->loc_now->inode = inode_ref (inode);
+ state->loc_now->inode = inode_ref(inode);
out:
- if (parent)
- inode_unref (parent);
+ if (parent)
+ inode_unref(parent);
- if (inode)
- inode_unref (inode);
+ if (inode)
+ inode_unref(inode);
- return ret;
+ return ret;
}
-
int
-server_resolve_entry (call_frame_t *frame)
+server_resolve_entry(call_frame_t *frame)
{
- server_state_t *state = NULL;
- int ret = 0;
- loc_t *loc = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
+ loc_t *loc = NULL;
- state = CALL_STATE (frame);
- loc = state->loc_now;
+ state = CALL_STATE(frame);
+ loc = state->loc_now;
- ret = resolve_entry_simple (frame);
+ ret = resolve_entry_simple(frame);
- if (ret > 0) {
- loc_wipe (loc);
- resolve_gfid (frame);
- return 0;
- }
+ if (ret > 0) {
+ loc_wipe(loc);
+ resolve_gfid(frame);
+ return 0;
+ }
- if (ret == 0)
- resolve_loc_touchup (frame);
+ if (ret == 0)
+ resolve_loc_touchup(frame);
- server_resolve_all (frame);
+ server_resolve_all(frame);
- return 0;
+ return 0;
}
-
int
-resolve_inode_simple (call_frame_t *frame)
+resolve_inode_simple(call_frame_t *frame)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
- inode_t *inode = NULL;
- int ret = 0;
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
+ inode_t *inode = NULL;
+ int ret = 0;
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
- inode = inode_find (state->itable, resolve->gfid);
+ inode = inode_find(state->itable, resolve->gfid);
- if (!inode) {
- resolve->op_ret = -1;
- resolve->op_errno = ESTALE;
- ret = 1;
- goto out;
- }
+ if (!inode) {
+ resolve->op_ret = -1;
+ resolve->op_errno = ESTALE;
+ ret = 1;
+ goto out;
+ }
- ret = 0;
+ ret = 0;
- state->loc_now->inode = inode_ref (inode);
- gf_uuid_copy (state->loc_now->gfid, resolve->gfid);
+ state->loc_now->inode = inode_ref(inode);
+ gf_uuid_copy(state->loc_now->gfid, resolve->gfid);
out:
- if (inode)
- inode_unref (inode);
+ if (inode)
+ inode_unref(inode);
- return ret;
+ return ret;
}
-
int
-server_resolve_inode (call_frame_t *frame)
+server_resolve_inode(call_frame_t *frame)
{
- server_state_t *state = NULL;
- int ret = 0;
- loc_t *loc = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
+ loc_t *loc = NULL;
- state = CALL_STATE (frame);
- loc = state->loc_now;
+ state = CALL_STATE(frame);
+ loc = state->loc_now;
- ret = resolve_inode_simple (frame);
+ ret = resolve_inode_simple(frame);
- if (ret > 0) {
- loc_wipe (loc);
- resolve_gfid (frame);
- return 0;
- }
+ if (ret > 0) {
+ loc_wipe(loc);
+ resolve_gfid(frame);
+ return 0;
+ }
- if (ret == 0)
- resolve_loc_touchup (frame);
+ if (ret == 0)
+ resolve_loc_touchup(frame);
- server_resolve_all (frame);
+ server_resolve_all(frame);
- return 0;
+ return 0;
}
-
int
-resolve_anonfd_simple (call_frame_t *frame)
+resolve_anonfd_simple(call_frame_t *frame)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
- inode_t *inode = NULL;
- int ret = 0;
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
+ inode_t *inode = NULL;
+ int ret = 0;
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
- inode = inode_find (state->itable, resolve->gfid);
+ inode = inode_find(state->itable, resolve->gfid);
- if (!inode) {
- resolve->op_ret = -1;
- resolve->op_errno = ENOENT;
- ret = 1;
- goto out;
- }
+ if (!inode) {
+ resolve->op_ret = -1;
+ resolve->op_errno = ENOENT;
+ ret = 1;
+ goto out;
+ }
- ret = 0;
+ ret = 0;
- if (frame->root->op == GF_FOP_READ || frame->root->op == GF_FOP_WRITE)
- state->fd = fd_anonymous_with_flags (inode, state->flags);
- else
- state->fd = fd_anonymous (inode);
+ if (frame->root->op == GF_FOP_READ || frame->root->op == GF_FOP_WRITE)
+ state->fd = fd_anonymous_with_flags(inode, state->flags);
+ else
+ state->fd = fd_anonymous(inode);
out:
- if (inode)
- inode_unref (inode);
-
- if (ret != 0)
- gf_msg_debug ("server", 0, "inode for the gfid"
- "(%s) is not found. anonymous fd creation failed",
- uuid_utoa (resolve->gfid));
- return ret;
+ if (inode)
+ inode_unref(inode);
+
+ if (ret != 0)
+ gf_msg_debug("server", 0,
+ "inode for the gfid"
+ "(%s) is not found. anonymous fd creation failed",
+ uuid_utoa(resolve->gfid));
+ return ret;
}
-
int
-server_resolve_anonfd (call_frame_t *frame)
+server_resolve_anonfd(call_frame_t *frame)
{
- server_state_t *state = NULL;
- int ret = 0;
- loc_t *loc = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
+ loc_t *loc = NULL;
- state = CALL_STATE (frame);
- loc = state->loc_now;
+ state = CALL_STATE(frame);
+ loc = state->loc_now;
- ret = resolve_anonfd_simple (frame);
-
- if (ret > 0) {
- loc_wipe (loc);
- resolve_gfid (frame);
- return 0;
- }
-
- server_resolve_all (frame);
+ ret = resolve_anonfd_simple(frame);
+ if (ret > 0) {
+ loc_wipe(loc);
+ resolve_gfid(frame);
return 0;
+ }
-}
+ server_resolve_all(frame);
+ return 0;
+}
int
-server_resolve_fd (call_frame_t *frame)
+server_resolve_fd(call_frame_t *frame)
{
- server_ctx_t *serv_ctx = NULL;
- server_state_t *state = NULL;
- client_t *client = NULL;
- server_resolve_t *resolve = NULL;
- uint64_t fd_no = -1;
+ server_ctx_t *serv_ctx = NULL;
+ server_state_t *state = NULL;
+ client_t *client = NULL;
+ server_resolve_t *resolve = NULL;
+ uint64_t fd_no = -1;
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
- fd_no = resolve->fd_no;
+ fd_no = resolve->fd_no;
- if (fd_no == GF_ANON_FD_NO) {
- server_resolve_anonfd (frame);
- return 0;
- }
+ if (fd_no == GF_ANON_FD_NO) {
+ server_resolve_anonfd(frame);
+ return 0;
+ }
- client = frame->root->client;
+ client = frame->root->client;
- serv_ctx = server_ctx_get (client, client->this);
+ serv_ctx = server_ctx_get(client, client->this);
- if (serv_ctx == NULL) {
- gf_msg ("", GF_LOG_INFO, ENOMEM, PS_MSG_NO_MEMORY,
- "server_ctx_get() failed");
- resolve->op_ret = -1;
- resolve->op_errno = ENOMEM;
- return 0;
- }
+ if (serv_ctx == NULL) {
+ gf_msg("", GF_LOG_INFO, ENOMEM, PS_MSG_NO_MEMORY,
+ "server_ctx_get() failed");
+ resolve->op_ret = -1;
+ resolve->op_errno = ENOMEM;
+ return 0;
+ }
- state->fd = gf_fd_fdptr_get (serv_ctx->fdtable, fd_no);
+ state->fd = gf_fd_fdptr_get(serv_ctx->fdtable, fd_no);
- if (!state->fd) {
- gf_msg ("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND, "fd not "
- "found in context");
- resolve->op_ret = -1;
- resolve->op_errno = EBADF;
- }
+ if (!state->fd) {
+ gf_msg("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND,
+ "fd not "
+ "found in context");
+ resolve->op_ret = -1;
+ resolve->op_errno = EBADF;
+ }
- server_resolve_all (frame);
+ server_resolve_all(frame);
- return 0;
+ return 0;
}
-
int
-server_resolve (call_frame_t *frame)
+server_resolve(call_frame_t *frame)
{
- server_state_t *state = NULL;
- server_resolve_t *resolve = NULL;
-
- state = CALL_STATE (frame);
- resolve = state->resolve_now;
-
- if (resolve->fd_no != -1) {
-
- server_resolve_fd (frame);
+ server_state_t *state = NULL;
+ server_resolve_t *resolve = NULL;
- } else if (!gf_uuid_is_null (resolve->pargfid)) {
+ state = CALL_STATE(frame);
+ resolve = state->resolve_now;
- server_resolve_entry (frame);
+ if (resolve->fd_no != -1) {
+ server_resolve_fd(frame);
- } else if (!gf_uuid_is_null (resolve->gfid)) {
+ } else if (!gf_uuid_is_null(resolve->pargfid)) {
+ server_resolve_entry(frame);
- server_resolve_inode (frame);
+ } else if (!gf_uuid_is_null(resolve->gfid)) {
+ server_resolve_inode(frame);
- } else {
- if (resolve == &state->resolve)
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PS_MSG_INVALID_ENTRY,
- "no resolution type for %s (%s)",
- resolve->path, gf_fop_list[frame->root->op]);
+ } else {
+ if (resolve == &state->resolve)
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0, PS_MSG_INVALID_ENTRY,
+ "no resolution type for %s (%s)", resolve->path,
+ gf_fop_list[frame->root->op]);
- resolve->op_ret = -1;
- resolve->op_errno = EINVAL;
+ resolve->op_ret = -1;
+ resolve->op_errno = EINVAL;
- server_resolve_all (frame);
- }
+ server_resolve_all(frame);
+ }
- return 0;
+ return 0;
}
-
int
-server_resolve_done (call_frame_t *frame)
+server_resolve_done(call_frame_t *frame)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- server_print_request (frame);
+ server_print_request(frame);
- state->resume_fn (frame, frame->root->client->bound_xl);
+ state->resume_fn(frame, frame->root->client->bound_xl);
- return 0;
+ return 0;
}
-
/*
* This function is called multiple times, once per resolving one location/fd.
* state->resolve_now is used to decide which location/fd is to be resolved now
*/
int
-server_resolve_all (call_frame_t *frame)
+server_resolve_all(call_frame_t *frame)
{
- server_state_t *state = NULL;
- xlator_t *this = NULL;
-
- this = frame->this;
- state = CALL_STATE (frame);
-
- if (state->resolve_now == NULL) {
-
- state->resolve_now = &state->resolve;
- state->loc_now = &state->loc;
+ server_state_t *state = NULL;
+ xlator_t *this = NULL;
- server_resolve (frame);
+ this = frame->this;
+ state = CALL_STATE(frame);
- } else if (state->resolve_now == &state->resolve) {
+ if (state->resolve_now == NULL) {
+ state->resolve_now = &state->resolve;
+ state->loc_now = &state->loc;
- state->resolve_now = &state->resolve2;
- state->loc_now = &state->loc2;
+ server_resolve(frame);
- server_resolve (frame);
+ } else if (state->resolve_now == &state->resolve) {
+ state->resolve_now = &state->resolve2;
+ state->loc_now = &state->loc2;
- } else if (state->resolve_now == &state->resolve2) {
+ server_resolve(frame);
- server_resolve_done (frame);
+ } else if (state->resolve_now == &state->resolve2) {
+ server_resolve_done(frame);
- } else {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PS_MSG_INVALID_ENTRY, "Invalid pointer for "
- "state->resolve_now");
- }
+ } else {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
+ "Invalid pointer for "
+ "state->resolve_now");
+ }
- return 0;
+ return 0;
}
-
int
-resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn)
+resolve_and_resume(call_frame_t *frame, server_resume_fn_t fn)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
- state->resume_fn = fn;
+ state = CALL_STATE(frame);
+ state->resume_fn = fn;
- server_resolve_all (frame);
+ server_resolve_all(frame);
- return 0;
+ return 0;
}
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 8efbb8dcb9e..c621743fa06 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -8,7 +8,6 @@
cases as published by the Free Software Foundation.
*/
-
#include <openssl/md5.h>
#include "server.h"
@@ -26,6160 +25,6235 @@
#include "xdr-nfs3.h"
-#define SERVER_REQ_SET_ERROR(req, ret) \
- do { \
- rpcsvc_request_seterr (req, GARBAGE_ARGS); \
- ret = RPCSVC_ACTOR_ERROR; \
- } while (0)
-
+#define SERVER_REQ_SET_ERROR(req, ret) \
+ do { \
+ rpcsvc_request_seterr(req, GARBAGE_ARGS); \
+ ret = RPCSVC_ACTOR_ERROR; \
+ } while (0)
void
-forget_inode_if_no_dentry (inode_t *inode)
+forget_inode_if_no_dentry(inode_t *inode)
{
- if (!inode) {
- return;
- }
+ if (!inode) {
+ return;
+ }
- if (!inode_has_dentry (inode))
- inode_forget (inode, 0);
+ if (!inode_has_dentry(inode))
+ inode_forget(inode, 0);
- return;
+ return;
}
void
-set_resolve_gfid (client_t *client, uuid_t resolve_gfid,
- char *on_wire_gfid)
+set_resolve_gfid(client_t *client, uuid_t resolve_gfid, char *on_wire_gfid)
{
- if (client->subdir_mount &&
- __is_root_gfid ((unsigned char *)on_wire_gfid)) {
- /* set the subdir_mount's gfid for proper resolution */
- gf_uuid_copy (resolve_gfid, client->subdir_gfid);
- } else {
- memcpy (resolve_gfid, on_wire_gfid, 16);
- }
+ if (client->subdir_mount && __is_root_gfid((unsigned char *)on_wire_gfid)) {
+ /* set the subdir_mount's gfid for proper resolution */
+ gf_uuid_copy(resolve_gfid, client->subdir_gfid);
+ } else {
+ memcpy(resolve_gfid, on_wire_gfid, 16);
+ }
}
/* Callback function section */
int
-server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct statvfs *buf,
- dict_t *xdata)
+server_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct statvfs *buf,
+ dict_t *xdata)
{
- gfs3_statfs_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
+ gfs3_statfs_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
- "%"PRId64": STATFS, client: %s, error-xlator: %s",
- frame->root->unique, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
+ "%" PRId64 ": STATFS, client: %s, error-xlator: %s",
+ frame->root->unique, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_statfs (&rsp, buf);
+ server_post_statfs(&rsp, buf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_statfs_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_statfs_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *stbuf, dict_t *xdata,
- struct iatt *postparent)
-{
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
- loc_t fresh_loc = {0,};
- gfs3_lookup_rsp rsp = {0,};
-
- state = CALL_STATE (frame);
-
- if (state->is_revalidate == 1 && op_ret == -1) {
- state->is_revalidate = 2;
- loc_copy (&fresh_loc, &state->loc);
- inode_unref (fresh_loc.inode);
- fresh_loc.inode = server_inode_new (state->itable,
- fresh_loc.gfid);
-
- STACK_WIND (frame, server_lookup_cbk,
- frame->root->client->bound_xl,
- frame->root->client->bound_xl->fops->lookup,
- &fresh_loc, state->xdata);
-
- loc_wipe (&fresh_loc);
- return 0;
- }
-
- gf_stat_from_iatt (&rsp.postparent, postparent);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- if (state->is_revalidate && op_errno == ENOENT) {
- if (!__is_root_gfid (state->resolve.gfid)) {
- inode_unlink (state->loc.inode,
- state->loc.parent,
- state->loc.name);
- /**
- * If the entry is not present, then just
- * unlinking the associated dentry is not
- * suffecient. This condition should be
- * treated as unlink of the entry. So along
- * with deleting the entry, its also important
- * to forget the inode for it (if the dentry
- * being considered was the last dentry).
- * Otherwise it might lead to inode leak.
- * It also might lead to wrong decisions being
- * taken if the future lookups on this inode are
- * successful since they are able to find the
- * inode in the inode table (at least gfid based
- * lookups will be successful, if the lookup
- * is a soft lookup)
- */
- forget_inode_if_no_dentry (state->loc.inode);
- }
- }
- goto out;
- }
-
- server_post_lookup (&rsp, frame, state, inode, stbuf, postparent);
+server_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, dict_t *xdata, struct iatt *postparent)
+{
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+ loc_t fresh_loc = {
+ 0,
+ };
+ gfs3_lookup_rsp rsp = {
+ 0,
+ };
+
+ state = CALL_STATE(frame);
+
+ if (state->is_revalidate == 1 && op_ret == -1) {
+ state->is_revalidate = 2;
+ loc_copy(&fresh_loc, &state->loc);
+ inode_unref(fresh_loc.inode);
+ fresh_loc.inode = server_inode_new(state->itable, fresh_loc.gfid);
+
+ STACK_WIND(frame, server_lookup_cbk, frame->root->client->bound_xl,
+ frame->root->client->bound_xl->fops->lookup, &fresh_loc,
+ state->xdata);
+
+ loc_wipe(&fresh_loc);
+ return 0;
+ }
+
+ gf_stat_from_iatt(&rsp.postparent, postparent);
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ if (state->is_revalidate && op_errno == ENOENT) {
+ if (!__is_root_gfid(state->resolve.gfid)) {
+ inode_unlink(state->loc.inode, state->loc.parent,
+ state->loc.name);
+ /**
+ * If the entry is not present, then just
+ * unlinking the associated dentry is not
+ * suffecient. This condition should be
+ * treated as unlink of the entry. So along
+ * with deleting the entry, its also important
+ * to forget the inode for it (if the dentry
+ * being considered was the last dentry).
+ * Otherwise it might lead to inode leak.
+ * It also might lead to wrong decisions being
+ * taken if the future lookups on this inode are
+ * successful since they are able to find the
+ * inode in the inode table (at least gfid based
+ * lookups will be successful, if the lookup
+ * is a soft lookup)
+ */
+ forget_inode_if_no_dentry(state->loc.inode);
+ }
+ }
+ goto out;
+ }
+
+ server_post_lookup(&rsp, frame, state, inode, stbuf, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
-
- if (op_ret) {
- if (state->resolve.bname) {
- gf_msg (this->name,
- fop_log_level (GF_FOP_LOOKUP, op_errno),
- op_errno, PS_MSG_LOOKUP_INFO,
- "%"PRId64": LOOKUP %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path,
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- } else {
- gf_msg (this->name,
- fop_log_level (GF_FOP_LOOKUP, op_errno),
- op_errno, PS_MSG_LOOKUP_INFO,
- "%"PRId64": LOOKUP %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+
+ if (op_ret) {
+ if (state->resolve.bname) {
+ gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
+ PS_MSG_LOOKUP_INFO,
+ "%" PRId64
+ ": LOOKUP %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ } else {
+ gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
+ PS_MSG_LOOKUP_INFO,
+ "%" PRId64
+ ": LOOKUP %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid),
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
}
+ }
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lookup_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_lookup_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_lease_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct gf_lease *lease,
- dict_t *xdata)
+server_lease_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct gf_lease *lease,
+ dict_t *xdata)
{
- gfs3_lease_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_LEASE, op_errno),
- op_errno, PS_MSG_LK_INFO,
- "%"PRId64": LEASE %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
- server_post_lease (&rsp, lease);
+ gfs3_lease_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_LEASE, op_errno), op_errno,
+ PS_MSG_LK_INFO,
+ "%" PRId64 ": LEASE %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+ server_post_lease(&rsp, lease);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lease_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_lease_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct gf_flock *lock,
- dict_t *xdata)
+server_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
+ int32_t op_errno, struct gf_flock *lock, dict_t *xdata)
{
- gfs3_lk_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
+ gfs3_lk_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_LK, op_errno),
- op_errno, PS_MSG_LK_INFO,
- "%"PRId64": LK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_LK, op_errno), op_errno,
+ PS_MSG_LK_INFO,
+ "%" PRId64 ": LK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_lk (this, &rsp, lock);
+ server_post_lk(this, &rsp, lock);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_lk_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_lk_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_inodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
- op_errno, PS_MSG_INODELK_INFO,
- "%"PRId64": INODELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_INODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO,
+ "%" PRId64
+ ": INODELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_finodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
- op_errno, PS_MSG_INODELK_INFO,
- "%"PRId64": FINODELK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FINODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO,
+ "%" PRId64 ": FINODELK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_entrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
- op_errno, PS_MSG_ENTRYLK_INFO,
- "%"PRId64": ENTRYLK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_ENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO,
+ "%" PRId64
+ ": ENTRYLK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_fentrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
- op_errno, PS_MSG_ENTRYLK_INFO,
- "%"PRId64": FENTRYLK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO,
+ "%" PRId64 ": FENTRYLK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_access_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, PS_MSG_ACCESS_INFO,
- "%"PRId64": ACCESS %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_ACCESS_INFO,
+ "%" PRId64
+ ": ACCESS %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_rmdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_rmdir_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret) {
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": RMDIR %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": RMDIR %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_rmdir (state, &rsp, preparent, postparent);
+ server_post_rmdir(state, &rsp, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_rmdir_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_rmdir_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_mkdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": MKDIR %s (%s/%s) client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_mkdir (state, &rsp, inode, stbuf, preparent,
- postparent, xdata);
+ gfs3_mkdir_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_MKDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": MKDIR %s (%s/%s) client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_mkdir(state, &rsp, inode, stbuf, preparent, postparent, xdata);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_mkdir_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_mkdir_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_mknod_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKNOD, op_errno),
- op_errno, PS_MSG_MKNOD_INFO,
- "%"PRId64": MKNOD %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_mknod (state, &rsp, stbuf, preparent, postparent,
- inode);
+ gfs3_mknod_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_MKNOD, op_errno), op_errno,
+ PS_MSG_MKNOD_INFO,
+ "%" PRId64
+ ": MKNOD %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_mknod(state, &rsp, stbuf, preparent, postparent, inode);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_mknod_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_mknod_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_fsyncdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSYNCDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": FSYNCDIR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSYNCDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": FSYNCDIR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
- dict_t *xdata)
+server_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
+ dict_t *xdata)
{
- gfs3_readdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": READDIR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* (op_ret == 0) is valid, and means EOF */
- if (op_ret) {
- ret = server_post_readdir (&rsp, entries);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- }
+ gfs3_readdir_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": READDIR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* (op_ret == 0) is valid, and means EOF */
+ if (op_ret) {
+ ret = server_post_readdir(&rsp, entries);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_readdir_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_readdir_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- readdir_rsp_cleanup (&rsp);
+ readdir_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
int
-server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
+server_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfs3_opendir_rsp rsp = {0,};
- uint64_t fd_no = 0;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfs3_opendir_rsp rsp = {
+ 0,
+ };
+ uint64_t fd_no = 0;
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": OPENDIR %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_OPENDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": OPENDIR %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- op_ret = server_post_opendir (frame, this, &rsp, fd);
- if (op_ret)
- goto out;
+ op_ret = server_post_opendir(frame, this, &rsp, fd);
+ if (op_ret)
+ goto out;
out:
- if (op_ret)
- rsp.fd = fd_no;
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ if (op_ret)
+ rsp.fd = fd_no;
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_opendir_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_opendir_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
- gf_loglevel_t loglevel = GF_LOG_NONE;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+ gf_loglevel_t loglevel = GF_LOG_NONE;
- if (gf_replace_old_iatt_in_dict (xdata)) {
- op_errno = errno;
- op_ret = -1;
- goto out;
- }
+ if (gf_replace_old_iatt_in_dict(xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (ENODATA == op_errno || ENOATTR == op_errno)
- loglevel = GF_LOG_DEBUG;
- else
- loglevel = GF_LOG_INFO;
-
- gf_msg (this->name, loglevel, op_errno,
- PS_MSG_REMOVEXATTR_INFO,
- "%"PRId64": REMOVEXATTR %s (%s) of key %s, client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (ENODATA == op_errno || ENOATTR == op_errno)
+ loglevel = GF_LOG_DEBUG;
+ else
+ loglevel = GF_LOG_INFO;
+
+ gf_msg(this->name, loglevel, op_errno, PS_MSG_REMOVEXATTR_INFO,
+ "%" PRId64
+ ": REMOVEXATTR %s (%s) of key %s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_fremovexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- if (gf_replace_old_iatt_in_dict (xdata)) {
- op_errno = errno;
- op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name,
- fop_log_level (GF_FOP_FREMOVEXATTR, op_errno), op_errno,
- PS_MSG_REMOVEXATTR_INFO,
- "%"PRId64": FREMOVEXATTR %"PRId64" (%s) (%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ if (gf_replace_old_iatt_in_dict(xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FREMOVEXATTR, op_errno),
+ op_errno, PS_MSG_REMOVEXATTR_INFO,
+ "%" PRId64 ": FREMOVEXATTR %" PRId64
+ " (%s) (%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict,
- dict_t *xdata)
+server_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
+ dict_t *xdata)
{
- gfs3_getxattr_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
- op_errno, PS_MSG_GETXATTR_INFO,
- "%"PRId64": GETXATTR %s (%s) (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
- rsp.dict.dict_len, op_errno, out);
+ gfs3_getxattr_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_GETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO,
+ "%" PRId64
+ ": GETXATTR %s (%s) (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, dict, &rsp.dict.dict_val,
+ rsp.dict.dict_len, op_errno, out);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_getxattr_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_getxattr_rsp);
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE(rsp.dict.dict_val);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict,
- dict_t *xdata)
+server_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
+ dict_t *xdata)
{
- gfs3_fgetxattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
- op_errno, PS_MSG_GETXATTR_INFO,
- "%"PRId64": FGETXATTR %"PRId64" (%s) (%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
- rsp.dict.dict_len, op_errno, out);
+ gfs3_fgetxattr_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FGETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO,
+ "%" PRId64 ": FGETXATTR %" PRId64
+ " (%s) (%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, dict, &rsp.dict.dict_val,
+ rsp.dict.dict_len, op_errno, out);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE(rsp.dict.dict_val);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
/* print every key */
int
-_gf_server_log_setxattr_failure (dict_t *d, char *k, data_t *v,
- void *tmp)
+_gf_server_log_setxattr_failure(dict_t *d, char *k, data_t *v, void *tmp)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
- frame = tmp;
- state = CALL_STATE (frame);
+ frame = tmp;
+ state = CALL_STATE(frame);
- gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
- "%"PRId64": SETXATTR %s (%s) ==> %s, client: %s, "
- "error-xlator: %s", frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid), k,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- return 0;
+ gf_msg(THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
+ "%" PRId64
+ ": SETXATTR %s (%s) ==> %s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path, uuid_utoa(state->resolve.gfid),
+ k, STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ return 0;
}
int
-server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- if (gf_replace_old_iatt_in_dict (xdata)) {
- op_errno = errno;
- op_ret = -1;
- goto out;
- }
+ if (gf_replace_old_iatt_in_dict(xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (op_errno != ENOTSUP)
- dict_foreach (state->dict,
- _gf_server_log_setxattr_failure,
- frame);
-
- if (op_errno == ENOTSUP) {
- gf_msg_debug (THIS->name, 0, "%s",
- strerror (op_errno));
- } else {
- gf_msg (THIS->name, GF_LOG_INFO, op_errno,
- PS_MSG_SETXATTR_INFO, "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
- goto out;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (op_errno != ENOTSUP)
+ dict_foreach(state->dict, _gf_server_log_setxattr_failure, frame);
+
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
+ } else {
+ gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client: %s, "
+ "error-xlator: %s",
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
}
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
/* print every key here */
static int
-_gf_server_log_fsetxattr_failure (dict_t *d, char *k, data_t *v,
- void *tmp)
+_gf_server_log_fsetxattr_failure(dict_t *d, char *k, data_t *v, void *tmp)
{
- call_frame_t *frame = NULL;
- server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
- frame = tmp;
- state = CALL_STATE (frame);
+ frame = tmp;
+ state = CALL_STATE(frame);
- gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
- "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s, client: %s, "
- "error-xlator: %s", frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid), k,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
+ gf_msg(THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
+ "%" PRId64 ": FSETXATTR %" PRId64
+ " (%s) ==> %s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), k, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
- return 0;
+ return 0;
}
int
-server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- if (gf_replace_old_iatt_in_dict (xdata)) {
- op_errno = errno;
- op_ret = -1;
- goto out;
- }
+ if (gf_replace_old_iatt_in_dict(xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (op_errno != ENOTSUP) {
- dict_foreach (state->dict,
- _gf_server_log_fsetxattr_failure,
- frame);
- }
- if (op_errno == ENOTSUP) {
- gf_msg_debug (THIS->name, 0, "%s",
- strerror (op_errno));
- } else {
- gf_msg (THIS->name, GF_LOG_INFO, op_errno,
- PS_MSG_SETXATTR_INFO, "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
- goto out;
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (op_errno != ENOTSUP) {
+ dict_foreach(state->dict, _gf_server_log_fsetxattr_failure, frame);
+ }
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
+ } else {
+ gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client: %s, "
+ "error-xlator: %s",
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
}
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
- struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent,
- dict_t *xdata)
+server_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent,
+ dict_t *xdata)
{
- gfs3_rename_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- char oldpar_str[50] = {0,};
- char newpar_str[50] = {0,};
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret == -1) {
- uuid_utoa_r (state->resolve.pargfid, oldpar_str);
- uuid_utoa_r (state->resolve2.pargfid, newpar_str);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
- "%"PRId64": RENAME %s (%s/%s) -> %s (%s/%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->loc.path, oldpar_str, state->resolve.bname,
- state->loc2.path, newpar_str, state->resolve2.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_rename (frame, state, &rsp, stbuf,
- preoldparent, postoldparent,
- prenewparent, postnewparent);
+ gfs3_rename_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ char oldpar_str[50] = {
+ 0,
+ };
+ char newpar_str[50] = {
+ 0,
+ };
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret == -1) {
+ uuid_utoa_r(state->resolve.pargfid, oldpar_str);
+ uuid_utoa_r(state->resolve2.pargfid, newpar_str);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
+ "%" PRId64
+ ": RENAME %s (%s/%s) -> %s (%s/%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path, oldpar_str,
+ state->resolve.bname, state->loc2.path, newpar_str,
+ state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_rename(frame, state, &rsp, stbuf, preoldparent, postoldparent,
+ prenewparent, postnewparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_rename_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_rename_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_unlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- if (gf_replace_old_iatt_in_dict (xdata)) {
- op_errno = errno;
- op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
- op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": UNLINK %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* TODO: log gfid of the inodes */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "UNLINK_CBK %s", frame->root->unique, state->loc.name);
-
- server_post_unlink (state, &rsp, preparent, postparent);
+ gfs3_unlink_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ if (gf_replace_old_iatt_in_dict(xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_UNLINK, op_errno), op_errno,
+ PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": UNLINK %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* TODO: log gfid of the inodes */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "UNLINK_CBK %s",
+ frame->root->unique, state->loc.name);
+
+ server_post_unlink(state, &rsp, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_unlink_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_unlink_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_symlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_symlink_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": SYMLINK %s (%s/%s), client: %s, "
- "error-xlator:%s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": SYMLINK %s (%s/%s), client: %s, "
+ "error-xlator:%s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_symlink (state, &rsp, inode, stbuf, preparent,
- postparent, xdata);
+ server_post_symlink(state, &rsp, inode, stbuf, preparent, postparent,
+ xdata);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_symlink_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_symlink_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- gfs3_link_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- char gfid_str[50] = {0,};
- char newpar_str[50] = {0,};
+ gfs3_link_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ char gfid_str[50] = {
+ 0,
+ };
+ char newpar_str[50] = {
+ 0,
+ };
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret) {
- uuid_utoa_r (state->resolve.gfid, gfid_str);
- uuid_utoa_r (state->resolve2.pargfid, newpar_str);
-
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": LINK %s (%s) -> %s/%s, client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, gfid_str, newpar_str,
- state->resolve2.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ uuid_utoa_r(state->resolve.gfid, gfid_str);
+ uuid_utoa_r(state->resolve2.pargfid, newpar_str);
+
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": LINK %s (%s) -> %s/%s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path, gfid_str, newpar_str,
+ state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_link (state, &rsp, inode, stbuf, preparent,
- postparent, xdata);
+ server_post_link(state, &rsp, inode, stbuf, preparent, postparent, xdata);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_link_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_link_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
+server_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- gfs3_truncate_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_truncate_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno,
- PS_MSG_TRUNCATE_INFO,
- "%"PRId64": TRUNCATE %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_TRUNCATE_INFO,
+ "%" PRId64
+ ": TRUNCATE %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_truncate (&rsp, prebuf, postbuf);
+ server_post_truncate(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_truncate_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_truncate_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
- dict_t *xdata)
+server_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
+ dict_t *xdata)
{
- gfs3_fstat_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_FSTAT, op_errno),
- op_errno, PS_MSG_STAT_INFO,
- "%"PRId64": FSTAT %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_fstat (state, &rsp, stbuf);
+ gfs3_fstat_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FSTAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO,
+ "%" PRId64 ": FSTAT %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_fstat(state, &rsp, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fstat_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fstat_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
+server_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- gfs3_ftruncate_rsp rsp = {0};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_ftruncate_rsp rsp = {0};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FTRUNCATE, op_errno),
- op_errno, PS_MSG_TRUNCATE_INFO,
- "%"PRId64": FTRUNCATE %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FTRUNCATE, op_errno), op_errno,
+ PS_MSG_TRUNCATE_INFO,
+ "%" PRId64 ": FTRUNCATE %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_ftruncate (&rsp, prebuf, postbuf);
+ server_post_ftruncate(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_ftruncate_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_ftruncate_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
- op_errno, PS_MSG_FLUSH_INFO,
- "%"PRId64": FLUSH %"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FLUSH, op_errno), op_errno,
+ PS_MSG_FLUSH_INFO,
+ "%" PRId64 ": FLUSH %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
+server_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- gfs3_fsync_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSYNC, op_errno),
- op_errno, PS_MSG_SYNC_INFO,
- "%"PRId64": FSYNC %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfs3_fsync_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- server_post_fsync (&rsp, prebuf, postbuf);
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSYNC, op_errno), op_errno,
+ PS_MSG_SYNC_INFO,
+ "%" PRId64 ": FSYNC %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_fsync(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fsync_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fsync_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
+server_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- gfs3_write_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_WRITE, op_errno),
- op_errno, PS_MSG_WRITE_INFO,
- "%"PRId64": WRITEV %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_writev (&rsp, prebuf, postbuf);
+ gfs3_write_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_WRITE, op_errno), op_errno,
+ PS_MSG_WRITE_INFO,
+ "%" PRId64 ": WRITEV %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_writev(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_write_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_write_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iovec *vector, int32_t count,
- struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
+server_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iovec *vector,
+ int32_t count, struct iatt *stbuf, struct iobref *iobref,
+ dict_t *xdata)
{
- gfs3_read_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_read_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
#ifdef GF_TESTING_IO_XDATA
- {
- int ret = 0;
- if (!xdata)
- xdata = dict_new ();
-
- ret = dict_set_str (xdata, "testing-the-xdata-key",
- "testing-xdata-value");
- }
+ {
+ int ret = 0;
+ if (!xdata)
+ xdata = dict_new();
+
+ ret = dict_set_str(xdata, "testing-the-xdata-key",
+ "testing-xdata-value");
+ }
#endif
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READ, op_errno),
- op_errno, PS_MSG_READ_INFO,
- "%"PRId64": READV %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_readv (&rsp, stbuf, op_ret);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READ, op_errno), op_errno,
+ PS_MSG_READ_INFO,
+ "%" PRId64 ": READV %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_readv(&rsp, stbuf, op_ret);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, vector, count, iobref,
- (xdrproc_t)xdr_gfs3_read_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, vector, count, iobref,
+ (xdrproc_t)xdr_gfs3_read_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- uint32_t weak_checksum, uint8_t *strong_checksum,
- dict_t *xdata)
+server_rchecksum_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, uint32_t weak_checksum,
+ uint8_t *strong_checksum, dict_t *xdata)
{
- gfs3_rchecksum_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
+ gfs3_rchecksum_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_RCHECKSUM, op_errno),
- op_errno, PS_MSG_CHKSUM_INFO,
- "%"PRId64": RCHECKSUM %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_RCHECKSUM, op_errno), op_errno,
+ PS_MSG_CHKSUM_INFO,
+ "%" PRId64 ": RCHECKSUM %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_rchecksum (&rsp, weak_checksum, strong_checksum);
+ server_post_rchecksum(&rsp, weak_checksum, strong_checksum);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_rchecksum_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_rchecksum_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
+server_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfs3_open_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
- op_errno, PS_MSG_OPEN_INFO,
- "%"PRId64": OPEN %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_OPEN, op_errno), op_errno,
+ PS_MSG_OPEN_INFO,
+ "%" PRId64 ": OPEN %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- op_ret = server_post_open (frame, this, &rsp, fd);
- if (op_ret)
- goto out;
+ op_ret = server_post_open(frame, this, &rsp, fd);
+ if (op_ret)
+ goto out;
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_open_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_open_rsp);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+server_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
+ struct iatt *postparent, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- uint64_t fd_no = 0;
- gfs3_create_rsp rsp = {0,};
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
- "%"PRId64": CREATE %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* TODO: log gfid too */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "CREATE %s (%s)", frame->root->unique, state->loc.name,
- uuid_utoa (stbuf->ia_gfid));
-
- op_ret = server_post_create (frame, &rsp, state, this, fd, inode,
- stbuf,
- preparent, postparent);
- if (op_ret) {
- op_errno = -op_ret;
- op_ret = -1;
- goto out;
- }
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ uint64_t fd_no = 0;
+ gfs3_create_rsp rsp = {
+ 0,
+ };
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
+ "%" PRId64
+ ": CREATE %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* TODO: log gfid too */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "CREATE %s (%s)",
+ frame->root->unique, state->loc.name,
+ uuid_utoa(stbuf->ia_gfid));
+
+ op_ret = server_post_create(frame, &rsp, state, this, fd, inode, stbuf,
+ preparent, postparent);
+ if (op_ret) {
+ op_errno = -op_ret;
+ op_ret = -1;
+ goto out;
+ }
out:
- if (op_ret)
- rsp.fd = fd_no;
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ if (op_ret)
+ rsp.fd = fd_no;
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_create_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_create_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, const char *buf,
- struct iatt *stbuf, dict_t *xdata)
+server_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, const char *buf,
+ struct iatt *stbuf, dict_t *xdata)
{
- gfs3_readlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_readlink_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": READLINK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": READLINK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_readlink (&rsp, stbuf, buf);
+ server_post_readlink(&rsp, stbuf, buf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
- if (!rsp.path)
- rsp.path = "";
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+ if (!rsp.path)
+ rsp.path = "";
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_readlink_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_readlink_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
- dict_t *xdata)
+server_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
+ dict_t *xdata)
{
- gfs3_stat_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_stat_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- state = CALL_STATE (frame);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_STAT, op_errno),
- op_errno, PS_MSG_STAT_INFO,
- "%"PRId64": STAT %s (%s), client: %s, error-xlator: %s",
- frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ state = CALL_STATE(frame);
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_STAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO,
+ "%" PRId64 ": STAT %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_stat (state, &rsp, stbuf);
+ server_post_stat(state, &rsp, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_stat_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_stat_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+server_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
{
- gfs3_setattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_setattr_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
- "%"PRId64": SETATTR %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
+ "%" PRId64
+ ": SETATTR %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_setattr (&rsp, statpre, statpost);
+ server_post_setattr(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_setattr_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_setattr_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+server_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
{
- gfs3_fsetattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_fsetattr_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSETATTR, op_errno),
- op_errno, PS_MSG_SETATTR_INFO,
- "%"PRId64": FSETATTR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSETATTR, op_errno), op_errno,
+ PS_MSG_SETATTR_INFO,
+ "%" PRId64 ": FSETATTR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_fsetattr (&rsp, statpre, statpost);
+ server_post_fsetattr(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fsetattr_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fsetattr_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict,
- dict_t *xdata)
+server_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
+ dict_t *xdata)
{
- gfs3_xattrop_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_XATTROP, op_errno),
- op_errno, PS_MSG_XATTROP_INFO,
- "%"PRId64": XATTROP %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
- rsp.dict.dict_len, op_errno, out);
+ gfs3_xattrop_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO,
+ "%" PRId64
+ ": XATTROP %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, dict, &rsp.dict.dict_val,
+ rsp.dict.dict_len, op_errno, out);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_xattrop_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_xattrop_rsp);
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE(rsp.dict.dict_val);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict,
- dict_t *xdata)
+server_fxattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
+ dict_t *xdata)
{
- gfs3_xattrop_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FXATTROP, op_errno),
- op_errno, PS_MSG_XATTROP_INFO,
- "%"PRId64": FXATTROP %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
- rsp.dict.dict_len, op_errno, out);
+ gfs3_xattrop_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FXATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO,
+ "%" PRId64 ": FXATTROP %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, dict, &rsp.dict.dict_val,
+ rsp.dict.dict_len, op_errno, out);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fxattrop_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fxattrop_rsp);
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE(rsp.dict.dict_val);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
- dict_t *xdata)
+server_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
+ dict_t *xdata)
{
- gfs3_readdirp_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READDIRP, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": READDIRP %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* (op_ret == 0) is valid, and means EOF */
- if (op_ret) {
- ret = server_post_readdirp (&rsp, entries);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- gf_link_inodes_from_dirent (this, state->fd->inode, entries);
+ gfs3_readdirp_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READDIRP, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": READDIRP %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* (op_ret == 0) is valid, and means EOF */
+ if (op_ret) {
+ ret = server_post_readdirp(&rsp, entries);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
+
+ gf_link_inodes_from_dirent(this, state->fd->inode, entries);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_readdirp_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_readdirp_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- readdirp_rsp_cleanup (&rsp);
+ readdirp_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
int
server_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfs3_fallocate_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FALLOCATE, op_errno),
- op_errno, PS_MSG_ALLOC_INFO,
- "%"PRId64": FALLOCATE %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_fallocate (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_fallocate_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FALLOCATE, op_errno), op_errno,
+ PS_MSG_ALLOC_INFO,
+ "%" PRId64 ": FALLOCATE %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_fallocate(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_fallocate_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fallocate_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
server_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfs3_discard_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_DISCARD, op_errno),
- op_errno, PS_MSG_DISCARD_INFO,
- "%"PRId64": DISCARD %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_discard (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_discard_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_DISCARD, op_errno), op_errno,
+ PS_MSG_DISCARD_INFO,
+ "%" PRId64 ": DISCARD %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_discard(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_discard_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_discard_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
server_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfs3_zerofill_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_ZEROFILL, op_errno),
- op_errno, PS_MSG_ZEROFILL_INFO,
- "%"PRId64": ZEROFILL%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server_post_zerofill (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_zerofill_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ req = frame->local;
+ state = CALL_STATE(frame);
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&rsp.xdata.xdata_val),
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_ZEROFILL, op_errno), op_errno,
+ PS_MSG_ZEROFILL_INFO,
+ "%" PRId64 ": ZEROFILL%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server_post_zerofill(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_zerofill_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_zerofill_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
+server_ipc_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gf_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- req = frame->local;
- state = CALL_STATE (frame);
+ req = frame->local;
+ state = CALL_STATE(frame);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&rsp.xdata.xdata_val),
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- gf_msg (this->name, GF_LOG_INFO, op_errno,
- PS_MSG_SERVER_IPC_INFO,
- "%"PRId64": IPC%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_IPC_INFO,
+ "%" PRId64 ": IPC%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gf_common_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-
int
-server_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, off_t offset, dict_t *xdata)
+server_seek_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, off_t offset, dict_t *xdata)
{
- struct gfs3_seek_rsp rsp = {0, };
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ struct gfs3_seek_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- req = frame->local;
- state = CALL_STATE (frame);
+ req = frame->local;
+ state = CALL_STATE(frame);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&rsp.xdata.xdata_val),
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_SEEK, op_errno),
- op_errno, PS_MSG_SEEK_INFO,
- "%"PRId64": SEEK%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_SEEK, op_errno), op_errno,
+ PS_MSG_SEEK_INFO,
+ "%" PRId64 ": SEEK%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server_post_seek (&rsp, offset);
+ server_post_seek(&rsp, offset);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_seek_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_seek_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
static int
-server_setactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *xdata)
-{
- gfs3_setactivelk_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- state = CALL_STATE (frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, 0,
- "%"PRId64": SETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+server_setactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
+{
+ gfs3_setactivelk_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ state = CALL_STATE(frame);
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
+ "%" PRId64
+ ": SETACTIVELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
+ req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_setactivelk_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_setactivelk_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
int
-server_compound_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, void *data,
- dict_t *xdata)
+server_compound_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, void *data, dict_t *xdata)
{
- struct gfs3_compound_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- compound_args_cbk_t *args_cbk = data;
- int i = 0;
+ struct gfs3_compound_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ compound_args_cbk_t *args_cbk = data;
+ int i = 0;
- req = frame->local;
- state = CALL_STATE (frame);
+ req = frame->local;
+ state = CALL_STATE(frame);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
- rsp.xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&rsp.xdata.xdata_val),
+ rsp.xdata.xdata_len, op_errno, out);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_COMPOUND, op_errno),
- op_errno, PS_MSG_COMPOUND_INFO,
- "%"PRId64": COMPOUND%"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_COMPOUND, op_errno), op_errno,
+ PS_MSG_COMPOUND_INFO,
+ "%" PRId64 ": COMPOUND%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ }
- /* TODO: I assume a single 10MB payload is large, if not, we need to
- agree to valid payload */
- if ((args_cbk->fop_length <= 0) ||
- ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
- op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
+ /* TODO: I assume a single 10MB payload is large, if not, we need to
+ agree to valid payload */
+ if ((args_cbk->fop_length <= 0) ||
+ ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
- rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC
- (args_cbk->fop_length,
- sizeof (compound_rsp),
- gf_server_mt_compound_rsp_t);
+ rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC(
+ args_cbk->fop_length, sizeof(compound_rsp),
+ gf_server_mt_compound_rsp_t);
- if (!rsp.compound_rsp_array.compound_rsp_array_val) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
-
- for (i = 0; i < args_cbk->fop_length; i++) {
- op_ret = server_populate_compound_response (this, &rsp,
- frame,
- args_cbk, i);
-
- if (op_ret) {
- op_errno = op_ret;
- op_ret = -1;
- goto out;
- }
+ if (!rsp.compound_rsp_array.compound_rsp_array_val) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
+
+ for (i = 0; i < args_cbk->fop_length; i++) {
+ op_ret = server_populate_compound_response(this, &rsp, frame, args_cbk,
+ i);
+
+ if (op_ret) {
+ op_errno = op_ret;
+ op_ret = -1;
+ goto out;
}
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfs3_compound_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_compound_rsp);
- server_compound_rsp_cleanup (&rsp, args_cbk);
- GF_FREE (rsp.xdata.xdata_val);
+ server_compound_rsp_cleanup(&rsp, args_cbk);
+ GF_FREE(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
/* Resume function section */
int
-server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_rchecksum_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = EINVAL;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = EINVAL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- STACK_WIND (frame, server_rchecksum_cbk, bound_xl,
- bound_xl->fops->rchecksum, state->fd,
- state->offset, state->size, state->xdata);
+ STACK_WIND(frame, server_rchecksum_cbk, bound_xl, bound_xl->fops->rchecksum,
+ state->fd, state->offset, state->size, state->xdata);
- return 0;
+ return 0;
err:
- server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0,
- NULL, NULL);
-
- return 0;
+ server_rchecksum_cbk(frame, NULL, frame->this, op_ret, op_errno, 0, NULL,
+ NULL);
+ return 0;
}
int
-server_lease_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_lease_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_lease_cbk, bound_xl, bound_xl->fops->lease,
- &state->loc, &state->lease, state->xdata);
+ STACK_WIND(frame, server_lease_cbk, bound_xl, bound_xl->fops->lease,
+ &state->loc, &state->lease, state->xdata);
- return 0;
+ return 0;
err:
- server_lease_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_lease_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_lk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_lk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_lk_cbk, bound_xl, bound_xl->fops->lk,
- state->fd, state->cmd, &state->flock, state->xdata);
+ STACK_WIND(frame, server_lk_cbk, bound_xl, bound_xl->fops->lk, state->fd,
+ state->cmd, &state->flock, state->xdata);
- return 0;
+ return 0;
err:
- server_lk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_lk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_rename_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_rename_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = 0;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- if (state->resolve2.op_ret != 0) {
- op_ret = state->resolve2.op_ret;
- op_errno = state->resolve2.op_errno;
- goto err;
- }
+ if (state->resolve2.op_ret != 0) {
+ op_ret = state->resolve2.op_ret;
+ op_errno = state->resolve2.op_errno;
+ goto err;
+ }
- STACK_WIND (frame, server_rename_cbk,
- bound_xl, bound_xl->fops->rename,
- &state->loc, &state->loc2, state->xdata);
- return 0;
+ STACK_WIND(frame, server_rename_cbk, bound_xl, bound_xl->fops->rename,
+ &state->loc, &state->loc2, state->xdata);
+ return 0;
err:
- server_rename_cbk (frame, NULL, frame->this, op_ret, op_errno,
- NULL, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server_rename_cbk(frame, NULL, frame->this, op_ret, op_errno, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_link_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_link_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = 0;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- if (state->resolve2.op_ret != 0) {
- op_ret = state->resolve2.op_ret;
- op_errno = state->resolve2.op_errno;
- goto err;
- }
+ if (state->resolve2.op_ret != 0) {
+ op_ret = state->resolve2.op_ret;
+ op_errno = state->resolve2.op_errno;
+ goto err;
+ }
- state->loc2.inode = inode_ref (state->loc.inode);
+ state->loc2.inode = inode_ref(state->loc.inode);
- STACK_WIND (frame, server_link_cbk, bound_xl, bound_xl->fops->link,
- &state->loc, &state->loc2, state->xdata);
+ STACK_WIND(frame, server_link_cbk, bound_xl, bound_xl->fops->link,
+ &state->loc, &state->loc2, state->xdata);
- return 0;
+ return 0;
err:
- server_link_cbk (frame, NULL, frame->this, op_ret, op_errno,
- NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server_link_cbk(frame, NULL, frame->this, op_ret, op_errno, NULL, NULL,
+ NULL, NULL, NULL);
+ return 0;
}
int
-server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_symlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server_symlink_cbk,
- bound_xl, bound_xl->fops->symlink,
- state->name, &state->loc, state->umask, state->xdata);
+ STACK_WIND(frame, server_symlink_cbk, bound_xl, bound_xl->fops->symlink,
+ state->name, &state->loc, state->umask, state->xdata);
- return 0;
+ return 0;
err:
- server_symlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server_symlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_access_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_access_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_access_cbk,
- bound_xl, bound_xl->fops->access,
- &state->loc, state->mask, state->xdata);
- return 0;
+ STACK_WIND(frame, server_access_cbk, bound_xl, bound_xl->fops->access,
+ &state->loc, state->mask, state->xdata);
+ return 0;
err:
- server_access_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_access_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fentrylk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server_fentrylk_cbk, bound_xl,
- bound_xl->fops->fentrylk,
- state->volume, state->fd, state->name,
- state->cmd, state->type, state->xdata);
+ STACK_WIND(frame, server_fentrylk_cbk, bound_xl, bound_xl->fops->fentrylk,
+ state->volume, state->fd, state->name, state->cmd, state->type,
+ state->xdata);
- return 0;
+ return 0;
err:
- server_fentrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_fentrylk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_entrylk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server_entrylk_cbk,
- bound_xl, bound_xl->fops->entrylk,
- state->volume, &state->loc, state->name,
- state->cmd, state->type, state->xdata);
- return 0;
+ STACK_WIND(frame, server_entrylk_cbk, bound_xl, bound_xl->fops->entrylk,
+ state->volume, &state->loc, state->name, state->cmd, state->type,
+ state->xdata);
+ return 0;
err:
- server_entrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_entrylk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_finodelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
- bound_xl);
+ gf_msg_debug(bound_xl->name, 0, "frame %p, xlator %p", frame, bound_xl);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server_finodelk_cbk, bound_xl,
- bound_xl->fops->finodelk, state->volume, state->fd,
- state->cmd, &state->flock, state->xdata);
+ STACK_WIND(frame, server_finodelk_cbk, bound_xl, bound_xl->fops->finodelk,
+ state->volume, state->fd, state->cmd, &state->flock,
+ state->xdata);
- return 0;
+ return 0;
err:
- server_finodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server_finodelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
int
-server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_inodelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
- bound_xl);
+ gf_msg_debug(bound_xl->name, 0, "frame %p, xlator %p", frame, bound_xl);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server_inodelk_cbk, bound_xl,
- bound_xl->fops->inodelk, state->volume, &state->loc,
- state->cmd, &state->flock, state->xdata);
- return 0;
+ STACK_WIND(frame, server_inodelk_cbk, bound_xl, bound_xl->fops->inodelk,
+ state->volume, &state->loc, state->cmd, &state->flock,
+ state->xdata);
+ return 0;
err:
- server_inodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_inodelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_rmdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_rmdir_cbk, bound_xl, bound_xl->fops->rmdir,
- &state->loc, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_rmdir_cbk, bound_xl, bound_xl->fops->rmdir,
+ &state->loc, state->flags, state->xdata);
+ return 0;
err:
- server_rmdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server_rmdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
int
-server_mkdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_mkdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server_mkdir_cbk,
- bound_xl, bound_xl->fops->mkdir,
- &(state->loc), state->mode, state->umask, state->xdata);
+ STACK_WIND(frame, server_mkdir_cbk, bound_xl, bound_xl->fops->mkdir,
+ &(state->loc), state->mode, state->umask, state->xdata);
- return 0;
+ return 0;
err:
- server_mkdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server_mkdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_mknod_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_mknod_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server_mknod_cbk,
- bound_xl, bound_xl->fops->mknod,
- &(state->loc), state->mode, state->dev,
- state->umask, state->xdata);
+ STACK_WIND(frame, server_mknod_cbk, bound_xl, bound_xl->fops->mknod,
+ &(state->loc), state->mode, state->dev, state->umask,
+ state->xdata);
- return 0;
+ return 0;
err:
- server_mknod_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server_mknod_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_fsyncdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fsyncdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fsyncdir_cbk,
- bound_xl,
- bound_xl->fops->fsyncdir,
- state->fd, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fsyncdir_cbk, bound_xl, bound_xl->fops->fsyncdir,
+ state->fd, state->flags, state->xdata);
+ return 0;
err:
- server_fsyncdir_cbk (frame, NULL, frame->this,
- state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_fsyncdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server_readdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_readdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- GF_ASSERT (state->fd);
+ GF_ASSERT(state->fd);
- STACK_WIND (frame, server_readdir_cbk,
- bound_xl,
- bound_xl->fops->readdir,
- state->fd, state->size, state->offset, state->xdata);
+ STACK_WIND(frame, server_readdir_cbk, bound_xl, bound_xl->fops->readdir,
+ state->fd, state->size, state->offset, state->xdata);
- return 0;
+ return 0;
err:
- server_readdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_readdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_readdirp_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_readdirp_cbk, bound_xl,
- bound_xl->fops->readdirp, state->fd, state->size,
- state->offset, state->dict);
+ STACK_WIND(frame, server_readdirp_cbk, bound_xl, bound_xl->fops->readdirp,
+ state->fd, state->size, state->offset, state->dict);
- return 0;
+ return 0;
err:
- server_readdirp_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_readdirp_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_opendir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto err;
- }
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
+ goto err;
+ }
- STACK_WIND (frame, server_opendir_cbk,
- bound_xl, bound_xl->fops->opendir,
- &state->loc, state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server_opendir_cbk, bound_xl, bound_xl->fops->opendir,
+ &state->loc, state->fd, state->xdata);
+ return 0;
err:
- server_opendir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_opendir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_statfs_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_statfs_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret !=0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_statfs_cbk,
- bound_xl, bound_xl->fops->statfs,
- &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server_statfs_cbk, bound_xl, bound_xl->fops->statfs,
+ &state->loc, state->xdata);
+ return 0;
err:
- server_statfs_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_statfs_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_removexattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_removexattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_removexattr_cbk,
- bound_xl, bound_xl->fops->removexattr,
- &state->loc, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server_removexattr_cbk, bound_xl,
+ bound_xl->fops->removexattr, &state->loc, state->name,
+ state->xdata);
+ return 0;
err:
- server_removexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_removexattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server_fremovexattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fremovexattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fremovexattr_cbk,
- bound_xl, bound_xl->fops->fremovexattr,
- state->fd, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fremovexattr_cbk, bound_xl,
+ bound_xl->fops->fremovexattr, state->fd, state->name,
+ state->xdata);
+ return 0;
err:
- server_fremovexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server_fremovexattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fgetxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fgetxattr_cbk,
- bound_xl, bound_xl->fops->fgetxattr,
- state->fd, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fgetxattr_cbk, bound_xl, bound_xl->fops->fgetxattr,
+ state->fd, state->name, state->xdata);
+ return 0;
err:
- server_fgetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_fgetxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_xattrop_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_xattrop_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_xattrop_cbk,
- bound_xl, bound_xl->fops->xattrop,
- &state->loc, state->flags, state->dict, state->xdata);
- return 0;
+ STACK_WIND(frame, server_xattrop_cbk, bound_xl, bound_xl->fops->xattrop,
+ &state->loc, state->flags, state->dict, state->xdata);
+ return 0;
err:
- server_xattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_xattrop_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_fxattrop_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fxattrop_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fxattrop_cbk,
- bound_xl, bound_xl->fops->fxattrop,
- state->fd, state->flags, state->dict, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fxattrop_cbk, bound_xl, bound_xl->fops->fxattrop,
+ state->fd, state->flags, state->dict, state->xdata);
+ return 0;
err:
- server_fxattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_fxattrop_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_fsetxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fsetxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_setxattr_cbk,
- bound_xl, bound_xl->fops->fsetxattr,
- state->fd, state->dict, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_setxattr_cbk, bound_xl, bound_xl->fops->fsetxattr,
+ state->fd, state->dict, state->flags, state->xdata);
+ return 0;
err:
- server_fsetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server_fsetxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
int
-server_unlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_unlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_unlink_cbk,
- bound_xl, bound_xl->fops->unlink,
- &state->loc, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_unlink_cbk, bound_xl, bound_xl->fops->unlink,
+ &state->loc, state->flags, state->xdata);
+ return 0;
err:
- server_unlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server_unlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
int
-server_truncate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_truncate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_truncate_cbk,
- bound_xl, bound_xl->fops->truncate,
- &state->loc, state->offset, state->xdata);
- return 0;
+ STACK_WIND(frame, server_truncate_cbk, bound_xl, bound_xl->fops->truncate,
+ &state->loc, state->offset, state->xdata);
+ return 0;
err:
- server_truncate_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server_truncate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
-
int
-server_fstat_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fstat_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fstat_cbk,
- bound_xl, bound_xl->fops->fstat,
- state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fstat_cbk, bound_xl, bound_xl->fops->fstat,
+ state->fd, state->xdata);
+ return 0;
err:
- server_fstat_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_fstat_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_setxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_setxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_setxattr_cbk,
- bound_xl, bound_xl->fops->setxattr,
- &state->loc, state->dict, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_setxattr_cbk, bound_xl, bound_xl->fops->setxattr,
+ &state->loc, state->dict, state->flags, state->xdata);
+ return 0;
err:
- server_setxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server_setxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
-
int
-server_getxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_getxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_getxattr_cbk,
- bound_xl, bound_xl->fops->getxattr,
- &state->loc, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server_getxattr_cbk, bound_xl, bound_xl->fops->getxattr,
+ &state->loc, state->name, state->xdata);
+ return 0;
err:
- server_getxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_getxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_ftruncate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_ftruncate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_ftruncate_cbk,
- bound_xl, bound_xl->fops->ftruncate,
- state->fd, state->offset, state->xdata);
- return 0;
+ STACK_WIND(frame, server_ftruncate_cbk, bound_xl, bound_xl->fops->ftruncate,
+ state->fd, state->offset, state->xdata);
+ return 0;
err:
- server_ftruncate_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_ftruncate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server_flush_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_flush_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_flush_cbk,
- bound_xl, bound_xl->fops->flush, state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server_flush_cbk, bound_xl, bound_xl->fops->flush,
+ state->fd, state->xdata);
+ return 0;
err:
- server_flush_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server_flush_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
-
int
-server_fsync_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fsync_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fsync_cbk,
- bound_xl, bound_xl->fops->fsync,
- state->fd, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fsync_cbk, bound_xl, bound_xl->fops->fsync,
+ state->fd, state->flags, state->xdata);
+ return 0;
err:
- server_fsync_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_fsync_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server_writev_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_writev_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_writev_cbk,
- bound_xl, bound_xl->fops->writev,
- state->fd, state->payload_vector, state->payload_count,
- state->offset, state->flags, state->iobref, state->xdata);
+ STACK_WIND(frame, server_writev_cbk, bound_xl, bound_xl->fops->writev,
+ state->fd, state->payload_vector, state->payload_count,
+ state->offset, state->flags, state->iobref, state->xdata);
- return 0;
+ return 0;
err:
- server_writev_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server_writev_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_readv_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_readv_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_readv_cbk,
- bound_xl, bound_xl->fops->readv,
- state->fd, state->size, state->offset, state->flags, state->xdata);
+ STACK_WIND(frame, server_readv_cbk, bound_xl, bound_xl->fops->readv,
+ state->fd, state->size, state->offset, state->flags,
+ state->xdata);
- return 0;
+ return 0;
err:
- server_readv_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, 0, NULL, NULL, NULL);
- return 0;
+ server_readv_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, 0, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_create_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_create_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ?
- uuid_utoa (state->loc.inode->gfid):NULL);
- state->resolve.op_ret = -1;
- state->resolve.op_errno = ENOMEM;
- goto err;
- }
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ? uuid_utoa(state->loc.inode->gfid) : NULL);
+ state->resolve.op_ret = -1;
+ state->resolve.op_errno = ENOMEM;
+ goto err;
+ }
+ state->fd->flags = state->flags;
- STACK_WIND (frame, server_create_cbk,
- bound_xl, bound_xl->fops->create,
- &(state->loc), state->flags, state->mode,
- state->umask, state->fd, state->xdata);
+ STACK_WIND(frame, server_create_cbk, bound_xl, bound_xl->fops->create,
+ &(state->loc), state->flags, state->mode, state->umask,
+ state->fd, state->xdata);
- return 0;
+ return 0;
err:
- server_create_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
- return 0;
+ server_create_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ return 0;
}
-
int
-server_open_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_open_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ state->fd->flags = state->flags;
- STACK_WIND (frame, server_open_cbk,
- bound_xl, bound_xl->fops->open,
- &state->loc, state->flags, state->fd, state->xdata);
+ STACK_WIND(frame, server_open_cbk, bound_xl, bound_xl->fops->open,
+ &state->loc, state->flags, state->fd, state->xdata);
- return 0;
+ return 0;
err:
- server_open_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_open_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server_readlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_readlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_readlink_cbk,
- bound_xl, bound_xl->fops->readlink,
- &state->loc, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server_readlink_cbk, bound_xl, bound_xl->fops->readlink,
+ &state->loc, state->size, state->xdata);
+ return 0;
err:
- server_readlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server_readlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int
-server_fsetattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fsetattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fsetattr_cbk,
- bound_xl, bound_xl->fops->fsetattr,
- state->fd, &state->stbuf, state->valid, state->xdata);
- return 0;
+ STACK_WIND(frame, server_fsetattr_cbk, bound_xl, bound_xl->fops->fsetattr,
+ state->fd, &state->stbuf, state->valid, state->xdata);
+ return 0;
err:
- server_fsetattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_fsetattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server_setattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_setattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_setattr_cbk,
- bound_xl, bound_xl->fops->setattr,
- &state->loc, &state->stbuf, state->valid, state->xdata);
- return 0;
+ STACK_WIND(frame, server_setattr_cbk, bound_xl, bound_xl->fops->setattr,
+ &state->loc, &state->stbuf, state->valid, state->xdata);
+ return 0;
err:
- server_setattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_setattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server_stat_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_stat_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_stat_cbk,
- bound_xl, bound_xl->fops->stat, &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server_stat_cbk, bound_xl, bound_xl->fops->stat,
+ &state->loc, state->xdata);
+ return 0;
err:
- server_stat_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server_stat_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_lookup_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_lookup_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->loc.inode)
- state->loc.inode = server_inode_new (state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
+ if (!state->loc.inode)
+ state->loc.inode = server_inode_new(state->itable, state->loc.gfid);
+ else
+ state->is_revalidate = 1;
- STACK_WIND (frame, server_lookup_cbk,
- bound_xl, bound_xl->fops->lookup,
- &state->loc, state->xdata);
+ STACK_WIND(frame, server_lookup_cbk, bound_xl, bound_xl->fops->lookup,
+ &state->loc, state->xdata);
- return 0;
+ return 0;
err:
- server_lookup_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL);
+ server_lookup_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server_fallocate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_fallocate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_fallocate_cbk,
- bound_xl, bound_xl->fops->fallocate,
- state->fd, state->flags, state->offset, state->size,
- state->xdata);
- return 0;
+ STACK_WIND(frame, server_fallocate_cbk, bound_xl, bound_xl->fops->fallocate,
+ state->fd, state->flags, state->offset, state->size,
+ state->xdata);
+ return 0;
err:
- server_fallocate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_fallocate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server_discard_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_discard_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_discard_cbk,
- bound_xl, bound_xl->fops->discard,
- state->fd, state->offset, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server_discard_cbk, bound_xl, bound_xl->fops->discard,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
err:
- server_discard_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_discard_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server_zerofill_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_zerofill_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_zerofill_cbk,
- bound_xl, bound_xl->fops->zerofill,
- state->fd, state->offset, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server_zerofill_cbk, bound_xl, bound_xl->fops->zerofill,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
err:
- server_zerofill_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server_zerofill_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server_seek_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_seek_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_seek_cbk, bound_xl, bound_xl->fops->seek,
- state->fd, state->offset, state->what, state->xdata);
- return 0;
+ STACK_WIND(frame, server_seek_cbk, bound_xl, bound_xl->fops->seek,
+ state->fd, state->offset, state->what, state->xdata);
+ return 0;
err:
- server_seek_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, 0, NULL);
+ server_seek_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, 0, NULL);
- return 0;
+ return 0;
}
static int
-server_getactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- lock_migration_info_t *locklist, dict_t *xdata)
-{
- gfs3_getactivelk_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
-
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, 0,
- "%"PRId64": GETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
-
- goto out;
- }
-
- /* (op_ret == 0) means there are no locks on the file*/
- if (op_ret > 0) {
- ret = serialize_rsp_locklist (locklist, &rsp);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- }
+server_getactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ lock_migration_info_t *locklist, dict_t *xdata)
+{
+ gfs3_getactivelk_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+
+ gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
+ "%" PRId64
+ ": GETACTIVELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+
+ goto out;
+ }
+
+ /* (op_ret == 0) means there are no locks on the file*/
+ if (op_ret > 0) {
+ ret = serialize_rsp_locklist(locklist, &rsp);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
+ req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_getactivelk_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_getactivelk_rsp);
- GF_FREE (rsp.xdata.xdata_val);
+ GF_FREE(rsp.xdata.xdata_val);
- getactivelkinfo_rsp_cleanup (&rsp);
+ getactivelkinfo_rsp_cleanup(&rsp);
- return 0;
+ return 0;
}
int
-server_getactivelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_getactivelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_getactivelk_cbk, bound_xl,
- bound_xl->fops->getactivelk, &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server_getactivelk_cbk, bound_xl,
+ bound_xl->fops->getactivelk, &state->loc, state->xdata);
+ return 0;
err:
- server_getactivelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
-
+ server_getactivelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server_setactivelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_setactivelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server_setactivelk_cbk,
- bound_xl, bound_xl->fops->setactivelk, &state->loc,
- &state->locklist, state->xdata);
- return 0;
+ STACK_WIND(frame, server_setactivelk_cbk, bound_xl,
+ bound_xl->fops->setactivelk, &state->loc, &state->locklist,
+ state->xdata);
+ return 0;
err:
- server_setactivelk_cbk (frame, NULL, frame->this,
- state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
-
+ server_setactivelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server_compound_resume (call_frame_t *frame, xlator_t *bound_xl)
+server_compound_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- gfs3_compound_req *req = NULL;
- compound_args_t *args = NULL;
- int i = 0;
- int ret = -1;
- int length = 0;
- int op_errno = ENOMEM;
- compound_req *c_req = NULL;
+ server_state_t *state = NULL;
+ gfs3_compound_req *req = NULL;
+ compound_args_t *args = NULL;
+ int i = 0;
+ int ret = -1;
+ int length = 0;
+ int op_errno = ENOMEM;
+ compound_req *c_req = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- req = &state->req;
+ req = &state->req;
- length = req->compound_req_array.compound_req_array_len;
- state->args = compound_fop_alloc (length, req->compound_fop_enum,
- state->xdata);
- args = state->args;
+ length = req->compound_req_array.compound_req_array_len;
+ state->args = compound_fop_alloc(length, req->compound_fop_enum,
+ state->xdata);
+ args = state->args;
- if (!args)
- goto err;
+ if (!args)
+ goto err;
- for (i = 0; i < length; i++) {
- c_req = &req->compound_req_array.compound_req_array_val[i];
- args->enum_list[i] = c_req->fop_enum;
+ for (i = 0; i < length; i++) {
+ c_req = &req->compound_req_array.compound_req_array_val[i];
+ args->enum_list[i] = c_req->fop_enum;
- ret = server_populate_compound_request (req, frame,
- &args->req_list[i],
- i);
+ ret = server_populate_compound_request(req, frame, &args->req_list[i],
+ i);
- if (ret) {
- op_errno = ret;
- ret = -1;
- goto err;
- }
+ if (ret) {
+ op_errno = ret;
+ ret = -1;
+ goto err;
}
+ }
- STACK_WIND (frame, server_compound_cbk,
- bound_xl, bound_xl->fops->compound,
- args, state->xdata);
+ STACK_WIND(frame, server_compound_cbk, bound_xl, bound_xl->fops->compound,
+ args, state->xdata);
- return 0;
+ return 0;
err:
- server_compound_cbk (frame, NULL, frame->this, ret, op_errno,
- NULL, NULL);
+ server_compound_cbk(frame, NULL, frame->this, ret, op_errno, NULL, NULL);
- return ret;
+ return ret;
}
/* Fop section */
int
-rpc_receive_common (rpcsvc_request_t *req, call_frame_t **fr,
- server_state_t **st, ssize_t *xdrlen, void *args,
- void *xdrfn, glusterfs_fop_t fop)
-{
- int ret = -1;
- ssize_t len = 0;
-
- len = xdr_to_generic (req->msg[0], args, (xdrproc_t)xdrfn);
- if (len < 0) {
- /* failed to decode msg; */
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- /* Few fops use the xdr size to get the vector sizes */
- if (xdrlen)
- *xdrlen = len;
-
- *fr = get_frame_from_request (req);
- if (!(*fr)) {
- /* something wrong, mostly no memory */
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
- (*fr)->root->op = fop;
-
- *st = CALL_STATE ((*fr));
- if (!(*fr)->root->client->bound_xl) {
- /* auth failure, mostly setvolume is not successful */
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- if (!(*fr)->root->client->bound_xl->itable) {
- /* inode_table is not allocated successful in server_setvolume */
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- ret = 0;
+rpc_receive_common(rpcsvc_request_t *req, call_frame_t **fr,
+ server_state_t **st, ssize_t *xdrlen, void *args,
+ void *xdrfn, glusterfs_fop_t fop)
+{
+ int ret = -1;
+ ssize_t len = 0;
+
+ len = xdr_to_generic(req->msg[0], args, (xdrproc_t)xdrfn);
+ if (len < 0) {
+ /* failed to decode msg; */
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ /* Few fops use the xdr size to get the vector sizes */
+ if (xdrlen)
+ *xdrlen = len;
+
+ *fr = get_frame_from_request(req);
+ if (!(*fr)) {
+ /* something wrong, mostly no memory */
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+ (*fr)->root->op = fop;
+
+ *st = CALL_STATE((*fr));
+ if (!(*fr)->root->client->bound_xl) {
+ /* auth failure, mostly setvolume is not successful */
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ if (!(*fr)->root->client->bound_xl->itable) {
+ /* inode_table is not allocated successful in server_setvolume */
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
int
-server3_3_stat (rpcsvc_request_t *req)
+server3_3_stat(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_stat_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_stat_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- /* Initialize args first, then decode */
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_stat_req, GF_FOP_STAT);
- if (ret != 0) {
- goto out;
- }
+ if (!req)
+ return 0;
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ /* Initialize args first, then decode */
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_stat_req, GF_FOP_STAT);
+ if (ret != 0) {
+ goto out;
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_stat_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_stat_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_setattr (rpcsvc_request_t *req)
+server3_3_setattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_setattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_setattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return 0;
+ if (!req)
+ return 0;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_setattr_req, GF_FOP_SETATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_setattr_req, GF_FOP_SETATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- gf_stat_to_iatt (&args.stbuf, &state->stbuf);
- state->valid = args.valid;
+ gf_stat_to_iatt(&args.stbuf, &state->stbuf);
+ state->valid = args.valid;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_setattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_setattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- return ret;
+ return ret;
}
-
int
-server3_3_fsetattr (rpcsvc_request_t *req)
+server3_3_fsetattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fsetattr_req args = {0,};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fsetattr_req args = {
+ 0,
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fsetattr_req, GF_FOP_FSETATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fsetattr_req, GF_FOP_FSETATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- gf_stat_to_iatt (&args.stbuf, &state->stbuf);
- state->valid = args.valid;
+ gf_stat_to_iatt(&args.stbuf, &state->stbuf);
+ state->valid = args.valid;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fsetattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fsetattr_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
server3_3_fallocate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fallocate_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fallocate_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fallocate_req, GF_FOP_FALLOCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fallocate_req, GF_FOP_FALLOCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->flags = args.flags;
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fallocate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fallocate_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
server3_3_discard(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_discard_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_discard_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_discard_req, GF_FOP_DISCARD);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_discard_req, GF_FOP_DISCARD);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_discard_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_discard_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
server3_3_zerofill(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_zerofill_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_zerofill_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_zerofill_req, GF_FOP_ZEROFILL);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_zerofill_req, GF_FOP_ZEROFILL);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ (args.xdata.xdata_val), (args.xdata.xdata_len),
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_zerofill_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_zerofill_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ if (op_errno)
+ req->rpc_err = GARBAGE_ARGS;
- return ret;
+ return ret;
}
int
-server3_3_ipc (rpcsvc_request_t *req)
+server3_3_ipc(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_ipc_req args = {0,};
- int ret = -1;
- int op_errno = 0;
- xlator_t *bound_xl = NULL;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_ipc_req args = {
+ 0,
+ };
+ int ret = -1;
+ int op_errno = 0;
+ xlator_t *bound_xl = NULL;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_ipc_req, GF_FOP_IPC);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfs3_ipc_req,
+ GF_FOP_IPC);
+ if (ret != 0) {
+ goto out;
+ }
- bound_xl = frame->root->client->bound_xl;
- GF_PROTOCOL_DICT_UNSERIALIZE (bound_xl, state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len,
- ret, op_errno, out);
+ bound_xl = frame->root->client->bound_xl;
+ GF_PROTOCOL_DICT_UNSERIALIZE(bound_xl, state->xdata, args.xdata.xdata_val,
+ args.xdata.xdata_len, ret, op_errno, out);
- ret = 0;
- STACK_WIND (frame, server_ipc_cbk, bound_xl, bound_xl->fops->ipc,
- args.op, state->xdata);
+ ret = 0;
+ STACK_WIND(frame, server_ipc_cbk, bound_xl, bound_xl->fops->ipc, args.op,
+ state->xdata);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ if (op_errno)
+ req->rpc_err = GARBAGE_ARGS;
- return ret;
+ return ret;
}
int
-server3_3_seek (rpcsvc_request_t *req)
+server3_3_seek(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_seek_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
- xlator_t *bound_xl = NULL;
-
- if (!req)
- return ret;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_seek_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
+ xlator_t *bound_xl = NULL;
+
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_seek_req, GF_FOP_SEEK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_seek_req, GF_FOP_SEEK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->what = args.what;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->what = args.what;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- bound_xl = frame->root->client->bound_xl;
- GF_PROTOCOL_DICT_UNSERIALIZE (bound_xl, state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len,
- ret, op_errno, out);
+ bound_xl = frame->root->client->bound_xl;
+ GF_PROTOCOL_DICT_UNSERIALIZE(bound_xl, state->xdata, args.xdata.xdata_val,
+ args.xdata.xdata_len, ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_seek_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_seek_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_readlink (rpcsvc_request_t *req)
+server3_3_readlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_readlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_readlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_readlink_req, GF_FOP_READLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_readlink_req, GF_FOP_READLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->size = args.size;
+ state->size = args.size;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_readlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_readlink_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_create (rpcsvc_request_t *req)
+server3_3_create(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_create_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_create_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_create_req, GF_FOP_CREATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_create_req, GF_FOP_CREATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.bname = gf_strdup (args.bname);
- state->mode = args.mode;
- state->umask = args.umask;
- state->flags = gf_flags_to_flags (args.flags);
+ state->resolve.bname = gf_strdup(args.bname);
+ state->mode = args.mode;
+ state->umask = args.umask;
+ state->flags = gf_flags_to_flags(args.flags);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
- /* TODO: can do alloca for xdata field instead of stdalloc */
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ /* TODO: can do alloca for xdata field instead of stdalloc */
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_create_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_create_resume);
out:
- /* memory allocated by libc, don't use GF_FREE */
- free (args.xdata.xdata_val);
- free (args.bname);
+ /* memory allocated by libc, don't use GF_FREE */
+ free(args.xdata.xdata_val);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_open (rpcsvc_request_t *req)
+server3_3_open(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_open_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_open_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_open_req, GF_FOP_OPEN);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_open_req, GF_FOP_OPEN);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->flags = gf_flags_to_flags (args.flags);
+ state->flags = gf_flags_to_flags(args.flags);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_open_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_open_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- return ret;
+ return ret;
}
-
int
-server3_3_readv (rpcsvc_request_t *req)
+server3_3_readv(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_read_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- goto out;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_read_req, GF_FOP_READ);
- if (ret != 0) {
- goto out;
- }
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->size = args.size;
- state->offset = args.offset;
- state->flags = args.flag;
-
- memcpy (state->resolve.gfid, args.gfid, 16);
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
-
- ret = 0;
- resolve_and_resume (frame, server_readv_resume);
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_read_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ goto out;
+
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_read_req, GF_FOP_READ);
+ if (ret != 0) {
+ goto out;
+ }
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->size = args.size;
+ state->offset = args.offset;
+ state->flags = args.flag;
+
+ memcpy(state->resolve.gfid, args.gfid, 16);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
+
+ ret = 0;
+ resolve_and_resume(frame, server_readv_resume);
out:
- /* memory allocated by libc, don't use GF_FREE */
- free (args.xdata.xdata_val);
+ /* memory allocated by libc, don't use GF_FREE */
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_writev (rpcsvc_request_t *req)
+server3_3_writev(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_write_req args = {{0,},};
- ssize_t len = 0;
- int i = 0;
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_write_req args = {
+ {
+ 0,
+ },
+ };
+ ssize_t len = 0;
+ int i = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- if (!req)
- return ret;
+ ret = rpc_receive_common(req, &frame, &state, &len, &args,
+ xdr_gfs3_write_req, GF_FOP_WRITE);
+ if (ret != 0) {
+ goto out;
+ }
- ret = rpc_receive_common (req, &frame, &state, &len, &args,
- xdr_gfs3_write_req, GF_FOP_WRITE);
- if (ret != 0) {
- goto out;
- }
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ state->size = args.size;
+ state->flags = args.flag;
+ state->iobref = iobref_ref(req->iobref);
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- state->flags = args.flag;
- state->iobref = iobref_ref (req->iobref);
- memcpy (state->resolve.gfid, args.gfid, 16);
-
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base
- = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len
- = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
+ if (len < req->msg[0].iov_len) {
+ state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
+ state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
+ state->payload_count = 1;
+ }
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++]
- = req->msg[i];
- }
+ for (i = 1; i < req->count; i++) {
+ state->payload_vector[state->payload_count++] = req->msg[i];
+ }
- len = iov_length (state->payload_vector, state->payload_count);
+ len = iov_length(state->payload_vector, state->payload_count);
- GF_ASSERT (state->size == len);
+ GF_ASSERT(state->size == len);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (state->xdata);
+ dict_dump_to_log(state->xdata);
#endif
- ret = 0;
- resolve_and_resume (frame, server_writev_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_writev_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
#define SERVER3_3_VECWRITE_START 0
#define SERVER3_3_VECWRITE_READING_HDR 1
#define SERVER3_3_VECWRITE_READING_OPAQUE 2
int
-server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
- char *curr_addr)
+server3_3_writev_vecsizer(int state, ssize_t *readsize, char *base_addr,
+ char *curr_addr)
{
- ssize_t size = 0;
- int nextstate = 0;
- gfs3_write_req write_req = {{0,},};
- XDR xdr;
+ ssize_t size = 0;
+ int nextstate = 0;
+ gfs3_write_req write_req = {
+ {
+ 0,
+ },
+ };
+ XDR xdr;
- switch (state) {
+ switch (state) {
case SERVER3_3_VECWRITE_START:
- size = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req,
- &write_req);
- *readsize = size;
- nextstate = SERVER3_3_VECWRITE_READING_HDR;
- break;
+ size = xdr_sizeof((xdrproc_t)xdr_gfs3_write_req, &write_req);
+ *readsize = size;
+ nextstate = SERVER3_3_VECWRITE_READING_HDR;
+ break;
case SERVER3_3_VECWRITE_READING_HDR:
- size = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req,
- &write_req);
+ size = xdr_sizeof((xdrproc_t)xdr_gfs3_write_req, &write_req);
- xdrmem_create (&xdr, base_addr, size, XDR_DECODE);
+ xdrmem_create(&xdr, base_addr, size, XDR_DECODE);
- /* This will fail if there is xdata sent from client, if not,
- well and good */
- xdr_gfs3_write_req (&xdr, &write_req);
+ /* This will fail if there is xdata sent from client, if not,
+ well and good */
+ xdr_gfs3_write_req(&xdr, &write_req);
- /* need to round off to proper roof (%4), as XDR packing pads
- the end of opaque object with '0' */
- size = roof (write_req.xdata.xdata_len, 4);
+ /* need to round off to proper roof (%4), as XDR packing pads
+ the end of opaque object with '0' */
+ size = roof(write_req.xdata.xdata_len, 4);
- *readsize = size;
+ *readsize = size;
- if (!size)
- nextstate = SERVER3_3_VECWRITE_START;
- else
- nextstate = SERVER3_3_VECWRITE_READING_OPAQUE;
+ if (!size)
+ nextstate = SERVER3_3_VECWRITE_START;
+ else
+ nextstate = SERVER3_3_VECWRITE_READING_OPAQUE;
- free (write_req.xdata.xdata_val);
+ free(write_req.xdata.xdata_val);
- break;
+ break;
case SERVER3_3_VECWRITE_READING_OPAQUE:
- *readsize = 0;
- nextstate = SERVER3_3_VECWRITE_START;
- break;
+ *readsize = 0;
+ nextstate = SERVER3_3_VECWRITE_START;
+ break;
default:
- gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_WRONG_STATE,
- "wrong state: %d", state);
- }
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_WRONG_STATE,
+ "wrong state: %d", state);
+ }
- return nextstate;
+ return nextstate;
}
-
int
-server3_3_release (rpcsvc_request_t *req)
+server3_3_release(rpcsvc_request_t *req)
{
- client_t *client = NULL;
- server_ctx_t *serv_ctx = NULL;
- gfs3_release_req args = {{0,},};
- gf_common_rsp rsp = {0,};
- int ret = -1;
-
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gfs3_release_req);
- if (ret < 0) {
- //failed to decode msg;
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- client = req->trans->xl_private;
- if (!client) {
- /* Handshake is not complete yet. */
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- serv_ctx = server_ctx_get (client, client->this);
- if (serv_ctx == NULL) {
- gf_msg (req->trans->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- gf_fd_put (serv_ctx->fdtable, args.fd);
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
-
- ret = 0;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfs3_release_req args = {
+ {
+ 0,
+ },
+ };
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = -1;
+
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gfs3_release_req);
+ if (ret < 0) {
+ // failed to decode msg;
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ client = req->trans->xl_private;
+ if (!client) {
+ /* Handshake is not complete yet. */
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ serv_ctx = server_ctx_get(client, client->this);
+ if (serv_ctx == NULL) {
+ gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put(serv_ctx->fdtable, args.fd);
+
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-server3_3_releasedir (rpcsvc_request_t *req)
+server3_3_releasedir(rpcsvc_request_t *req)
{
- client_t *client = NULL;
- server_ctx_t *serv_ctx = NULL;
- gfs3_releasedir_req args = {{0,},};
- gf_common_rsp rsp = {0,};
- int ret = -1;
-
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gfs3_release_req);
- if (ret < 0) {
- //failed to decode msg;
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- client = req->trans->xl_private;
- if (!client) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- serv_ctx = server_ctx_get (client, client->this);
- if (serv_ctx == NULL) {
- gf_msg (req->trans->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- gf_fd_put (serv_ctx->fdtable, args.fd);
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
-
- ret = 0;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfs3_releasedir_req args = {
+ {
+ 0,
+ },
+ };
+ gf_common_rsp rsp = {
+ 0,
+ };
+ int ret = -1;
+
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gfs3_release_req);
+ if (ret < 0) {
+ // failed to decode msg;
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ client = req->trans->xl_private;
+ if (!client) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ serv_ctx = server_ctx_get(client, client->this);
+ if (serv_ctx == NULL) {
+ gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put(serv_ctx->fdtable, args.fd);
+
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
int
-server3_3_fsync (rpcsvc_request_t *req)
+server3_3_fsync(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fsync_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fsync_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fsync_req, GF_FOP_FSYNC);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fsync_req, GF_FOP_FSYNC);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.data;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.data;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fsync_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fsync_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_flush (rpcsvc_request_t *req)
+server3_3_flush(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_flush_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_flush_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_flush_req, GF_FOP_FLUSH);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_flush_req, GF_FOP_FLUSH);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_flush_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_flush_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_ftruncate (rpcsvc_request_t *req)
+server3_3_ftruncate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_ftruncate_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_ftruncate_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_ftruncate_req, GF_FOP_FTRUNCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_ftruncate_req, GF_FOP_FTRUNCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_ftruncate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_ftruncate_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_fstat (rpcsvc_request_t *req)
+server3_3_fstat(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fstat_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fstat_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fstat_req, GF_FOP_FSTAT);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fstat_req, GF_FOP_FSTAT);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fstat_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fstat_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_truncate (rpcsvc_request_t *req)
+server3_3_truncate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_truncate_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_truncate_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_truncate_req, GF_FOP_TRUNCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_truncate_req, GF_FOP_TRUNCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
- state->offset = args.offset;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_truncate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_truncate_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_unlink (rpcsvc_request_t *req)
+server3_3_unlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_unlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_unlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_unlink_req, GF_FOP_UNLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_unlink_req, GF_FOP_UNLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(args.bname);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- state->flags = args.xflags;
+ state->flags = args.xflags;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_unlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_unlink_resume);
out:
- free (args.xdata.xdata_val);
- free (args.bname);
+ free(args.xdata.xdata_val);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_setxattr (rpcsvc_request_t *req)
+server3_3_setxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- dict_t *dict = NULL;
- call_frame_t *frame = NULL;
- gfs3_setxattr_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ dict_t *dict = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_setxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_setxattr_req, GF_FOP_SETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_setxattr_req, GF_FOP_SETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- dict,
- (args.dict.dict_val),
- (args.dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, dict,
+ (args.dict.dict_val), (args.dict.dict_len),
+ ret, op_errno, out);
- state->dict = dict;
+ state->dict = dict;
- /* There can be some commands hidden in key, check and proceed */
- gf_server_check_setxattr_cmd (frame, dict);
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_setxattr_cmd(frame, dict);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_setxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_setxattr_resume);
- /* 'dict' will be destroyed later when 'state' is not needed anymore */
- dict = NULL;
+ /* 'dict' will be destroyed later when 'state' is not needed anymore */
+ dict = NULL;
out:
- free (args.xdata.xdata_val);
- free (args.dict.dict_val);
+ free(args.xdata.xdata_val);
+ free(args.dict.dict_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return ret;
+ return ret;
}
-
-
int
-server3_3_fsetxattr (rpcsvc_request_t *req)
+server3_3_fsetxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- dict_t *dict = NULL;
- call_frame_t *frame = NULL;
- gfs3_fsetxattr_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ dict_t *dict = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fsetxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fsetxattr_req, GF_FOP_FSETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fsetxattr_req, GF_FOP_FSETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- dict,
- (args.dict.dict_val),
- (args.dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, dict,
+ (args.dict.dict_val), (args.dict.dict_len),
+ ret, op_errno, out);
- state->dict = dict;
+ state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fsetxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fsetxattr_resume);
- /* 'dict' will be destroyed later when 'state' is not needed anymore */
- dict = NULL;
+ /* 'dict' will be destroyed later when 'state' is not needed anymore */
+ dict = NULL;
out:
- free (args.xdata.xdata_val);
- free (args.dict.dict_val);
+ free(args.xdata.xdata_val);
+ free(args.dict.dict_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return ret;
+ return ret;
}
-
-
int
-server3_3_fxattrop (rpcsvc_request_t *req)
+server3_3_fxattrop(rpcsvc_request_t *req)
{
- dict_t *dict = NULL;
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fxattrop_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ dict_t *dict = NULL;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fxattrop_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fxattrop_req, GF_FOP_FXATTROP);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fxattrop_req, GF_FOP_FXATTROP);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- dict,
- (args.dict.dict_val),
- (args.dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, dict,
+ (args.dict.dict_val), (args.dict.dict_len),
+ ret, op_errno, out);
- state->dict = dict;
+ state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fxattrop_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fxattrop_resume);
- /* 'dict' will be destroyed later when 'state' is not needed anymore */
- dict = NULL;
+ /* 'dict' will be destroyed later when 'state' is not needed anymore */
+ dict = NULL;
out:
- free (args.xdata.xdata_val);
- free (args.dict.dict_val);
+ free(args.xdata.xdata_val);
+ free(args.dict.dict_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return ret;
+ return ret;
}
-
-
int
-server3_3_xattrop (rpcsvc_request_t *req)
+server3_3_xattrop(rpcsvc_request_t *req)
{
- dict_t *dict = NULL;
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_xattrop_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ dict_t *dict = NULL;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_xattrop_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_xattrop_req, GF_FOP_XATTROP);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_xattrop_req, GF_FOP_XATTROP);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- dict,
- (args.dict.dict_val),
- (args.dict.dict_len), ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, dict,
+ (args.dict.dict_val), (args.dict.dict_len),
+ ret, op_errno, out);
- state->dict = dict;
+ state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_xattrop_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_xattrop_resume);
- /* 'dict' will be destroyed later when 'state' is not needed anymore */
- dict = NULL;
+ /* 'dict' will be destroyed later when 'state' is not needed anymore */
+ dict = NULL;
out:
- free (args.xdata.xdata_val);
- free (args.dict.dict_val);
+ free(args.xdata.xdata_val);
+ free(args.dict.dict_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (dict)
- dict_unref (dict);
+ if (dict)
+ dict_unref(dict);
- return ret;
+ return ret;
}
-
int
-server3_3_getxattr (rpcsvc_request_t *req)
+server3_3_getxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_getxattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_getxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_getxattr_req, GF_FOP_GETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_getxattr_req, GF_FOP_GETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen) {
- state->name = gf_strdup (args.name);
- /* There can be some commands hidden in key, check and proceed */
- gf_server_check_getxattr_cmd (frame, state->name);
- }
+ if (args.namelen) {
+ state->name = gf_strdup(args.name);
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_getxattr_cmd(frame, state->name);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_getxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_getxattr_resume);
out:
- free (args.xdata.xdata_val);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_fgetxattr (rpcsvc_request_t *req)
+server3_3_fgetxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fgetxattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fgetxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fgetxattr_req, GF_FOP_FGETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fgetxattr_req, GF_FOP_FGETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fgetxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fgetxattr_resume);
out:
- free (args.xdata.xdata_val);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_removexattr (rpcsvc_request_t *req)
+server3_3_removexattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_removexattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_removexattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_removexattr_req,
- GF_FOP_REMOVEXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_removexattr_req, GF_FOP_REMOVEXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->name = gf_strdup(args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_removexattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_removexattr_resume);
out:
- free (args.xdata.xdata_val);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_fremovexattr (rpcsvc_request_t *req)
+server3_3_fremovexattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fremovexattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fremovexattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fremovexattr_req,
- GF_FOP_FREMOVEXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fremovexattr_req, GF_FOP_FREMOVEXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->name = gf_strdup(args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fremovexattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fremovexattr_resume);
out:
- free (args.xdata.xdata_val);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
-
int
-server3_3_opendir (rpcsvc_request_t *req)
+server3_3_opendir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_opendir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_opendir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_opendir_req, GF_FOP_OPENDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_opendir_req, GF_FOP_OPENDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_opendir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_opendir_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_readdirp (rpcsvc_request_t *req)
+server3_3_readdirp(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_readdirp_req args = {{0,},};
- size_t headers_size = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_readdirp_req,
- GF_FOP_READDIRP);
- if (ret != 0) {
- goto out;
- }
-
- /* FIXME: this should go away when variable sized iobufs are introduced
- * and transport layer can send msgs bigger than current page-size.
- */
- headers_size = sizeof (struct rpc_msg) + sizeof (gfs3_readdir_rsp);
- if ((frame->this->ctx->page_size < args.size)
- || ((frame->this->ctx->page_size - args.size) < headers_size)) {
- state->size = frame->this->ctx->page_size - headers_size;
- } else {
- state->size = args.size;
- }
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_readdirp_req args = {
+ {
+ 0,
+ },
+ };
+ size_t headers_size = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_readdirp_req, GF_FOP_READDIRP);
+ if (ret != 0) {
+ goto out;
+ }
+
+ /* FIXME: this should go away when variable sized iobufs are introduced
+ * and transport layer can send msgs bigger than current page-size.
+ */
+ headers_size = sizeof(struct rpc_msg) + sizeof(gfs3_readdir_rsp);
+ if ((frame->this->ctx->page_size < args.size) ||
+ ((frame->this->ctx->page_size - args.size) < headers_size)) {
+ state->size = frame->this->ctx->page_size - headers_size;
+ } else {
+ state->size = args.size;
+ }
- /* here, dict itself works as xdata */
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->dict,
- (args.dict.dict_val),
- (args.dict.dict_len), ret,
- op_errno, out);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ /* here, dict itself works as xdata */
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->dict,
+ (args.dict.dict_val), (args.dict.dict_len),
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_readdirp_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_readdirp_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- free (args.dict.dict_val);
+ free(args.dict.dict_val);
- return ret;
+ return ret;
}
int
-server3_3_readdir (rpcsvc_request_t *req)
+server3_3_readdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_readdir_req args = {{0,},};
- size_t headers_size = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_readdir_req, GF_FOP_READDIR);
- if (ret != 0) {
- goto out;
- }
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_readdir_req args = {
+ {
+ 0,
+ },
+ };
+ size_t headers_size = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- /* FIXME: this should go away when variable sized iobufs are introduced
- * and transport layer can send msgs bigger than current page-size.
- */
- headers_size = sizeof (struct rpc_msg) + sizeof (gfs3_readdir_rsp);
- if ((frame->this->ctx->page_size < args.size)
- || ((frame->this->ctx->page_size - args.size) < headers_size)) {
- state->size = frame->this->ctx->page_size - headers_size;
- } else {
- state->size = args.size;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_readdir_req, GF_FOP_READDIR);
+ if (ret != 0) {
+ goto out;
+ }
+
+ /* FIXME: this should go away when variable sized iobufs are introduced
+ * and transport layer can send msgs bigger than current page-size.
+ */
+ headers_size = sizeof(struct rpc_msg) + sizeof(gfs3_readdir_rsp);
+ if ((frame->this->ctx->page_size < args.size) ||
+ ((frame->this->ctx->page_size - args.size) < headers_size)) {
+ state->size = frame->this->ctx->page_size - headers_size;
+ } else {
+ state->size = args.size;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_readdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_readdir_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_fsyncdir (rpcsvc_request_t *req)
+server3_3_fsyncdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fsyncdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fsyncdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fsyncdir_req, GF_FOP_FSYNCDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fsyncdir_req, GF_FOP_FSYNCDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.data;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.data;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fsyncdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fsyncdir_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_mknod (rpcsvc_request_t *req)
+server3_3_mknod(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_mknod_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_mknod_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_mknod_req, GF_FOP_MKNOD);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_mknod_req, GF_FOP_MKNOD);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.bname = gf_strdup(args.bname);
- state->mode = args.mode;
- state->dev = args.dev;
- state->umask = args.umask;
+ state->mode = args.mode;
+ state->dev = args.dev;
+ state->umask = args.umask;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_mknod_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_mknod_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- /* memory allocated by libc, don't use GF_FREE */
- free (args.xdata.xdata_val);
- free (args.bname);
-
- return ret;
+ /* memory allocated by libc, don't use GF_FREE */
+ free(args.xdata.xdata_val);
+ free(args.bname);
+ return ret;
}
-
int
-server3_3_mkdir (rpcsvc_request_t *req)
+server3_3_mkdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_mkdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_mkdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_mkdir_req, GF_FOP_MKDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_mkdir_req, GF_FOP_MKDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
- state->mode = args.mode;
- state->umask = args.umask;
+ state->mode = args.mode;
+ state->umask = args.umask;
- /* TODO: can do alloca for xdata field instead of stdalloc */
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ /* TODO: can do alloca for xdata field instead of stdalloc */
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_mkdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_mkdir_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- free (args.xdata.xdata_val);
- free (args.bname);
+ free(args.xdata.xdata_val);
+ free(args.bname);
- return ret;
+ return ret;
}
-
int
-server3_3_rmdir (rpcsvc_request_t *req)
+server3_3_rmdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_rmdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_rmdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_rmdir_req, GF_FOP_RMDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_rmdir_req, GF_FOP_RMDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
- state->flags = args.xflags;
+ state->flags = args.xflags;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_rmdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_rmdir_resume);
out:
- free (args.xdata.xdata_val);
- free (args.bname);
+ free(args.xdata.xdata_val);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_inodelk (rpcsvc_request_t *req)
+server3_3_inodelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_inodelk_req args = {{0,},};
- int cmd = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_inodelk_req args = {
+ {
+ 0,
+ },
+ };
+ int cmd = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_inodelk_req, GF_FOP_INODELK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_inodelk_req, GF_FOP_INODELK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- cmd = args.cmd;
- switch (cmd) {
+ cmd = args.cmd;
+ switch (cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
- }
+ state->cmd = F_SETLKW;
+ break;
+ }
- state->type = args.type;
- state->volume = gf_strdup (args.volume);
+ state->type = args.type;
+ state->volume = gf_strdup(args.volume);
- gf_proto_flock_to_flock (&args.flock, &state->flock);
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
- }
+ state->flock.l_type = F_UNLCK;
+ break;
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_inodelk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_inodelk_resume);
out:
- free (args.xdata.xdata_val);
- free (args.volume);
+ free(args.xdata.xdata_val);
+ free(args.volume);
- free (args.flock.lk_owner.lk_owner_val);
+ free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_finodelk (rpcsvc_request_t *req)
+server3_3_finodelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_finodelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_finodelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_finodelk_req,
- GF_FOP_FINODELK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_finodelk_req, GF_FOP_FINODELK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- state->volume = gf_strdup (args.volume);
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ state->volume = gf_strdup(args.volume);
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- switch (state->cmd) {
+ switch (state->cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
- }
+ state->cmd = F_SETLKW;
+ break;
+ }
- state->type = args.type;
+ state->type = args.type;
- gf_proto_flock_to_flock (&args.flock, &state->flock);
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
- }
+ state->flock.l_type = F_UNLCK;
+ break;
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_finodelk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_finodelk_resume);
out:
- free (args.xdata.xdata_val);
- free (args.volume);
+ free(args.xdata.xdata_val);
+ free(args.volume);
- free (args.flock.lk_owner.lk_owner_val);
+ free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_entrylk (rpcsvc_request_t *req)
+server3_3_entrylk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_entrylk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_entrylk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_entrylk_req,
- GF_FOP_ENTRYLK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_entrylk_req, GF_FOP_ENTRYLK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
- state->volume = gf_strdup (args.volume);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
+ state->volume = gf_strdup(args.volume);
- state->cmd = args.cmd;
- state->type = args.type;
+ state->cmd = args.cmd;
+ state->type = args.type;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_entrylk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_entrylk_resume);
out:
- free (args.xdata.xdata_val);
- free (args.volume);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.volume);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_fentrylk (rpcsvc_request_t *req)
+server3_3_fentrylk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_fentrylk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fentrylk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_fentrylk_req,
- GF_FOP_FENTRYLK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_fentrylk_req, GF_FOP_FENTRYLK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- state->type = args.type;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ state->type = args.type;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
- state->volume = gf_strdup (args.volume);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
+ state->volume = gf_strdup(args.volume);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_fentrylk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_fentrylk_resume);
out:
- free (args.xdata.xdata_val);
- free (args.volume);
- free (args.name);
+ free(args.xdata.xdata_val);
+ free(args.volume);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_access (rpcsvc_request_t *req)
+server3_3_access(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_access_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_access_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_access_req, GF_FOP_ACCESS);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_access_req, GF_FOP_ACCESS);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->mask = args.mask;
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->mask = args.mask;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_access_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_access_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server3_3_symlink (rpcsvc_request_t *req)
+server3_3_symlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_symlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_symlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_symlink_req, GF_FOP_SYMLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_symlink_req, GF_FOP_SYMLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
- state->name = gf_strdup (args.linkname);
- state->umask = args.umask;
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
+ state->name = gf_strdup(args.linkname);
+ state->umask = args.umask;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_symlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_symlink_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- /* memory allocated by libc, don't use GF_FREE */
- free (args.xdata.xdata_val);
- free (args.linkname);
- free (args.bname);
+ /* memory allocated by libc, don't use GF_FREE */
+ free(args.xdata.xdata_val);
+ free(args.linkname);
+ free(args.bname);
- return ret;
+ return ret;
}
-
-
int
-server3_3_link (rpcsvc_request_t *req)
+server3_3_link(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_link_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_link_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_link_req, GF_FOP_LINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_link_req, GF_FOP_LINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.oldgfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.oldgfid, 16);
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup (args.newbname);
- set_resolve_gfid (frame->root->client, state->resolve2.pargfid,
- args.newgfid);
+ state->resolve2.type = RESOLVE_NOT;
+ state->resolve2.bname = gf_strdup(args.newbname);
+ set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
+ args.newgfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_link_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_link_resume);
out:
- free (args.xdata.xdata_val);
- free (args.newbname);
+ free(args.xdata.xdata_val);
+ free(args.newbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_rename (rpcsvc_request_t *req)
+server3_3_rename(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_rename_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_rename_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_rename_req, GF_FOP_RENAME);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_rename_req, GF_FOP_RENAME);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup (args.oldbname);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.oldgfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(args.oldbname);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.oldgfid);
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup (args.newbname);
- set_resolve_gfid (frame->root->client, state->resolve2.pargfid,
- args.newgfid);
+ state->resolve2.type = RESOLVE_MAY;
+ state->resolve2.bname = gf_strdup(args.newbname);
+ set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
+ args.newgfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_rename_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_rename_resume);
out:
- free (args.xdata.xdata_val);
- free (args.newbname);
- free (args.oldbname);
+ free(args.xdata.xdata_val);
+ free(args.newbname);
+ free(args.oldbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_lease (rpcsvc_request_t *req)
+server3_3_lease(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_lease_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_lease_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_lease_req, GF_FOP_LEASE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_lease_req, GF_FOP_LEASE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- gf_proto_lease_to_lease (&args.lease, &state->lease);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ gf_proto_lease_to_lease(&args.lease, &state->lease);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_lease_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_lease_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_lk (rpcsvc_request_t *req)
+server3_3_lk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_lk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_lk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_lk_req, GF_FOP_LK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfs3_lk_req,
+ GF_FOP_LK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- state->type = args.type;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ state->type = args.type;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- switch (state->cmd) {
+ switch (state->cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
+ state->cmd = F_SETLKW;
+ break;
case GF_LK_RESLK_LCK:
- state->cmd = F_RESLK_LCK;
- break;
+ state->cmd = F_RESLK_LCK;
+ break;
case GF_LK_RESLK_LCKW:
- state->cmd = F_RESLK_LCKW;
- break;
+ state->cmd = F_RESLK_LCKW;
+ break;
case GF_LK_RESLK_UNLCK:
- state->cmd = F_RESLK_UNLCK;
- break;
+ state->cmd = F_RESLK_UNLCK;
+ break;
case GF_LK_GETLK_FD:
- state->cmd = F_GETLK_FD;
- break;
-
- }
+ state->cmd = F_GETLK_FD;
+ break;
+ }
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- gf_proto_flock_to_flock (&args.flock, &state->flock);
-
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
+ state->flock.l_type = F_UNLCK;
+ break;
default:
- gf_msg (frame->root->client->bound_xl->name, GF_LOG_ERROR,
- 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s): Unknown "
- "lock type: %"PRId32"!", state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid), state->type);
- break;
- }
-
-
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
-
- ret = 0;
- resolve_and_resume (frame, server_lk_resume);
+ gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_LOCK_ERROR,
+ "fd - %" PRId64
+ " (%s): Unknown "
+ "lock type: %" PRId32 "!",
+ state->resolve.fd_no, uuid_utoa(state->fd->inode->gfid),
+ state->type);
+ break;
+ }
+
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
+
+ ret = 0;
+ resolve_and_resume(frame, server_lk_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- free (args.flock.lk_owner.lk_owner_val);
+ free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server3_3_rchecksum (rpcsvc_request_t *req)
+server3_3_rchecksum(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_rchecksum_req args = {0,};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_rchecksum_req args = {
+ 0,
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_rchecksum_req,
- GF_FOP_RCHECKSUM);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_rchecksum_req, GF_FOP_RCHECKSUM);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.len;
+ state->resolve.type = RESOLVE_MAY;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ state->size = args.len;
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_rchecksum_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_rchecksum_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server_null (rpcsvc_request_t *req)
+server_null(rpcsvc_request_t *req)
{
- gf_common_rsp rsp = {0,};
+ gf_common_rsp rsp = {
+ 0,
+ };
- /* Accepted */
- rsp.op_ret = 0;
+ /* Accepted */
+ rsp.op_ret = 0;
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_common_rsp);
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
- return 0;
+ return 0;
}
int
-server3_3_lookup (rpcsvc_request_t *req)
+server3_3_lookup(rpcsvc_request_t *req)
{
- call_frame_t *frame = NULL;
- server_state_t *state = NULL;
- gfs3_lookup_req args = {{0,},};
- int ret = -1;
+ call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
+ gfs3_lookup_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
- GF_VALIDATE_OR_GOTO ("server", req, err);
+ GF_VALIDATE_OR_GOTO("server", req, err);
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_lookup_req, GF_FOP_LOOKUP);
- if (ret != 0) {
- goto err;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_lookup_req, GF_FOP_LOOKUP);
+ if (ret != 0) {
+ goto err;
+ }
- state->resolve.type = RESOLVE_DONTCARE;
+ state->resolve.type = RESOLVE_DONTCARE;
- if (args.bname && strcmp (args.bname, "")) {
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
- } else {
- set_resolve_gfid (frame->root->client,
- state->resolve.gfid, args.gfid);
- }
+ if (args.bname && strcmp(args.bname, "")) {
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid,
+ args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
+ } else {
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- ret, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, ret, out);
- ret = 0;
- resolve_and_resume (frame, server_lookup_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_lookup_resume);
- free (args.bname);
- free (args.xdata.xdata_val);
+ free(args.bname);
+ free(args.xdata.xdata_val);
- return ret;
+ return ret;
out:
- free (args.bname);
- free (args.xdata.xdata_val);
+ free(args.bname);
+ free(args.xdata.xdata_val);
- server_lookup_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL,
- NULL, NULL);
- ret = 0;
+ server_lookup_cbk(frame, NULL, frame->this, -1, EINVAL, NULL, NULL, NULL,
+ NULL);
+ ret = 0;
err:
- return ret;
+ return ret;
}
int
-server3_3_statfs (rpcsvc_request_t *req)
+server3_3_statfs(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_statfs_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_statfs_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_statfs_req, GF_FOP_STATFS);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_statfs_req, GF_FOP_STATFS);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_statfs_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_statfs_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
static int
-server3_3_getactivelk (rpcsvc_request_t *req)
-{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_getactivelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_getactivelk_req,
- GF_FOP_GETACTIVELK);
- if (ret != 0) {
- goto out;
- }
+server3_3_getactivelk(rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_getactivelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ if (!req)
+ return ret;
- /* here, dict itself works as xdata */
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
- op_errno, out);
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_getactivelk_req, GF_FOP_GETACTIVELK);
+ if (ret != 0) {
+ goto out;
+ }
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = 0;
- resolve_and_resume (frame, server_getactivelk_resume);
+ /* here, dict itself works as xdata */
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ (args.xdata.xdata_val), (args.xdata.xdata_len),
+ ret, op_errno, out);
+
+ ret = 0;
+ resolve_and_resume(frame, server_getactivelk_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
static int
-server3_3_setactivelk (rpcsvc_request_t *req)
-{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_setactivelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfs3_setactivelk_req,
- GF_FOP_SETACTIVELK);
- if (ret != 0) {
- goto out;
- }
+server3_3_setactivelk(rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_setactivelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ if (!req)
+ return ret;
+
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfs3_setactivelk_req, GF_FOP_SETACTIVELK);
+ if (ret != 0) {
+ goto out;
+ }
- /* here, dict itself works as xdata */
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
- op_errno, out);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = unserialize_req_locklist (&args, &state->locklist);
- if (ret)
- goto out;
+ /* here, dict itself works as xdata */
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ (args.xdata.xdata_val), (args.xdata.xdata_len),
+ ret, op_errno, out);
- ret = 0;
+ ret = unserialize_req_locklist(&args, &state->locklist);
+ if (ret)
+ goto out;
- resolve_and_resume (frame, server_setactivelk_resume);
+ ret = 0;
+
+ resolve_and_resume(frame, server_setactivelk_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server3_3_compound (rpcsvc_request_t *req)
+server3_3_compound(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_compound_req args = {0,};
- ssize_t len = 0;
- int length = 0;
- int i = 0;
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_compound_req args = {
+ 0,
+ };
+ ssize_t len = 0;
+ int length = 0;
+ int i = 0;
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, &len, &args,
- xdr_gfs3_compound_req,
- GF_FOP_COMPOUND);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, &len, &args,
+ xdr_gfs3_compound_req, GF_FOP_COMPOUND);
+ if (ret != 0) {
+ goto out;
+ }
- state->req = args;
- state->iobref = iobref_ref (req->iobref);
+ state->req = args;
+ state->iobref = iobref_ref(req->iobref);
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base
- = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len
- = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
+ if (len < req->msg[0].iov_len) {
+ state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
+ state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
+ state->payload_count = 1;
+ }
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++]
- = req->msg[i];
- }
+ for (i = 1; i < req->count; i++) {
+ state->payload_vector[state->payload_count++] = req->msg[i];
+ }
- state->size = iov_length (state->payload_vector, state->payload_count);
+ state->size = iov_length(state->payload_vector, state->payload_count);
- ret = server_get_compound_resolve (state, &args);
+ ret = server_get_compound_resolve(state, &args);
- if (ret) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
+ if (ret) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
- state->xdata,
- args.xdata.xdata_val,
- args.xdata.xdata_len, ret,
- op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
+ args.xdata.xdata_val, args.xdata.xdata_len,
+ ret, op_errno, out);
- ret = 0;
- resolve_and_resume (frame, server_compound_resume);
+ ret = 0;
+ resolve_and_resume(frame, server_compound_resume);
out:
- free (args.xdata.xdata_val);
+ free(args.xdata.xdata_val);
- length = args.compound_req_array.compound_req_array_len;
- server_compound_req_cleanup (&args, length);
- free (args.compound_req_array.compound_req_array_val);
+ length = args.compound_req_array.compound_req_array_len;
+ server_compound_req_cleanup(&args, length);
+ free(args.compound_req_array.compound_req_array_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
rpcsvc_actor_t glusterfs3_3_fop_actors[GLUSTER_FOP_PROCCNT] = {
- [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0, DRC_NA},
- [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0, DRC_NA},
- [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server3_3_readlink, NULL, 0, DRC_NA},
- [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0, DRC_NA},
- [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0, DRC_NA},
- [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0, DRC_NA},
- [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0, DRC_NA},
- [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0, DRC_NA},
- [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0, DRC_NA},
- [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server3_3_link, NULL, 0, DRC_NA},
- [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate, NULL, 0, DRC_NA},
- [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0, DRC_NA},
- [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server3_3_readv, NULL, 0, DRC_NA},
- [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server3_3_writev, server3_3_writev_vecsizer, 0, DRC_NA},
- [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0, DRC_NA},
- [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0, DRC_NA},
- [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0, DRC_NA},
- [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr, NULL, 0, DRC_NA},
- [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr, NULL, 0, DRC_NA},
- [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR, server3_3_removexattr, NULL, 0, DRC_NA},
- [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0, DRC_NA},
- [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir, NULL, 0, DRC_NA},
- [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0, DRC_NA},
- [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0, DRC_NA},
- [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate, NULL, 0, DRC_NA},
- [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0, DRC_NA},
- [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server3_3_lk, NULL, 0, DRC_NA},
- [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0, DRC_NA},
- [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0, DRC_NA},
- [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0, DRC_NA},
- [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server3_3_finodelk, NULL, 0, DRC_NA},
- [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0, DRC_NA},
- [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk, NULL, 0, DRC_NA},
- [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0, DRC_NA},
- [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop, NULL, 0, DRC_NA},
- [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr, NULL, 0, DRC_NA},
- [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr, NULL, 0, DRC_NA},
- [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum, NULL, 0, DRC_NA},
- [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0, DRC_NA},
- [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr, NULL, 0, DRC_NA},
- [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server3_3_readdirp, NULL, 0, DRC_NA},
- [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0, DRC_NA},
- [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR, server3_3_releasedir, NULL, 0, DRC_NA},
- [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server3_3_fremovexattr, NULL, 0, DRC_NA},
- [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server3_3_fallocate, NULL, 0, DRC_NA},
- [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server3_3_discard, NULL, 0, DRC_NA},
- [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server3_3_zerofill, NULL, 0, DRC_NA},
- [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server3_3_ipc, NULL, 0, DRC_NA},
- [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server3_3_seek, NULL, 0, DRC_NA},
- [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server3_3_lease, NULL, 0, DRC_NA},
- [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK, server3_3_getactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK, server3_3_setactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server3_3_compound, NULL, 0, DRC_NA},
+ [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0, DRC_NA},
+ [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0, DRC_NA},
+ [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server3_3_readlink,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server3_3_link, NULL, 0, DRC_NA},
+ [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0, DRC_NA},
+ [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server3_3_readv, NULL, 0, DRC_NA},
+ [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server3_3_writev,
+ server3_3_writev_vecsizer, 0, DRC_NA},
+ [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR,
+ server3_3_removexattr, NULL, 0, DRC_NA},
+ [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server3_3_lk, NULL, 0, DRC_NA},
+ [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server3_3_finodelk,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server3_3_readdirp,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR,
+ server3_3_releasedir, NULL, 0, DRC_NA},
+ [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR,
+ server3_3_fremovexattr, NULL, 0, DRC_NA},
+ [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server3_3_fallocate,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server3_3_discard, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server3_3_zerofill,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server3_3_ipc, NULL, 0, DRC_NA},
+ [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server3_3_seek, NULL, 0, DRC_NA},
+ [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server3_3_lease, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK,
+ server3_3_getactivelk, NULL, 0, DRC_NA},
+ [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK,
+ server3_3_setactivelk, NULL, 0, DRC_NA},
+ [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server3_3_compound,
+ NULL, 0, DRC_NA},
};
-
struct rpcsvc_program glusterfs3_3_fop_prog = {
- .progname = "GlusterFS 3.3",
- .prognum = GLUSTER_FOP_PROGRAM,
- .progver = GLUSTER_FOP_VERSION,
- .numactors = GLUSTER_FOP_PROCCNT,
- .actors = glusterfs3_3_fop_actors,
- .ownthread = _gf_true,
+ .progname = "GlusterFS 3.3",
+ .prognum = GLUSTER_FOP_PROGRAM,
+ .progver = GLUSTER_FOP_VERSION,
+ .numactors = GLUSTER_FOP_PROCCNT,
+ .actors = glusterfs3_3_fop_actors,
+ .ownthread = _gf_true,
};
diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c
index 92abaa1b5d1..21df9021c66 100644
--- a/xlators/protocol/server/src/server-rpc-fops_v2.c
+++ b/xlators/protocol/server/src/server-rpc-fops_v2.c
@@ -25,6012 +25,6178 @@
#include "xdr-nfs3.h"
-#define SERVER_REQ_SET_ERROR(req, ret) \
- do { \
- rpcsvc_request_seterr (req, GARBAGE_ARGS); \
- ret = RPCSVC_ACTOR_ERROR; \
- } while (0)
+#define SERVER_REQ_SET_ERROR(req, ret) \
+ do { \
+ rpcsvc_request_seterr(req, GARBAGE_ARGS); \
+ ret = RPCSVC_ACTOR_ERROR; \
+ } while (0)
extern int
-server3_3_getxattr (rpcsvc_request_t *req);
+server3_3_getxattr(rpcsvc_request_t *req);
extern void
-set_resolve_gfid (client_t *client, uuid_t resolve_gfid,
- char *on_wire_gfid);
+set_resolve_gfid(client_t *client, uuid_t resolve_gfid, char *on_wire_gfid);
extern int
-_gf_server_log_setxattr_failure (dict_t *d, char *k, data_t *v,
- void *tmp);
+_gf_server_log_setxattr_failure(dict_t *d, char *k, data_t *v, void *tmp);
extern int
-rpc_receive_common (rpcsvc_request_t *req, call_frame_t **fr,
- server_state_t **st, ssize_t *xdrlen, void *args,
- void *xdrfn, glusterfs_fop_t fop);
-
+rpc_receive_common(rpcsvc_request_t *req, call_frame_t **fr,
+ server_state_t **st, ssize_t *xdrlen, void *args,
+ void *xdrfn, glusterfs_fop_t fop);
/* Callback function section */
int
-server4_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct statvfs *buf,
dict_t *xdata)
{
- gfx_statfs_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
+ gfx_statfs_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
- "%"PRId64": STATFS, client: %s, error-xlator: %s",
- frame->root->unique, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
+ "%" PRId64 ": STATFS, client: %s, error-xlator: %s",
+ frame->root->unique, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_statfs (&rsp, buf);
+ server4_post_statfs(&rsp, buf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
-
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_statfs_rsp);
-
- GF_FREE (rsp.xdata.pairs.pairs_val);
-
- return 0;
-}
-
-int
-server4_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *stbuf, dict_t *xdata,
- struct iatt *postparent)
-{
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
- loc_t fresh_loc = {0,};
- gfx_common_2iatt_rsp rsp = {0,};
-
- state = CALL_STATE (frame);
-
- if (state->is_revalidate == 1 && op_ret == -1) {
- state->is_revalidate = 2;
- loc_copy (&fresh_loc, &state->loc);
- inode_unref (fresh_loc.inode);
- fresh_loc.inode = server_inode_new (state->itable,
- fresh_loc.gfid);
-
- STACK_WIND (frame, server4_lookup_cbk,
- frame->root->client->bound_xl,
- frame->root->client->bound_xl->fops->lookup,
- &fresh_loc, state->xdata);
-
- loc_wipe (&fresh_loc);
- return 0;
- }
-
- gfx_stat_from_iattx (&rsp.poststat, postparent);
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- if (state->is_revalidate && op_errno == ENOENT) {
- if (!__is_root_gfid (state->resolve.gfid)) {
- inode_unlink (state->loc.inode,
- state->loc.parent,
- state->loc.name);
- /**
- * If the entry is not present, then just
- * unlinking the associated dentry is not
- * suffecient. This condition should be
- * treated as unlink of the entry. So along
- * with deleting the entry, its also important
- * to forget the inode for it (if the dentry
- * being considered was the last dentry).
- * Otherwise it might lead to inode leak.
- * It also might lead to wrong decisions being
- * taken if the future lookups on this inode are
- * successful since they are able to find the
- * inode in the inode table (at least gfid based
- * lookups will be successful, if the lookup
- * is a soft lookup)
- */
- forget_inode_if_no_dentry (state->loc.inode);
- }
- }
- goto out;
- }
-
- server4_post_lookup (&rsp, frame, state, inode, stbuf);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_statfs_rsp);
+
+ GF_FREE(rsp.xdata.pairs.pairs_val);
+
+ return 0;
+}
+
+int
+server4_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, dict_t *xdata, struct iatt *postparent)
+{
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+ loc_t fresh_loc = {
+ 0,
+ };
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+
+ state = CALL_STATE(frame);
+
+ if (state->is_revalidate == 1 && op_ret == -1) {
+ state->is_revalidate = 2;
+ loc_copy(&fresh_loc, &state->loc);
+ inode_unref(fresh_loc.inode);
+ fresh_loc.inode = server_inode_new(state->itable, fresh_loc.gfid);
+
+ STACK_WIND(frame, server4_lookup_cbk, frame->root->client->bound_xl,
+ frame->root->client->bound_xl->fops->lookup, &fresh_loc,
+ state->xdata);
+
+ loc_wipe(&fresh_loc);
+ return 0;
+ }
+
+ gfx_stat_from_iattx(&rsp.poststat, postparent);
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ if (state->is_revalidate && op_errno == ENOENT) {
+ if (!__is_root_gfid(state->resolve.gfid)) {
+ inode_unlink(state->loc.inode, state->loc.parent,
+ state->loc.name);
+ /**
+ * If the entry is not present, then just
+ * unlinking the associated dentry is not
+ * suffecient. This condition should be
+ * treated as unlink of the entry. So along
+ * with deleting the entry, its also important
+ * to forget the inode for it (if the dentry
+ * being considered was the last dentry).
+ * Otherwise it might lead to inode leak.
+ * It also might lead to wrong decisions being
+ * taken if the future lookups on this inode are
+ * successful since they are able to find the
+ * inode in the inode table (at least gfid based
+ * lookups will be successful, if the lookup
+ * is a soft lookup)
+ */
+ forget_inode_if_no_dentry(state->loc.inode);
+ }
+ }
+ goto out;
+ }
+
+ server4_post_lookup(&rsp, frame, state, inode, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
-
- if (op_ret) {
- if (state->resolve.bname) {
- gf_msg (this->name,
- fop_log_level (GF_FOP_LOOKUP, op_errno),
- op_errno, PS_MSG_LOOKUP_INFO,
- "%"PRId64": LOOKUP %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path,
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- } else {
- gf_msg (this->name,
- fop_log_level (GF_FOP_LOOKUP, op_errno),
- op_errno, PS_MSG_LOOKUP_INFO,
- "%"PRId64": LOOKUP %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+
+ if (op_ret) {
+ if (state->resolve.bname) {
+ gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
+ PS_MSG_LOOKUP_INFO,
+ "%" PRId64
+ ": LOOKUP %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ } else {
+ gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
+ PS_MSG_LOOKUP_INFO,
+ "%" PRId64
+ ": LOOKUP %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid),
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
}
+ }
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_lease_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_lease_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_lease *lease,
dict_t *xdata)
{
- gfx_lease_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
+ gfx_lease_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_LEASE, op_errno),
- op_errno, PS_MSG_LK_INFO,
- "%"PRId64": LEASE %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
- server4_post_lease (&rsp, lease);
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_LEASE, op_errno), op_errno,
+ PS_MSG_LK_INFO,
+ "%" PRId64 ": LEASE %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ }
+ server4_post_lease(&rsp, lease);
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_lease_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_lease_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock,
dict_t *xdata)
{
- gfx_lk_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_LK, op_errno),
- op_errno, PS_MSG_LK_INFO,
- "%"PRId64": LK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_lk (this, &rsp, lock);
+ gfx_lk_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_LK, op_errno), op_errno,
+ PS_MSG_LK_INFO,
+ "%" PRId64 ": LK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_lk(this, &rsp, lock);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_lk_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_lk_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_inodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
- op_errno, PS_MSG_INODELK_INFO,
- "%"PRId64": INODELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_INODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO,
+ "%" PRId64
+ ": INODELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_finodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
- op_errno, PS_MSG_INODELK_INFO,
- "%"PRId64": FINODELK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FINODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO,
+ "%" PRId64 ": FINODELK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_entrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
- op_errno, PS_MSG_ENTRYLK_INFO,
- "%"PRId64": ENTRYLK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_ENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO,
+ "%" PRId64
+ ": ENTRYLK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fentrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
- op_errno, PS_MSG_ENTRYLK_INFO,
- "%"PRId64": FENTRYLK %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO,
+ "%" PRId64 ": FENTRYLK %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_access_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, PS_MSG_ACCESS_INFO,
- "%"PRId64": ACCESS %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_ACCESS_INFO,
+ "%" PRId64
+ ": ACCESS %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret) {
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": RMDIR %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": RMDIR %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_entry_remove (state, &rsp, preparent, postparent);
+ server4_post_entry_remove(state, &rsp, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_3iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": MKDIR %s (%s/%s) client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_3iatt (state, &rsp, inode, stbuf, preparent,
- postparent);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_MKDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": MKDIR %s (%s/%s) client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_3iatt(state, &rsp, inode, stbuf, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
+server4_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_3iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKNOD, op_errno),
- op_errno, PS_MSG_MKNOD_INFO,
- "%"PRId64": MKNOD %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_3iatt (state, &rsp, inode, stbuf, preparent,
- postparent);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, fop_log_level(GF_FOP_MKNOD, op_errno), op_errno,
+ PS_MSG_MKNOD_INFO,
+ "%" PRId64
+ ": MKNOD %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_3iatt(state, &rsp, inode, stbuf, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fsyncdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSYNCDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": FSYNCDIR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSYNCDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": FSYNCDIR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
dict_t *xdata)
{
- gfx_readdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": READDIR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* (op_ret == 0) is valid, and means EOF */
- if (op_ret) {
- ret = server4_post_readdir (&rsp, entries);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- }
+ gfx_readdir_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": READDIR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* (op_ret == 0) is valid, and means EOF */
+ if (op_ret) {
+ ret = server4_post_readdir(&rsp, entries);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_readdir_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_readdir_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- readdir_rsp_cleanup_v2 (&rsp);
+ readdir_rsp_cleanup_v2(&rsp);
- return 0;
+ return 0;
}
int
-server4_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfx_open_rsp rsp = {0,};
- uint64_t fd_no = 0;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": OPENDIR %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
-
- op_ret = server4_post_open (frame, this, &rsp, fd);
- if (op_ret)
- goto out;
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ uint64_t fd_no = 0;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_OPENDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64
+ ": OPENDIR %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ op_ret = server4_post_open(frame, this, &rsp, fd);
+ if (op_ret)
+ goto out;
out:
- if (op_ret)
- rsp.fd = fd_no;
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ if (op_ret)
+ rsp.fd = fd_no;
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_open_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_open_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
- gf_loglevel_t loglevel = GF_LOG_NONE;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (ENODATA == op_errno || ENOATTR == op_errno)
- loglevel = GF_LOG_DEBUG;
- else
- loglevel = GF_LOG_INFO;
-
- gf_msg (this->name, loglevel, op_errno,
- PS_MSG_REMOVEXATTR_INFO,
- "%"PRId64": REMOVEXATTR %s (%s) of key %s, client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+ gf_loglevel_t loglevel = GF_LOG_NONE;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (ENODATA == op_errno || ENOATTR == op_errno)
+ loglevel = GF_LOG_DEBUG;
+ else
+ loglevel = GF_LOG_INFO;
+
+ gf_msg(this->name, loglevel, op_errno, PS_MSG_REMOVEXATTR_INFO,
+ "%" PRId64
+ ": REMOVEXATTR %s (%s) of key %s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fremovexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name,
- fop_log_level (GF_FOP_FREMOVEXATTR, op_errno), op_errno,
- PS_MSG_REMOVEXATTR_INFO,
- "%"PRId64": FREMOVEXATTR %"PRId64" (%s) (%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FREMOVEXATTR, op_errno),
+ op_errno, PS_MSG_REMOVEXATTR_INFO,
+ "%" PRId64 ": FREMOVEXATTR %" PRId64
+ " (%s) (%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfx_common_dict_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
- op_errno, PS_MSG_GETXATTR_INFO,
- "%"PRId64": GETXATTR %s (%s) (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- dict_to_xdr (dict, &rsp.dict);
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_GETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO,
+ "%" PRId64
+ ": GETXATTR %s (%s) (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ dict_to_xdr(dict, &rsp.dict);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_dict_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_dict_rsp);
- GF_FREE (rsp.dict.pairs.pairs_val);
+ GF_FREE(rsp.dict.pairs.pairs_val);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfx_common_dict_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
- op_errno, PS_MSG_GETXATTR_INFO,
- "%"PRId64": FGETXATTR %"PRId64" (%s) (%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- state->name, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- dict_to_xdr (dict, &rsp.dict);
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FGETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO,
+ "%" PRId64 ": FGETXATTR %" PRId64
+ " (%s) (%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), state->name,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ dict_to_xdr(dict, &rsp.dict);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_dict_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_dict_rsp);
- GF_FREE (rsp.dict.pairs.pairs_val);
+ GF_FREE(rsp.dict.pairs.pairs_val);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (op_errno != ENOTSUP)
- dict_foreach (state->dict,
- _gf_server_log_setxattr_failure,
- frame);
-
- if (op_errno == ENOTSUP) {
- gf_msg_debug (THIS->name, 0, "%s",
- strerror (op_errno));
- } else {
- gf_msg (THIS->name, GF_LOG_INFO, op_errno,
- PS_MSG_SETXATTR_INFO, "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
- goto out;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (op_errno != ENOTSUP)
+ dict_foreach(state->dict, _gf_server_log_setxattr_failure, frame);
+
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
+ } else {
+ gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client: %s, "
+ "error-xlator: %s",
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
}
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret == -1) {
- state = CALL_STATE (frame);
- if (op_errno != ENOTSUP) {
- dict_foreach (state->dict,
- _gf_server_log_setxattr_failure,
- frame);
- }
- if (op_errno == ENOTSUP) {
- gf_msg_debug (THIS->name, 0, "%s",
- strerror (op_errno));
- } else {
- gf_msg (THIS->name, GF_LOG_INFO, op_errno,
- PS_MSG_SETXATTR_INFO, "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
- goto out;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret == -1) {
+ state = CALL_STATE(frame);
+ if (op_errno != ENOTSUP) {
+ dict_foreach(state->dict, _gf_server_log_setxattr_failure, frame);
}
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
+ } else {
+ gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client: %s, "
+ "error-xlator: %s",
+ STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ }
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
struct iatt *preoldparent, struct iatt *postoldparent,
struct iatt *prenewparent, struct iatt *postnewparent,
dict_t *xdata)
{
- gfx_rename_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- char oldpar_str[50] = {0,};
- char newpar_str[50] = {0,};
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret == -1) {
- uuid_utoa_r (state->resolve.pargfid, oldpar_str);
- uuid_utoa_r (state->resolve2.pargfid, newpar_str);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
- "%"PRId64": RENAME %s (%s/%s) -> %s (%s/%s), "
- "client: %s, error-xlator: %s", frame->root->unique,
- state->loc.path, oldpar_str, state->resolve.bname,
- state->loc2.path, newpar_str, state->resolve2.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_rename (frame, state, &rsp, stbuf,
- preoldparent, postoldparent,
- prenewparent, postnewparent);
+ gfx_rename_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ char oldpar_str[50] = {
+ 0,
+ };
+ char newpar_str[50] = {
+ 0,
+ };
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret == -1) {
+ uuid_utoa_r(state->resolve.pargfid, oldpar_str);
+ uuid_utoa_r(state->resolve2.pargfid, newpar_str);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
+ "%" PRId64
+ ": RENAME %s (%s/%s) -> %s (%s/%s), "
+ "client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path, oldpar_str,
+ state->resolve.bname, state->loc2.path, newpar_str,
+ state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_rename(frame, state, &rsp, stbuf, preoldparent, postoldparent,
+ prenewparent, postnewparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_rename_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_rename_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
- op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": UNLINK %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* TODO: log gfid of the inodes */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "UNLINK_CBK %s", frame->root->unique, state->loc.name);
-
- server4_post_entry_remove (state, &rsp, preparent, postparent);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_UNLINK, op_errno), op_errno,
+ PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": UNLINK %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* TODO: log gfid of the inodes */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "UNLINK_CBK %s",
+ frame->root->unique, state->loc.name);
+
+ server4_post_entry_remove(state, &rsp, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_3iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": SYMLINK %s (%s/%s), client: %s, "
- "error-xlator:%s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.pargfid),
- state->resolve.bname,
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": SYMLINK %s (%s/%s), client: %s, "
+ "error-xlator:%s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_common_3iatt (state, &rsp, inode, stbuf, preparent,
- postparent);
+ server4_post_common_3iatt(state, &rsp, inode, stbuf, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfx_common_3iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- char gfid_str[50] = {0,};
- char newpar_str[50] = {0,};
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret) {
- uuid_utoa_r (state->resolve.gfid, gfid_str);
- uuid_utoa_r (state->resolve2.pargfid, newpar_str);
-
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": LINK %s (%s) -> %s/%s, client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, gfid_str, newpar_str,
- state->resolve2.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_link (state, &rsp, inode, stbuf, preparent,
- postparent);
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ char gfid_str[50] = {
+ 0,
+ };
+ char newpar_str[50] = {
+ 0,
+ };
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret) {
+ uuid_utoa_r(state->resolve.gfid, gfid_str);
+ uuid_utoa_r(state->resolve2.pargfid, newpar_str);
+
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": LINK %s (%s) -> %s/%s, client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path, gfid_str, newpar_str,
+ state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_link(state, &rsp, inode, stbuf, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno,
- PS_MSG_TRUNCATE_INFO,
- "%"PRId64": TRUNCATE %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_TRUNCATE_INFO,
+ "%" PRId64
+ ": TRUNCATE %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_common_2iatt (&rsp, prebuf, postbuf);
+ server4_post_common_2iatt(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
dict_t *xdata)
{
- gfx_common_iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_FSTAT, op_errno),
- op_errno, PS_MSG_STAT_INFO,
- "%"PRId64": FSTAT %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_iatt (state, &rsp, stbuf);
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_FSTAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO,
+ "%" PRId64 ": FSTAT %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_iatt(state, &rsp, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {0};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FTRUNCATE, op_errno),
- op_errno, PS_MSG_TRUNCATE_INFO,
- "%"PRId64": FTRUNCATE %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FTRUNCATE, op_errno), op_errno,
+ PS_MSG_TRUNCATE_INFO,
+ "%" PRId64 ": FTRUNCATE %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_common_2iatt (&rsp, prebuf, postbuf);
+ server4_post_common_2iatt(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
- op_errno, PS_MSG_FLUSH_INFO,
- "%"PRId64": FLUSH %"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FLUSH, op_errno), op_errno,
+ PS_MSG_FLUSH_INFO,
+ "%" PRId64 ": FLUSH %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSYNC, op_errno),
- op_errno, PS_MSG_SYNC_INFO,
- "%"PRId64": FSYNC %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_2iatt (&rsp, prebuf, postbuf);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSYNC, op_errno), op_errno,
+ PS_MSG_SYNC_INFO,
+ "%" PRId64 ": FSYNC %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_2iatt(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_WRITE, op_errno),
- op_errno, PS_MSG_WRITE_INFO,
- "%"PRId64": WRITEV %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_2iatt (&rsp, prebuf, postbuf);
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_WRITE, op_errno), op_errno,
+ PS_MSG_WRITE_INFO,
+ "%" PRId64 ": WRITEV %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_2iatt(&rsp, prebuf, postbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iovec *vector, int32_t count,
- struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
+server4_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iovec *vector,
+ int32_t count, struct iatt *stbuf, struct iobref *iobref,
+ dict_t *xdata)
{
- gfx_read_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_read_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
#ifdef GF_TESTING_IO_XDATA
- {
- int ret = 0;
- if (!xdata)
- xdata = dict_new ();
-
- ret = dict_set_str (xdata, "testing-the-xdata-key",
- "testing-xdata-value");
- }
+ {
+ int ret = 0;
+ if (!xdata)
+ xdata = dict_new();
+
+ ret = dict_set_str(xdata, "testing-the-xdata-key",
+ "testing-xdata-value");
+ }
#endif
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READ, op_errno),
- op_errno, PS_MSG_READ_INFO,
- "%"PRId64": READV %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_readv (&rsp, stbuf, op_ret);
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READ, op_errno), op_errno,
+ PS_MSG_READ_INFO,
+ "%" PRId64 ": READV %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_readv(&rsp, stbuf, op_ret);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, vector, count, iobref,
- (xdrproc_t)xdr_gfx_read_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, vector, count, iobref,
+ (xdrproc_t)xdr_gfx_read_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- uint32_t weak_checksum, uint8_t *strong_checksum,
- dict_t *xdata)
+server4_rchecksum_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, uint32_t weak_checksum,
+ uint8_t *strong_checksum, dict_t *xdata)
{
- gfx_rchecksum_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_RCHECKSUM, op_errno),
- op_errno, PS_MSG_CHKSUM_INFO,
- "%"PRId64": RCHECKSUM %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ gfx_rchecksum_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
- server4_post_rchecksum (&rsp, weak_checksum, strong_checksum);
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_RCHECKSUM, op_errno), op_errno,
+ PS_MSG_CHKSUM_INFO,
+ "%" PRId64 ": RCHECKSUM %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_rchecksum(&rsp, weak_checksum, strong_checksum);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_rchecksum_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_rchecksum_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfx_open_rsp rsp = {0,};
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
- op_errno, PS_MSG_OPEN_INFO,
- "%"PRId64": OPEN %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- op_ret = server4_post_open (frame, this, &rsp, fd);
- if (op_ret)
- goto out;
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_OPEN, op_errno), op_errno,
+ PS_MSG_OPEN_INFO,
+ "%" PRId64 ": OPEN %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ op_ret = server4_post_open(frame, this, &rsp, fd);
+ if (op_ret)
+ goto out;
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_open_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_open_rsp);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- uint64_t fd_no = 0;
- gfx_create_rsp rsp = {0,};
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
-
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
- "%"PRId64": CREATE %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* TODO: log gfid too */
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "CREATE %s (%s)", frame->root->unique, state->loc.name,
- uuid_utoa (stbuf->ia_gfid));
-
- op_ret = server4_post_create (frame, &rsp, state, this, fd, inode,
- stbuf,
- preparent, postparent);
- if (op_ret) {
- op_errno = -op_ret;
- op_ret = -1;
- goto out;
- }
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ uint64_t fd_no = 0;
+ gfx_create_rsp rsp = {
+ 0,
+ };
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
+ "%" PRId64
+ ": CREATE %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* TODO: log gfid too */
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "CREATE %s (%s)",
+ frame->root->unique, state->loc.name,
+ uuid_utoa(stbuf->ia_gfid));
+
+ op_ret = server4_post_create(frame, &rsp, state, this, fd, inode, stbuf,
+ preparent, postparent);
+ if (op_ret) {
+ op_errno = -op_ret;
+ op_ret = -1;
+ goto out;
+ }
out:
- if (op_ret)
- rsp.fd = fd_no;
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ if (op_ret)
+ rsp.fd = fd_no;
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_create_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_create_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, const char *buf,
struct iatt *stbuf, dict_t *xdata)
{
- gfx_readlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%"PRId64": READLINK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_readlink (&rsp, stbuf, buf);
+ gfx_readlink_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "%" PRId64
+ ": READLINK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_readlink(&rsp, stbuf, buf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
- if (!rsp.path)
- rsp.path = "";
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+ if (!rsp.path)
+ rsp.path = "";
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_readlink_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_readlink_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
dict_t *xdata)
{
- gfx_common_iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- state = CALL_STATE (frame);
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_STAT, op_errno),
- op_errno, PS_MSG_STAT_INFO,
- "%"PRId64": STAT %s (%s), client: %s, error-xlator: %s",
- frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_iatt (state, &rsp, stbuf);
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ state = CALL_STATE(frame);
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_STAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO,
+ "%" PRId64 ": STAT %s (%s), client: %s, error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_iatt(state, &rsp, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+server4_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
- "%"PRId64": SETATTR %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- (state->loc.path) ? state->loc.path : "",
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
+ "%" PRId64
+ ": SETATTR %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, (state->loc.path) ? state->loc.path : "",
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_common_2iatt (&rsp, statpre, statpost);
+ server4_post_common_2iatt(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+server4_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FSETATTR, op_errno),
- op_errno, PS_MSG_SETATTR_INFO,
- "%"PRId64": FSETATTR %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FSETATTR, op_errno), op_errno,
+ PS_MSG_SETATTR_INFO,
+ "%" PRId64 ": FSETATTR %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- server4_post_common_2iatt (&rsp, statpre, statpost);
+ server4_post_common_2iatt(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfx_common_dict_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_XATTROP, op_errno),
- op_errno, PS_MSG_XATTROP_INFO,
- "%"PRId64": XATTROP %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- dict_to_xdr (dict, &rsp.dict);
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO,
+ "%" PRId64
+ ": XATTROP %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ dict_to_xdr(dict, &rsp.dict);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_dict_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_dict_rsp);
- GF_FREE (rsp.dict.pairs.pairs_val);
+ GF_FREE(rsp.dict.pairs.pairs_val);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_fxattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfx_common_dict_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FXATTROP, op_errno),
- op_errno, PS_MSG_XATTROP_INFO,
- "%"PRId64": FXATTROP %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- dict_to_xdr (dict, &rsp.dict);
+ gfx_common_dict_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FXATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO,
+ "%" PRId64 ": FXATTROP %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ dict_to_xdr(dict, &rsp.dict);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_dict_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_dict_rsp);
- GF_FREE (rsp.dict.pairs.pairs_val);
+ GF_FREE(rsp.dict.pairs.pairs_val);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
dict_t *xdata)
{
- gfx_readdirp_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- state = CALL_STATE (frame);
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_READDIRP, op_errno),
- op_errno, PS_MSG_DIR_INFO,
- "%"PRId64": READDIRP %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- /* (op_ret == 0) is valid, and means EOF */
- if (op_ret) {
- ret = server4_post_readdirp (&rsp, entries);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- gf_link_inodes_from_dirent (this, state->fd->inode, entries);
+ gfx_readdirp_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
+
+ state = CALL_STATE(frame);
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_READDIRP, op_errno), op_errno,
+ PS_MSG_DIR_INFO,
+ "%" PRId64 ": READDIRP %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ /* (op_ret == 0) is valid, and means EOF */
+ if (op_ret) {
+ ret = server4_post_readdirp(&rsp, entries);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
+
+ gf_link_inodes_from_dirent(this, state->fd->inode, entries);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_readdirp_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_readdirp_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- readdirp_rsp_cleanup_v2 (&rsp);
+ readdirp_rsp_cleanup_v2(&rsp);
- return 0;
+ return 0;
}
int
server4_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_FALLOCATE, op_errno),
- op_errno, PS_MSG_ALLOC_INFO,
- "%"PRId64": FALLOCATE %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_2iatt (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_FALLOCATE, op_errno), op_errno,
+ PS_MSG_ALLOC_INFO,
+ "%" PRId64 ": FALLOCATE %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_2iatt(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
server4_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- state = CALL_STATE (frame);
- gf_msg (this->name, fop_log_level (GF_FOP_DISCARD, op_errno),
- op_errno, PS_MSG_DISCARD_INFO,
- "%"PRId64": DISCARD %"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_2iatt (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, fop_log_level(GF_FOP_DISCARD, op_errno), op_errno,
+ PS_MSG_DISCARD_INFO,
+ "%" PRId64 ": DISCARD %" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_2iatt(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
server4_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
-{
- gfx_common_2iatt_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_ZEROFILL, op_errno),
- op_errno, PS_MSG_ZEROFILL_INFO,
- "%"PRId64": ZEROFILL%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_common_2iatt (&rsp, statpre, statpost);
+ int32_t op_ret, int32_t op_errno, struct iatt *statpre,
+ struct iatt *statpost, dict_t *xdata)
+{
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ req = frame->local;
+ state = CALL_STATE(frame);
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_ZEROFILL, op_errno), op_errno,
+ PS_MSG_ZEROFILL_INFO,
+ "%" PRId64 ": ZEROFILL%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_common_2iatt(&rsp, statpre, statpost);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_common_2iatt_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_ipc_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_ipc_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- req = frame->local;
- state = CALL_STATE (frame);
+ req = frame->local;
+ state = CALL_STATE(frame);
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret) {
- gf_msg (this->name, GF_LOG_INFO, op_errno,
- PS_MSG_SERVER_IPC_INFO,
- "%"PRId64": IPC%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_IPC_INFO,
+ "%" PRId64 ": IPC%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_common_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
-
int
-server4_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_seek_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, off_t offset, dict_t *xdata)
{
- struct gfx_seek_rsp rsp = {0, };
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
-
- dict_to_xdr (xdata, &rsp.xdata);
-
- if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_SEEK, op_errno),
- op_errno, PS_MSG_SEEK_INFO,
- "%"PRId64": SEEK%"PRId64" (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
-
- server4_post_seek (&rsp, offset);
+ struct gfx_seek_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ req = frame->local;
+ state = CALL_STATE(frame);
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_SEEK, op_errno), op_errno,
+ PS_MSG_SEEK_INFO,
+ "%" PRId64 ": SEEK%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
+
+ server4_post_seek(&rsp, offset);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_seek_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_seek_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
static int
-server4_setactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_setactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gfx_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret < 0) {
- state = CALL_STATE (frame);
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, 0,
- "%"PRId64": SETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+ gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
+ "%" PRId64
+ ": SETACTIVELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
+ req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_namelink_cbk (call_frame_t *frame,
- void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
+server4_namelink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- gfx_common_2iatt_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
+ gfx_common_2iatt_rsp rsp = {
+ 0,
+ };
+ rpcsvc_request_t *req = NULL;
- dict_to_xdr (xdata, &rsp.xdata);
- if (op_ret < 0)
- goto out;
+ dict_to_xdr(xdata, &rsp.xdata);
+ if (op_ret < 0)
+ goto out;
- gfx_stat_from_iattx (&rsp.prestat, prebuf);
- gfx_stat_from_iattx (&rsp.poststat, postbuf);
+ gfx_stat_from_iattx(&rsp.prestat, prebuf);
+ gfx_stat_from_iattx(&rsp.poststat, postbuf);
- /**
- * no point in linking inode here -- there's no stbuf anyway and a
- * lookup() for this name entry would be a negative lookup.
- */
+ /**
+ * no point in linking inode here -- there's no stbuf anyway and a
+ * lookup() for this name entry would be a negative lookup.
+ */
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_2iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_2iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_icreate_cbk (call_frame_t *frame,
- void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *stbuf, dict_t *xdata)
+server4_icreate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *stbuf, dict_t *xdata)
{
- server_state_t *state = NULL;
- inode_t *link_inode = NULL;
- rpcsvc_request_t *req = NULL;
- gfx_common_iatt_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *link_inode = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfx_common_iatt_rsp rsp = {
+ 0,
+ };
- dict_to_xdr (xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ dict_to_xdr(xdata, &rsp.xdata);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
- "%"PRId64": ICREATE [%s] ==> (%s)",
- frame->root->unique, uuid_utoa (state->resolve.gfid),
- strerror (op_errno));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
+ "%" PRId64 ": ICREATE [%s] ==> (%s)", frame->root->unique,
+ uuid_utoa(state->resolve.gfid), strerror(op_errno));
+ goto out;
+ }
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "ICREATE [%s]", frame->root->unique,
- uuid_utoa (stbuf->ia_gfid));
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "ICREATE [%s]",
+ frame->root->unique, uuid_utoa(stbuf->ia_gfid));
- link_inode = inode_link (inode,
- state->loc.parent, state->loc.name, stbuf);
+ link_inode = inode_link(inode, state->loc.parent, state->loc.name, stbuf);
- if (!link_inode) {
- op_ret = -1;
- op_errno = ENOENT;
- goto out;
- }
+ if (!link_inode) {
+ op_ret = -1;
+ op_errno = ENOENT;
+ goto out;
+ }
- inode_lookup (link_inode);
- inode_unref (link_inode);
+ inode_lookup(link_inode);
+ inode_unref(link_inode);
- gfx_stat_from_iattx (&rsp.stat, stbuf);
+ gfx_stat_from_iattx(&rsp.stat, stbuf);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_put_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_put_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfx_common_3iatt_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_PUT_INFO,
- "%"PRId64": PUT %s (%s/%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.pargfid),
- state->resolve.bname, STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- goto out;
- }
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_PUT_INFO,
+ "%" PRId64
+ ": PUT %s (%s/%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.pargfid), state->resolve.bname,
+ STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ goto out;
+ }
- gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
- "PUT %s (%s)", frame->root->unique, state->loc.name,
- uuid_utoa (stbuf->ia_gfid));
+ gf_msg_trace(frame->root->client->bound_xl->name, 0,
+ "%" PRId64
+ ": "
+ "PUT %s (%s)",
+ frame->root->unique, state->loc.name,
+ uuid_utoa(stbuf->ia_gfid));
- server4_post_common_3iatt (state, &rsp, inode, stbuf, preparent,
- postparent);
+ server4_post_common_3iatt(state, &rsp, inode, stbuf, preparent, postparent);
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
/* Resume function section */
int
-server4_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_rchecksum_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = EINVAL;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = EINVAL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- STACK_WIND (frame, server4_rchecksum_cbk, bound_xl,
- bound_xl->fops->rchecksum, state->fd,
- state->offset, state->size, state->xdata);
+ STACK_WIND(frame, server4_rchecksum_cbk, bound_xl,
+ bound_xl->fops->rchecksum, state->fd, state->offset, state->size,
+ state->xdata);
- return 0;
+ return 0;
err:
- server4_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0,
- NULL, NULL);
-
- return 0;
+ server4_rchecksum_cbk(frame, NULL, frame->this, op_ret, op_errno, 0, NULL,
+ NULL);
+ return 0;
}
int
-server4_lease_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_lease_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_lease_cbk, bound_xl, bound_xl->fops->lease,
- &state->loc, &state->lease, state->xdata);
+ STACK_WIND(frame, server4_lease_cbk, bound_xl, bound_xl->fops->lease,
+ &state->loc, &state->lease, state->xdata);
- return 0;
+ return 0;
err:
- server4_lease_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_lease_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_put_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_put_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_put_cbk,
- bound_xl, bound_xl->fops->put,
- &(state->loc), state->mode, state->umask, state->flags,
- state->payload_vector, state->payload_count, state->offset,
- state->iobref, state->dict, state->xdata);
+ STACK_WIND(frame, server4_put_cbk, bound_xl, bound_xl->fops->put,
+ &(state->loc), state->mode, state->umask, state->flags,
+ state->payload_vector, state->payload_count, state->offset,
+ state->iobref, state->dict, state->xdata);
- return 0;
+ return 0;
err:
- server4_put_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL,
- NULL, NULL);
- return 0;
+ server4_put_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
int
-server4_lk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_lk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_lk_cbk, bound_xl, bound_xl->fops->lk,
- state->fd, state->cmd, &state->flock, state->xdata);
+ STACK_WIND(frame, server4_lk_cbk, bound_xl, bound_xl->fops->lk, state->fd,
+ state->cmd, &state->flock, state->xdata);
- return 0;
+ return 0;
err:
- server4_lk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_lk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_rename_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_rename_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = 0;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- if (state->resolve2.op_ret != 0) {
- op_ret = state->resolve2.op_ret;
- op_errno = state->resolve2.op_errno;
- goto err;
- }
+ if (state->resolve2.op_ret != 0) {
+ op_ret = state->resolve2.op_ret;
+ op_errno = state->resolve2.op_errno;
+ goto err;
+ }
- STACK_WIND (frame, server4_rename_cbk,
- bound_xl, bound_xl->fops->rename,
- &state->loc, &state->loc2, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_rename_cbk, bound_xl, bound_xl->fops->rename,
+ &state->loc, &state->loc2, state->xdata);
+ return 0;
err:
- server4_rename_cbk (frame, NULL, frame->this, op_ret, op_errno,
- NULL, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server4_rename_cbk(frame, NULL, frame->this, op_ret, op_errno, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_link_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_link_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ int op_ret = 0;
+ int op_errno = 0;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ op_ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- if (state->resolve2.op_ret != 0) {
- op_ret = state->resolve2.op_ret;
- op_errno = state->resolve2.op_errno;
- goto err;
- }
+ if (state->resolve2.op_ret != 0) {
+ op_ret = state->resolve2.op_ret;
+ op_errno = state->resolve2.op_errno;
+ goto err;
+ }
- state->loc2.inode = inode_ref (state->loc.inode);
+ state->loc2.inode = inode_ref(state->loc.inode);
- STACK_WIND (frame, server4_link_cbk, bound_xl, bound_xl->fops->link,
- &state->loc, &state->loc2, state->xdata);
+ STACK_WIND(frame, server4_link_cbk, bound_xl, bound_xl->fops->link,
+ &state->loc, &state->loc2, state->xdata);
- return 0;
+ return 0;
err:
- server4_link_cbk (frame, NULL, frame->this, op_ret, op_errno,
- NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server4_link_cbk(frame, NULL, frame->this, op_ret, op_errno, NULL, NULL,
+ NULL, NULL, NULL);
+ return 0;
}
int
-server4_symlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_symlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_symlink_cbk,
- bound_xl, bound_xl->fops->symlink,
- state->name, &state->loc, state->umask, state->xdata);
+ STACK_WIND(frame, server4_symlink_cbk, bound_xl, bound_xl->fops->symlink,
+ state->name, &state->loc, state->umask, state->xdata);
- return 0;
+ return 0;
err:
- server4_symlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server4_symlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_access_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_access_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_access_cbk,
- bound_xl, bound_xl->fops->access,
- &state->loc, state->mask, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_access_cbk, bound_xl, bound_xl->fops->access,
+ &state->loc, state->mask, state->xdata);
+ return 0;
err:
- server4_access_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_access_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server4_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fentrylk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server4_fentrylk_cbk, bound_xl,
- bound_xl->fops->fentrylk,
- state->volume, state->fd, state->name,
- state->cmd, state->type, state->xdata);
+ STACK_WIND(frame, server4_fentrylk_cbk, bound_xl, bound_xl->fops->fentrylk,
+ state->volume, state->fd, state->name, state->cmd, state->type,
+ state->xdata);
- return 0;
+ return 0;
err:
- server4_fentrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_fentrylk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server4_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_entrylk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server4_entrylk_cbk,
- bound_xl, bound_xl->fops->entrylk,
- state->volume, &state->loc, state->name,
- state->cmd, state->type, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_entrylk_cbk, bound_xl, bound_xl->fops->entrylk,
+ state->volume, &state->loc, state->name, state->cmd, state->type,
+ state->xdata);
+ return 0;
err:
- server4_entrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_entrylk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server4_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_finodelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
- bound_xl);
+ gf_msg_debug(bound_xl->name, 0, "frame %p, xlator %p", frame, bound_xl);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server4_finodelk_cbk, bound_xl,
- bound_xl->fops->finodelk, state->volume, state->fd,
- state->cmd, &state->flock, state->xdata);
+ STACK_WIND(frame, server4_finodelk_cbk, bound_xl, bound_xl->fops->finodelk,
+ state->volume, state->fd, state->cmd, &state->flock,
+ state->xdata);
- return 0;
+ return 0;
err:
- server4_finodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server4_finodelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
int
-server4_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_inodelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- GF_UNUSED int ret = -1;
- server_state_t *state = NULL;
+ GF_UNUSED int ret = -1;
+ server_state_t *state = NULL;
- gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
- bound_xl);
+ gf_msg_debug(bound_xl->name, 0, "frame %p, xlator %p", frame, bound_xl);
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->xdata)
- state->xdata = dict_new ();
+ if (!state->xdata)
+ state->xdata = dict_new();
- if (state->xdata)
- ret = dict_set_str (state->xdata, "connection-id",
- frame->root->client->client_uid);
+ if (state->xdata)
+ ret = dict_set_str(state->xdata, "connection-id",
+ frame->root->client->client_uid);
- STACK_WIND (frame, server4_inodelk_cbk, bound_xl,
- bound_xl->fops->inodelk, state->volume, &state->loc,
- state->cmd, &state->flock, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_inodelk_cbk, bound_xl, bound_xl->fops->inodelk,
+ state->volume, &state->loc, state->cmd, &state->flock,
+ state->xdata);
+ return 0;
err:
- server4_inodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_inodelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server4_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_rmdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_rmdir_cbk, bound_xl, bound_xl->fops->rmdir,
- &state->loc, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_rmdir_cbk, bound_xl, bound_xl->fops->rmdir,
+ &state->loc, state->flags, state->xdata);
+ return 0;
err:
- server4_rmdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_rmdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
int
-server4_mkdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_mkdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_mkdir_cbk,
- bound_xl, bound_xl->fops->mkdir,
- &(state->loc), state->mode, state->umask, state->xdata);
+ STACK_WIND(frame, server4_mkdir_cbk, bound_xl, bound_xl->fops->mkdir,
+ &(state->loc), state->mode, state->umask, state->xdata);
- return 0;
+ return 0;
err:
- server4_mkdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server4_mkdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_mknod_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_mknod_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_mknod_cbk,
- bound_xl, bound_xl->fops->mknod,
- &(state->loc), state->mode, state->dev,
- state->umask, state->xdata);
+ STACK_WIND(frame, server4_mknod_cbk, bound_xl, bound_xl->fops->mknod,
+ &(state->loc), state->mode, state->dev, state->umask,
+ state->xdata);
- return 0;
+ return 0;
err:
- server4_mknod_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
- return 0;
+ server4_mknod_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_fsyncdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fsyncdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fsyncdir_cbk,
- bound_xl,
- bound_xl->fops->fsyncdir,
- state->fd, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fsyncdir_cbk, bound_xl, bound_xl->fops->fsyncdir,
+ state->fd, state->flags, state->xdata);
+ return 0;
err:
- server4_fsyncdir_cbk (frame, NULL, frame->this,
- state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_fsyncdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
-
int
-server4_readdir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_readdir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- GF_ASSERT (state->fd);
+ GF_ASSERT(state->fd);
- STACK_WIND (frame, server4_readdir_cbk,
- bound_xl,
- bound_xl->fops->readdir,
- state->fd, state->size, state->offset, state->xdata);
+ STACK_WIND(frame, server4_readdir_cbk, bound_xl, bound_xl->fops->readdir,
+ state->fd, state->size, state->offset, state->xdata);
- return 0;
+ return 0;
err:
- server4_readdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_readdir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_readdirp_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_readdirp_cbk, bound_xl,
- bound_xl->fops->readdirp, state->fd, state->size,
- state->offset, state->xdata);
+ STACK_WIND(frame, server4_readdirp_cbk, bound_xl, bound_xl->fops->readdirp,
+ state->fd, state->size, state->offset, state->xdata);
- return 0;
+ return 0;
err:
- server4_readdirp_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_readdirp_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_opendir_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_opendir_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto err;
- }
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
+ goto err;
+ }
- STACK_WIND (frame, server4_opendir_cbk,
- bound_xl, bound_xl->fops->opendir,
- &state->loc, state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_opendir_cbk, bound_xl, bound_xl->fops->opendir,
+ &state->loc, state->fd, state->xdata);
+ return 0;
err:
- server4_opendir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_opendir_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_statfs_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_statfs_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_statfs_cbk,
- bound_xl, bound_xl->fops->statfs,
- &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_statfs_cbk, bound_xl, bound_xl->fops->statfs,
+ &state->loc, state->xdata);
+ return 0;
err:
- server4_statfs_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_statfs_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_removexattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_removexattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_removexattr_cbk,
- bound_xl, bound_xl->fops->removexattr,
- &state->loc, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_removexattr_cbk, bound_xl,
+ bound_xl->fops->removexattr, &state->loc, state->name,
+ state->xdata);
+ return 0;
err:
- server4_removexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_removexattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server4_fremovexattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fremovexattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fremovexattr_cbk,
- bound_xl, bound_xl->fops->fremovexattr,
- state->fd, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fremovexattr_cbk, bound_xl,
+ bound_xl->fops->fremovexattr, state->fd, state->name,
+ state->xdata);
+ return 0;
err:
- server4_fremovexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
+ server4_fremovexattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server4_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fgetxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fgetxattr_cbk,
- bound_xl, bound_xl->fops->fgetxattr,
- state->fd, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fgetxattr_cbk, bound_xl,
+ bound_xl->fops->fgetxattr, state->fd, state->name, state->xdata);
+ return 0;
err:
- server4_fgetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_fgetxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_xattrop_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_xattrop_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_xattrop_cbk,
- bound_xl, bound_xl->fops->xattrop,
- &state->loc, state->flags, state->dict, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_xattrop_cbk, bound_xl, bound_xl->fops->xattrop,
+ &state->loc, state->flags, state->dict, state->xdata);
+ return 0;
err:
- server4_xattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_xattrop_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_fxattrop_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fxattrop_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fxattrop_cbk,
- bound_xl, bound_xl->fops->fxattrop,
- state->fd, state->flags, state->dict, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fxattrop_cbk, bound_xl, bound_xl->fops->fxattrop,
+ state->fd, state->flags, state->dict, state->xdata);
+ return 0;
err:
- server4_fxattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_fxattrop_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_fsetxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fsetxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_setxattr_cbk,
- bound_xl, bound_xl->fops->fsetxattr,
- state->fd, state->dict, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_setxattr_cbk, bound_xl, bound_xl->fops->fsetxattr,
+ state->fd, state->dict, state->flags, state->xdata);
+ return 0;
err:
- server4_fsetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server4_fsetxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
int
-server4_unlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_unlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_unlink_cbk,
- bound_xl, bound_xl->fops->unlink,
- &state->loc, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_unlink_cbk, bound_xl, bound_xl->fops->unlink,
+ &state->loc, state->flags, state->xdata);
+ return 0;
err:
- server4_unlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_unlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
int
-server4_truncate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_truncate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_truncate_cbk,
- bound_xl, bound_xl->fops->truncate,
- &state->loc, state->offset, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_truncate_cbk, bound_xl, bound_xl->fops->truncate,
+ &state->loc, state->offset, state->xdata);
+ return 0;
err:
- server4_truncate_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_truncate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
-
int
-server4_fstat_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fstat_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fstat_cbk,
- bound_xl, bound_xl->fops->fstat,
- state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fstat_cbk, bound_xl, bound_xl->fops->fstat,
+ state->fd, state->xdata);
+ return 0;
err:
- server4_fstat_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_fstat_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_setxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_setxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_setxattr_cbk,
- bound_xl, bound_xl->fops->setxattr,
- &state->loc, state->dict, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_setxattr_cbk, bound_xl, bound_xl->fops->setxattr,
+ &state->loc, state->dict, state->flags, state->xdata);
+ return 0;
err:
- server4_setxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server4_setxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
-
int
-server4_getxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_getxattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_getxattr_cbk,
- bound_xl, bound_xl->fops->getxattr,
- &state->loc, state->name, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_getxattr_cbk, bound_xl, bound_xl->fops->getxattr,
+ &state->loc, state->name, state->xdata);
+ return 0;
err:
- server4_getxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_getxattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_ftruncate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_ftruncate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_ftruncate_cbk,
- bound_xl, bound_xl->fops->ftruncate,
- state->fd, state->offset, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_ftruncate_cbk, bound_xl,
+ bound_xl->fops->ftruncate, state->fd, state->offset,
+ state->xdata);
+ return 0;
err:
- server4_ftruncate_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_ftruncate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server4_flush_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_flush_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_flush_cbk,
- bound_xl, bound_xl->fops->flush, state->fd, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_flush_cbk, bound_xl, bound_xl->fops->flush,
+ state->fd, state->xdata);
+ return 0;
err:
- server4_flush_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL);
+ server4_flush_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
- return 0;
+ return 0;
}
-
int
-server4_fsync_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fsync_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fsync_cbk,
- bound_xl, bound_xl->fops->fsync,
- state->fd, state->flags, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fsync_cbk, bound_xl, bound_xl->fops->fsync,
+ state->fd, state->flags, state->xdata);
+ return 0;
err:
- server4_fsync_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_fsync_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server4_writev_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_writev_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_writev_cbk,
- bound_xl, bound_xl->fops->writev,
- state->fd, state->payload_vector, state->payload_count,
- state->offset, state->flags, state->iobref, state->xdata);
+ STACK_WIND(frame, server4_writev_cbk, bound_xl, bound_xl->fops->writev,
+ state->fd, state->payload_vector, state->payload_count,
+ state->offset, state->flags, state->iobref, state->xdata);
- return 0;
+ return 0;
err:
- server4_writev_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_writev_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_readv_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_readv_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_readv_cbk,
- bound_xl, bound_xl->fops->readv,
- state->fd, state->size, state->offset, state->flags, state->xdata);
+ STACK_WIND(frame, server4_readv_cbk, bound_xl, bound_xl->fops->readv,
+ state->fd, state->size, state->offset, state->flags,
+ state->xdata);
- return 0;
+ return 0;
err:
- server4_readv_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, 0, NULL, NULL, NULL);
- return 0;
+ server4_readv_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, 0, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_create_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_create_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ?
- uuid_utoa (state->loc.inode->gfid):NULL);
- state->resolve.op_ret = -1;
- state->resolve.op_errno = ENOMEM;
- goto err;
- }
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ? uuid_utoa(state->loc.inode->gfid) : NULL);
+ state->resolve.op_ret = -1;
+ state->resolve.op_errno = ENOMEM;
+ goto err;
+ }
+ state->fd->flags = state->flags;
- STACK_WIND (frame, server4_create_cbk,
- bound_xl, bound_xl->fops->create,
- &(state->loc), state->flags, state->mode,
- state->umask, state->fd, state->xdata);
+ STACK_WIND(frame, server4_create_cbk, bound_xl, bound_xl->fops->create,
+ &(state->loc), state->flags, state->mode, state->umask,
+ state->fd, state->xdata);
- return 0;
+ return 0;
err:
- server4_create_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL,
- NULL, NULL, NULL);
- return 0;
+ server4_create_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ return 0;
}
-
int
-server4_open_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_open_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->fd = fd_create (state->loc.inode, frame->root->pid);
- state->fd->flags = state->flags;
+ state->fd = fd_create(state->loc.inode, frame->root->pid);
+ state->fd->flags = state->flags;
- STACK_WIND (frame, server4_open_cbk,
- bound_xl, bound_xl->fops->open,
- &state->loc, state->flags, state->fd, state->xdata);
+ STACK_WIND(frame, server4_open_cbk, bound_xl, bound_xl->fops->open,
+ &state->loc, state->flags, state->fd, state->xdata);
- return 0;
+ return 0;
err:
- server4_open_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_open_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
-
int
-server4_readlink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_readlink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_readlink_cbk,
- bound_xl, bound_xl->fops->readlink,
- &state->loc, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_readlink_cbk, bound_xl, bound_xl->fops->readlink,
+ &state->loc, state->size, state->xdata);
+ return 0;
err:
- server4_readlink_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_readlink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_fsetattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fsetattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fsetattr_cbk,
- bound_xl, bound_xl->fops->fsetattr,
- state->fd, &state->stbuf, state->valid, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fsetattr_cbk, bound_xl, bound_xl->fops->fsetattr,
+ state->fd, &state->stbuf, state->valid, state->xdata);
+ return 0;
err:
- server4_fsetattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_fsetattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server4_setattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_setattr_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_setattr_cbk,
- bound_xl, bound_xl->fops->setattr,
- &state->loc, &state->stbuf, state->valid, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_setattr_cbk, bound_xl, bound_xl->fops->setattr,
+ &state->loc, &state->stbuf, state->valid, state->xdata);
+ return 0;
err:
- server4_setattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_setattr_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
-
int
-server4_stat_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_stat_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_stat_cbk,
- bound_xl, bound_xl->fops->stat, &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_stat_cbk, bound_xl, bound_xl->fops->stat,
+ &state->loc, state->xdata);
+ return 0;
err:
- server4_stat_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
+ server4_stat_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_lookup_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_lookup_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- if (!state->loc.inode)
- state->loc.inode = server_inode_new (state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
+ if (!state->loc.inode)
+ state->loc.inode = server_inode_new(state->itable, state->loc.gfid);
+ else
+ state->is_revalidate = 1;
- STACK_WIND (frame, server4_lookup_cbk,
- bound_xl, bound_xl->fops->lookup,
- &state->loc, state->xdata);
+ STACK_WIND(frame, server4_lookup_cbk, bound_xl, bound_xl->fops->lookup,
+ &state->loc, state->xdata);
- return 0;
+ return 0;
err:
- server4_lookup_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL, NULL);
+ server4_lookup_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server4_fallocate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_fallocate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_fallocate_cbk,
- bound_xl, bound_xl->fops->fallocate,
- state->fd, state->flags, state->offset, state->size,
- state->xdata);
- return 0;
+ STACK_WIND(frame, server4_fallocate_cbk, bound_xl,
+ bound_xl->fops->fallocate, state->fd, state->flags,
+ state->offset, state->size, state->xdata);
+ return 0;
err:
- server4_fallocate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_fallocate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server4_discard_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_discard_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_discard_cbk,
- bound_xl, bound_xl->fops->discard,
- state->fd, state->offset, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_discard_cbk, bound_xl, bound_xl->fops->discard,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
err:
- server4_discard_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_discard_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server4_zerofill_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_zerofill_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_zerofill_cbk,
- bound_xl, bound_xl->fops->zerofill,
- state->fd, state->offset, state->size, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_zerofill_cbk, bound_xl, bound_xl->fops->zerofill,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
err:
- server4_zerofill_cbk(frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
+ server4_zerofill_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ return 0;
}
int
-server4_seek_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_seek_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_seek_cbk, bound_xl, bound_xl->fops->seek,
- state->fd, state->offset, state->what, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_seek_cbk, bound_xl, bound_xl->fops->seek,
+ state->fd, state->offset, state->what, state->xdata);
+ return 0;
err:
- server4_seek_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, 0, NULL);
+ server4_seek_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, 0, NULL);
- return 0;
+ return 0;
}
static int
-server4_getactivelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_getactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
lock_migration_info_t *locklist, dict_t *xdata)
{
- gfx_getactivelk_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
+ gfx_getactivelk_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- dict_to_xdr (xdata, &rsp.xdata);
+ dict_to_xdr(xdata, &rsp.xdata);
- if (op_ret < 0) {
- state = CALL_STATE (frame);
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
- gf_msg (this->name, GF_LOG_INFO,
- op_errno, 0,
- "%"PRId64": GETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->loc.path, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
+ gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
+ "%" PRId64
+ ": GETACTIVELK %s (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
- goto out;
- }
+ goto out;
+ }
- /* (op_ret == 0) means there are no locks on the file*/
- if (op_ret > 0) {
- ret = serialize_rsp_locklist_v2 (locklist, &rsp);
- if (ret == -1) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
+ /* (op_ret == 0) means there are no locks on the file*/
+ if (op_ret > 0) {
+ ret = serialize_rsp_locklist_v2(locklist, &rsp);
+ if (ret == -1) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
}
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- req = frame->local;
+ req = frame->local;
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_getactivelk_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_getactivelk_rsp);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- getactivelkinfo_rsp_cleanup_v2 (&rsp);
+ getactivelkinfo_rsp_cleanup_v2(&rsp);
- return 0;
+ return 0;
}
int
-server4_getactivelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_getactivelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_getactivelk_cbk, bound_xl,
- bound_xl->fops->getactivelk, &state->loc, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_getactivelk_cbk, bound_xl,
+ bound_xl->fops->getactivelk, &state->loc, state->xdata);
+ return 0;
err:
- server4_getactivelk_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
- return 0;
-
+ server4_getactivelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL);
+ return 0;
}
int
-server4_setactivelk_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_setactivelk_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- STACK_WIND (frame, server4_setactivelk_cbk,
- bound_xl, bound_xl->fops->setactivelk, &state->loc,
- &state->locklist, state->xdata);
- return 0;
+ STACK_WIND(frame, server4_setactivelk_cbk, bound_xl,
+ bound_xl->fops->setactivelk, &state->loc, &state->locklist,
+ state->xdata);
+ return 0;
err:
- server4_setactivelk_cbk (frame, NULL, frame->this,
- state->resolve.op_ret,
- state->resolve.op_errno, NULL);
- return 0;
-
+ server4_setactivelk_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL);
+ return 0;
}
int
-server4_namelink_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_namelink_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_namelink_cbk,
- bound_xl, bound_xl->fops->namelink,
- &(state->loc), state->xdata);
- return 0;
+ STACK_WIND(frame, server4_namelink_cbk, bound_xl, bound_xl->fops->namelink,
+ &(state->loc), state->xdata);
+ return 0;
- err:
- server4_namelink_cbk (frame, NULL,
- frame->this,
- state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+err:
+ server4_namelink_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
int
-server4_icreate_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_icreate_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
+ server_state_t *state = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0)
- goto err;
+ if (state->resolve.op_ret != 0)
+ goto err;
- state->loc.inode = inode_new (state->itable);
+ state->loc.inode = inode_new(state->itable);
- STACK_WIND (frame, server4_icreate_cbk,
- bound_xl, bound_xl->fops->icreate,
- &(state->loc), state->mode, state->xdata);
+ STACK_WIND(frame, server4_icreate_cbk, bound_xl, bound_xl->fops->icreate,
+ &(state->loc), state->mode, state->xdata);
- return 0;
+ return 0;
err:
- server4_icreate_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL, NULL);
- return 0;
+ server4_icreate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+ return 0;
}
-
int
-server4_0_stat (rpcsvc_request_t *req)
+server4_0_stat(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_stat_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_stat_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return 0;
+ if (!req)
+ return 0;
- /* Initialize args first, then decode */
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_stat_req, GF_FOP_STAT);
- if (ret != 0) {
- goto out;
- }
+ /* Initialize args first, then decode */
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_stat_req,
+ GF_FOP_STAT);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_stat_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_stat_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
-server4_0_setattr (rpcsvc_request_t *req)
+server4_0_setattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_setattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_setattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return 0;
+ if (!req)
+ return 0;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_setattr_req, GF_FOP_SETATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_setattr_req, GF_FOP_SETATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- gfx_stat_to_iattx (&args.stbuf, &state->stbuf);
- state->valid = args.valid;
+ gfx_stat_to_iattx(&args.stbuf, &state->stbuf);
+ state->valid = args.valid;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_setattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_setattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
-
-
- return ret;
+ return ret;
}
-
int
server4_0_fallocate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fallocate_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fallocate_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fallocate_req, GF_FOP_FALLOCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fallocate_req, GF_FOP_FALLOCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->flags = args.flags;
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fallocate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fallocate_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
server4_0_discard(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_discard_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_discard_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_discard_req, GF_FOP_DISCARD);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_discard_req, GF_FOP_DISCARD);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_discard_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_discard_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
server4_0_zerofill(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_zerofill_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_zerofill_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_zerofill_req, GF_FOP_ZEROFILL);
- if (ret != 0) {
- op_errno = -1;
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_zerofill_req, GF_FOP_ZEROFILL);
+ if (ret != 0) {
+ op_errno = -1;
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_zerofill_resume);
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ resolve_and_resume(frame, server4_zerofill_resume);
out:
- if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ if (op_errno)
+ req->rpc_err = GARBAGE_ARGS;
- return ret;
+ return ret;
}
int
-server4_0_ipc (rpcsvc_request_t *req)
+server4_0_ipc(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_ipc_req args = {0,};
- int ret = -1;
- int op_errno = 0;
- xlator_t *bound_xl = NULL;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_ipc_req args = {
+ 0,
+ };
+ int ret = -1;
+ int op_errno = 0;
+ xlator_t *bound_xl = NULL;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_ipc_req, GF_FOP_IPC);
- if (ret != 0) {
- op_errno = -1;
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_ipc_req,
+ GF_FOP_IPC);
+ if (ret != 0) {
+ op_errno = -1;
+ goto out;
+ }
- bound_xl = frame->root->client->bound_xl;
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- STACK_WIND (frame, server4_ipc_cbk, bound_xl, bound_xl->fops->ipc,
- args.op, state->xdata);
+ bound_xl = frame->root->client->bound_xl;
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ STACK_WIND(frame, server4_ipc_cbk, bound_xl, bound_xl->fops->ipc, args.op,
+ state->xdata);
out:
+ if (op_errno)
+ req->rpc_err = GARBAGE_ARGS;
- if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
-
- return ret;
+ return ret;
}
int
-server4_0_seek (rpcsvc_request_t *req)
+server4_0_seek(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_seek_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_seek_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_seek_req, GF_FOP_SEEK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_seek_req,
+ GF_FOP_SEEK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->what = args.what;
- memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
+ state->what = args.what;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_seek_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_seek_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_readlink (rpcsvc_request_t *req)
+server4_0_readlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_readlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_readlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_readlink_req, GF_FOP_READLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_readlink_req, GF_FOP_READLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->size = args.size;
+ state->size = args.size;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_readlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_readlink_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
-server4_0_create (rpcsvc_request_t *req)
+server4_0_create(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_create_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_create_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_create_req, GF_FOP_CREATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_create_req, GF_FOP_CREATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.bname = gf_strdup (args.bname);
- state->mode = args.mode;
- state->umask = args.umask;
- state->flags = gf_flags_to_flags (args.flags);
+ state->resolve.bname = gf_strdup(args.bname);
+ state->mode = args.mode;
+ state->umask = args.umask;
+ state->flags = gf_flags_to_flags(args.flags);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_create_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_create_resume);
out:
- free (args.bname);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_open (rpcsvc_request_t *req)
+server4_0_open(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_open_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_open_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_open_req, GF_FOP_OPEN);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_open_req,
+ GF_FOP_OPEN);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->flags = gf_flags_to_flags (args.flags);
+ state->flags = gf_flags_to_flags(args.flags);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_open_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_open_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
-
-
- return ret;
+ return ret;
}
-
int
-server4_0_readv (rpcsvc_request_t *req)
+server4_0_readv(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_read_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_read_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- goto out;
+ if (!req)
+ goto out;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_read_req, GF_FOP_READ);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_read_req,
+ GF_FOP_READ);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->size = args.size;
- state->offset = args.offset;
- state->flags = args.flag;
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->size = args.size;
+ state->offset = args.offset;
+ state->flags = args.flag;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_readv_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_readv_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_writev (rpcsvc_request_t *req)
+server4_0_writev(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_write_req args = {{0,},};
- ssize_t len = 0;
- int i = 0;
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_write_req args = {
+ {
+ 0,
+ },
+ };
+ ssize_t len = 0;
+ int i = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- if (!req)
- return ret;
+ ret = rpc_receive_common(req, &frame, &state, &len, &args,
+ xdr_gfx_write_req, GF_FOP_WRITE);
+ if (ret != 0) {
+ goto out;
+ }
- ret = rpc_receive_common (req, &frame, &state, &len, &args,
- xdr_gfx_write_req, GF_FOP_WRITE);
- if (ret != 0) {
- goto out;
- }
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ state->size = args.size;
+ state->flags = args.flag;
+ state->iobref = iobref_ref(req->iobref);
+ memcpy(state->resolve.gfid, args.gfid, 16);
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.size;
- state->flags = args.flag;
- state->iobref = iobref_ref (req->iobref);
- memcpy (state->resolve.gfid, args.gfid, 16);
-
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base
- = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len
- = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
+ if (len < req->msg[0].iov_len) {
+ state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
+ state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
+ state->payload_count = 1;
+ }
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++]
- = req->msg[i];
- }
+ for (i = 1; i < req->count; i++) {
+ state->payload_vector[state->payload_count++] = req->msg[i];
+ }
- len = iov_length (state->payload_vector, state->payload_count);
+ len = iov_length(state->payload_vector, state->payload_count);
- GF_ASSERT (state->size == len);
+ GF_ASSERT(state->size == len);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (state->xdata);
+ dict_dump_to_log(state->xdata);
#endif
- ret = 0;
- resolve_and_resume (frame, server4_writev_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_writev_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
#define SERVER4_0_VECWRITE_START 0
#define SERVER4_0_VECWRITE_READING_HDR 1
#define SERVER4_0_VECWRITE_READING_OPAQUE 2
int
-server4_0_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
- char *curr_addr)
+server4_0_writev_vecsizer(int state, ssize_t *readsize, char *base_addr,
+ char *curr_addr)
{
- ssize_t size = 0;
- int nextstate = 0;
- gfx_write_req write_req = {{0,},};
- XDR xdr;
+ ssize_t size = 0;
+ int nextstate = 0;
+ gfx_write_req write_req = {
+ {
+ 0,
+ },
+ };
+ XDR xdr;
- switch (state) {
+ switch (state) {
case SERVER4_0_VECWRITE_START:
- size = xdr_sizeof ((xdrproc_t) xdr_gfx_write_req,
- &write_req);
- *readsize = size;
+ size = xdr_sizeof((xdrproc_t)xdr_gfx_write_req, &write_req);
+ *readsize = size;
- nextstate = SERVER4_0_VECWRITE_READING_HDR;
- break;
+ nextstate = SERVER4_0_VECWRITE_READING_HDR;
+ break;
case SERVER4_0_VECWRITE_READING_HDR:
- size = xdr_sizeof ((xdrproc_t) xdr_gfx_write_req,
- &write_req);
+ size = xdr_sizeof((xdrproc_t)xdr_gfx_write_req, &write_req);
- xdrmem_create (&xdr, base_addr, size, XDR_DECODE);
+ xdrmem_create(&xdr, base_addr, size, XDR_DECODE);
- /* This will fail if there is xdata sent from client, if not,
- well and good */
- xdr_gfx_write_req (&xdr, &write_req);
+ /* This will fail if there is xdata sent from client, if not,
+ well and good */
+ xdr_gfx_write_req(&xdr, &write_req);
- /* need to round off to proper roof (%4), as XDR packing pads
- the end of opaque object with '0' */
- size = roof (write_req.xdata.xdr_size, 4);
+ /* need to round off to proper roof (%4), as XDR packing pads
+ the end of opaque object with '0' */
+ size = roof(write_req.xdata.xdr_size, 4);
- *readsize = size;
+ *readsize = size;
- if (!size)
- nextstate = SERVER4_0_VECWRITE_START;
- else
- nextstate = SERVER4_0_VECWRITE_READING_OPAQUE;
+ if (!size)
+ nextstate = SERVER4_0_VECWRITE_START;
+ else
+ nextstate = SERVER4_0_VECWRITE_READING_OPAQUE;
- free (write_req.xdata.pairs.pairs_val);
+ free(write_req.xdata.pairs.pairs_val);
- break;
+ break;
case SERVER4_0_VECWRITE_READING_OPAQUE:
- *readsize = 0;
- nextstate = SERVER4_0_VECWRITE_START;
- break;
- }
+ *readsize = 0;
+ nextstate = SERVER4_0_VECWRITE_START;
+ break;
+ }
- return nextstate;
+ return nextstate;
}
-
int
-server4_0_release (rpcsvc_request_t *req)
+server4_0_release(rpcsvc_request_t *req)
{
- client_t *client = NULL;
- server_ctx_t *serv_ctx = NULL;
- gfx_release_req args = {{0,},};
- gfx_common_rsp rsp = {0,};
- int ret = -1;
-
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gfx_release_req);
- if (ret < 0) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- client = req->trans->xl_private;
- if (!client) {
- /* Handshake is not complete yet. */
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- serv_ctx = server_ctx_get (client, client->this);
- if (serv_ctx == NULL) {
- gf_msg (req->trans->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- gf_fd_put (serv_ctx->fdtable, args.fd);
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
-
- ret = 0;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfx_release_req args = {
+ {
+ 0,
+ },
+ };
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = -1;
+
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gfx_release_req);
+ if (ret < 0) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ client = req->trans->xl_private;
+ if (!client) {
+ /* Handshake is not complete yet. */
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ serv_ctx = server_ctx_get(client, client->this);
+ if (serv_ctx == NULL) {
+ gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put(serv_ctx->fdtable, args.fd);
+
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-server4_0_releasedir (rpcsvc_request_t *req)
+server4_0_releasedir(rpcsvc_request_t *req)
{
- client_t *client = NULL;
- server_ctx_t *serv_ctx = NULL;
- gfx_releasedir_req args = {{0,},};
- gfx_common_rsp rsp = {0,};
- int ret = -1;
-
- ret = xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gfx_release_req);
- if (ret < 0) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- client = req->trans->xl_private;
- if (!client) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
-
- serv_ctx = server_ctx_get (client, client->this);
- if (serv_ctx == NULL) {
- gf_msg (req->trans->name, GF_LOG_INFO, 0,
- PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
- "failed");
- req->rpc_err = SYSTEM_ERR;
- goto out;
- }
-
- gf_fd_put (serv_ctx->fdtable, args.fd);
-
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
-
- ret = 0;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfx_releasedir_req args = {
+ {
+ 0,
+ },
+ };
+ gfx_common_rsp rsp = {
+ 0,
+ };
+ int ret = -1;
+
+ ret = xdr_to_generic(req->msg[0], &args, (xdrproc_t)xdr_gfx_release_req);
+ if (ret < 0) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ client = req->trans->xl_private;
+ if (!client) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
+
+ serv_ctx = server_ctx_get(client, client->this);
+ if (serv_ctx == NULL) {
+ gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() "
+ "failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put(serv_ctx->fdtable, args.fd);
+
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
+
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
int
-server4_0_fsync (rpcsvc_request_t *req)
+server4_0_fsync(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fsync_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fsync_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fsync_req, GF_FOP_FSYNC);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fsync_req, GF_FOP_FSYNC);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.data;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.data;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fsync_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fsync_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
-
int
-server4_0_flush (rpcsvc_request_t *req)
+server4_0_flush(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_flush_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_flush_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_flush_req, GF_FOP_FLUSH);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_flush_req, GF_FOP_FLUSH);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_flush_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_flush_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
-
int
-server4_0_ftruncate (rpcsvc_request_t *req)
+server4_0_ftruncate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_ftruncate_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_ftruncate_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_ftruncate_req, GF_FOP_FTRUNCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_ftruncate_req, GF_FOP_FTRUNCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_ftruncate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_ftruncate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_fstat (rpcsvc_request_t *req)
+server4_0_fstat(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fstat_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fstat_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fstat_req, GF_FOP_FSTAT);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fstat_req, GF_FOP_FSTAT);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fstat_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fstat_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_truncate (rpcsvc_request_t *req)
+server4_0_truncate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_truncate_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_truncate_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_truncate_req, GF_FOP_TRUNCATE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_truncate_req, GF_FOP_TRUNCATE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.gfid, 16);
- state->offset = args.offset;
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.gfid, 16);
+ state->offset = args.offset;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_truncate_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_truncate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server4_0_unlink (rpcsvc_request_t *req)
+server4_0_unlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_unlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_unlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_unlink_req, GF_FOP_UNLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_unlink_req, GF_FOP_UNLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(args.bname);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- state->flags = args.xflags;
+ state->flags = args.xflags;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_unlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_unlink_resume);
out:
- free (args.bname);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_setxattr (rpcsvc_request_t *req)
+server4_0_setxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_setxattr_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_setxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_setxattr_req, GF_FOP_SETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_setxattr_req, GF_FOP_SETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict (&args.dict, &state->dict);
- if (ret)
- gf_msg_debug (THIS->name, EINVAL,
- "dictionary not received");
+ ret = xdr_to_dict(&args.dict, &state->dict);
+ if (ret)
+ gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
- /* There can be some commands hidden in key, check and proceed */
- gf_server_check_setxattr_cmd (frame, state->dict);
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_setxattr_cmd(frame, state->dict);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_setxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_setxattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server4_0_fsetxattr (rpcsvc_request_t *req)
+server4_0_fsetxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fsetxattr_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fsetxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fsetxattr_req, GF_FOP_FSETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fsetxattr_req, GF_FOP_FSETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict (&args.dict, &state->dict);
- if (ret)
- gf_msg_debug (THIS->name, EINVAL,
- "dictionary not received");
+ ret = xdr_to_dict(&args.dict, &state->dict);
+ if (ret)
+ gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fsetxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fsetxattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server4_0_fxattrop (rpcsvc_request_t *req)
+server4_0_fxattrop(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fxattrop_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fxattrop_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fxattrop_req, GF_FOP_FXATTROP);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fxattrop_req, GF_FOP_FXATTROP);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict (&args.dict, &state->dict);
- if (ret)
- gf_msg_debug (THIS->name, EINVAL,
- "dictionary not received");
+ ret = xdr_to_dict(&args.dict, &state->dict);
+ if (ret)
+ gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fxattrop_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fxattrop_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_xattrop (rpcsvc_request_t *req)
+server4_0_xattrop(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_xattrop_req args = {{0,},};
- int32_t ret = -1;
- int32_t op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_xattrop_req args = {
+ {
+ 0,
+ },
+ };
+ int32_t ret = -1;
+ int32_t op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_xattrop_req, GF_FOP_XATTROP);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_xattrop_req, GF_FOP_XATTROP);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->flags = args.flags;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->flags = args.flags;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict (&args.dict, &state->dict);
- if (ret)
- gf_msg_debug (THIS->name, EINVAL,
- "dictionary not received");
+ ret = xdr_to_dict(&args.dict, &state->dict);
+ if (ret)
+ gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_xattrop_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_xattrop_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_getxattr (rpcsvc_request_t *req)
+server4_0_getxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_getxattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_getxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_getxattr_req, GF_FOP_GETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_getxattr_req, GF_FOP_GETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen) {
- state->name = gf_strdup (args.name);
- /* There can be some commands hidden in key, check and proceed */
- gf_server_check_getxattr_cmd (frame, state->name);
- }
+ if (args.namelen) {
+ state->name = gf_strdup(args.name);
+ /* There can be some commands hidden in key, check and proceed */
+ gf_server_check_getxattr_cmd(frame, state->name);
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_getxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_getxattr_resume);
out:
- free (args.name);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_fgetxattr (rpcsvc_request_t *req)
+server4_0_fgetxattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fgetxattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fgetxattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fgetxattr_req, GF_FOP_FGETXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fgetxattr_req, GF_FOP_FGETXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fgetxattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fgetxattr_resume);
out:
- free (args.name);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server4_0_removexattr (rpcsvc_request_t *req)
+server4_0_removexattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_removexattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_removexattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_removexattr_req,
- GF_FOP_REMOVEXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_removexattr_req, GF_FOP_REMOVEXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->name = gf_strdup(args.name);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_removexattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_removexattr_resume);
out:
- free (args.name);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_fremovexattr (rpcsvc_request_t *req)
+server4_0_fremovexattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fremovexattr_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fremovexattr_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fremovexattr_req,
- GF_FOP_FREMOVEXATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fremovexattr_req, GF_FOP_FREMOVEXATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->name = gf_strdup (args.name);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->name = gf_strdup(args.name);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fremovexattr_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fremovexattr_resume);
out:
- free (args.name);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
-
int
-server4_0_opendir (rpcsvc_request_t *req)
+server4_0_opendir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_opendir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_opendir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_opendir_req, GF_FOP_OPENDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_opendir_req, GF_FOP_OPENDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_opendir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_opendir_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
-server4_0_readdirp (rpcsvc_request_t *req)
+server4_0_readdirp(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_readdirp_req args = {{0,},};
- size_t headers_size = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_readdirp_req,
- GF_FOP_READDIRP);
- if (ret != 0) {
- goto out;
- }
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_readdirp_req args = {
+ {
+ 0,
+ },
+ };
+ size_t headers_size = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- /* FIXME: this should go away when variable sized iobufs are introduced
- * and transport layer can send msgs bigger than current page-size.
- */
- headers_size = sizeof (struct rpc_msg) + sizeof (gfx_readdir_rsp);
- if ((frame->this->ctx->page_size < args.size)
- || ((frame->this->ctx->page_size - args.size) < headers_size)) {
- state->size = frame->this->ctx->page_size - headers_size;
- } else {
- state->size = args.size;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_readdirp_req, GF_FOP_READDIRP);
+ if (ret != 0) {
+ goto out;
+ }
+
+ /* FIXME: this should go away when variable sized iobufs are introduced
+ * and transport layer can send msgs bigger than current page-size.
+ */
+ headers_size = sizeof(struct rpc_msg) + sizeof(gfx_readdir_rsp);
+ if ((frame->this->ctx->page_size < args.size) ||
+ ((frame->this->ctx->page_size - args.size) < headers_size)) {
+ state->size = frame->this->ctx->page_size - headers_size;
+ } else {
+ state->size = args.size;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- /* here, dict itself works as xdata */
- xdr_to_dict (&args.xdata, &state->xdata);
+ /* here, dict itself works as xdata */
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_readdirp_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_readdirp_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_readdir (rpcsvc_request_t *req)
+server4_0_readdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_readdir_req args = {{0,},};
- size_t headers_size = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_readdir_req, GF_FOP_READDIR);
- if (ret != 0) {
- goto out;
- }
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_readdir_req args = {
+ {
+ 0,
+ },
+ };
+ size_t headers_size = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- /* FIXME: this should go away when variable sized iobufs are introduced
- * and transport layer can send msgs bigger than current page-size.
- */
- headers_size = sizeof (struct rpc_msg) + sizeof (gfx_readdir_rsp);
- if ((frame->this->ctx->page_size < args.size)
- || ((frame->this->ctx->page_size - args.size) < headers_size)) {
- state->size = frame->this->ctx->page_size - headers_size;
- } else {
- state->size = args.size;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_readdir_req, GF_FOP_READDIR);
+ if (ret != 0) {
+ goto out;
+ }
+
+ /* FIXME: this should go away when variable sized iobufs are introduced
+ * and transport layer can send msgs bigger than current page-size.
+ */
+ headers_size = sizeof(struct rpc_msg) + sizeof(gfx_readdir_rsp);
+ if ((frame->this->ctx->page_size < args.size) ||
+ ((frame->this->ctx->page_size - args.size) < headers_size)) {
+ state->size = frame->this->ctx->page_size - headers_size;
+ } else {
+ state->size = args.size;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_readdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_readdir_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
int
-server4_0_fsyncdir (rpcsvc_request_t *req)
+server4_0_fsyncdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fsyncdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fsyncdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fsyncdir_req, GF_FOP_FSYNCDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fsyncdir_req, GF_FOP_FSYNCDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- state->flags = args.data;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ state->flags = args.data;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fsyncdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fsyncdir_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
-
int
-server4_0_mknod (rpcsvc_request_t *req)
+server4_0_mknod(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_mknod_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_mknod_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_mknod_req, GF_FOP_MKNOD);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_mknod_req, GF_FOP_MKNOD);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.bname = gf_strdup(args.bname);
- state->mode = args.mode;
- state->dev = args.dev;
- state->umask = args.umask;
+ state->mode = args.mode;
+ state->dev = args.dev;
+ state->umask = args.umask;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_mknod_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_mknod_resume);
out:
- free (args.bname);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
+ return ret;
}
-
int
-server4_0_mkdir (rpcsvc_request_t *req)
+server4_0_mkdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_mkdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_mkdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_mkdir_req, GF_FOP_MKDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_mkdir_req, GF_FOP_MKDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
- state->mode = args.mode;
- state->umask = args.umask;
+ state->mode = args.mode;
+ state->umask = args.umask;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_mkdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_mkdir_resume);
out:
- free (args.bname);
-
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ free(args.bname);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
-
- return ret;
+ return ret;
}
-
int
-server4_0_rmdir (rpcsvc_request_t *req)
+server4_0_rmdir(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_rmdir_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_rmdir_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_rmdir_req, GF_FOP_RMDIR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_rmdir_req, GF_FOP_RMDIR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
- state->flags = args.xflags;
+ state->flags = args.xflags;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_rmdir_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_rmdir_resume);
out:
- free (args.bname);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
-
int
-server4_0_inodelk (rpcsvc_request_t *req)
+server4_0_inodelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_inodelk_req args = {{0,},};
- int cmd = 0;
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_inodelk_req args = {
+ {
+ 0,
+ },
+ };
+ int cmd = 0;
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_inodelk_req, GF_FOP_INODELK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_inodelk_req, GF_FOP_INODELK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- cmd = args.cmd;
- switch (cmd) {
+ cmd = args.cmd;
+ switch (cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
- }
+ state->cmd = F_SETLKW;
+ break;
+ }
- state->type = args.type;
- state->volume = gf_strdup (args.volume);
+ state->type = args.type;
+ state->volume = gf_strdup(args.volume);
- gf_proto_flock_to_flock (&args.flock, &state->flock);
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
- }
+ state->flock.l_type = F_UNLCK;
+ break;
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_inodelk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_inodelk_resume);
out:
- free (args.volume);
+ free(args.volume);
- free (args.flock.lk_owner.lk_owner_val);
+ free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_finodelk (rpcsvc_request_t *req)
+server4_0_finodelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_finodelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_finodelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_finodelk_req,
- GF_FOP_FINODELK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_finodelk_req, GF_FOP_FINODELK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- state->volume = gf_strdup (args.volume);
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ state->volume = gf_strdup(args.volume);
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- switch (state->cmd) {
+ switch (state->cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
- }
+ state->cmd = F_SETLKW;
+ break;
+ }
- state->type = args.type;
+ state->type = args.type;
- gf_proto_flock_to_flock (&args.flock, &state->flock);
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
- }
+ state->flock.l_type = F_UNLCK;
+ break;
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_finodelk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_finodelk_resume);
out:
- free (args.volume);
+ free(args.volume);
- free (args.flock.lk_owner.lk_owner_val);
+ free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_entrylk (rpcsvc_request_t *req)
+server4_0_entrylk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_entrylk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_entrylk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_entrylk_req,
- GF_FOP_ENTRYLK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_entrylk_req, GF_FOP_ENTRYLK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
- state->volume = gf_strdup (args.volume);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
+ state->volume = gf_strdup(args.volume);
- state->cmd = args.cmd;
- state->type = args.type;
+ state->cmd = args.cmd;
+ state->type = args.type;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_entrylk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_entrylk_resume);
out:
- free (args.volume);
- free (args.name);
+ free(args.volume);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_fentrylk (rpcsvc_request_t *req)
+server4_0_fentrylk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fentrylk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fentrylk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fentrylk_req,
- GF_FOP_FENTRYLK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fentrylk_req, GF_FOP_FENTRYLK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_EXACT;
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- state->type = args.type;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_EXACT;
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ state->type = args.type;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- if (args.namelen)
- state->name = gf_strdup (args.name);
- state->volume = gf_strdup (args.volume);
+ if (args.namelen)
+ state->name = gf_strdup(args.name);
+ state->volume = gf_strdup(args.volume);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fentrylk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_fentrylk_resume);
out:
- free (args.volume);
- free (args.name);
+ free(args.volume);
+ free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_access (rpcsvc_request_t *req)
+server4_0_access(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_access_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_access_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_access_req, GF_FOP_ACCESS);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_access_req, GF_FOP_ACCESS);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- state->mask = args.mask;
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ state->mask = args.mask;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_access_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_access_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
-
int
-server4_0_symlink (rpcsvc_request_t *req)
+server4_0_symlink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_symlink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_symlink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_symlink_req, GF_FOP_SYMLINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_symlink_req, GF_FOP_SYMLINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_NOT;
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
- state->name = gf_strdup (args.linkname);
- state->umask = args.umask;
+ state->resolve.type = RESOLVE_NOT;
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
+ state->name = gf_strdup(args.linkname);
+ state->umask = args.umask;
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_symlink_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_symlink_resume);
out:
- free (args.bname);
- free (args.linkname);
+ free(args.bname);
+ free(args.linkname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_link (rpcsvc_request_t *req)
+server4_0_link(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_link_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_link_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_link_req, GF_FOP_LINK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_link_req,
+ GF_FOP_LINK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- memcpy (state->resolve.gfid, args.oldgfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ memcpy(state->resolve.gfid, args.oldgfid, 16);
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup (args.newbname);
- set_resolve_gfid (frame->root->client, state->resolve2.pargfid,
- args.newgfid);
+ state->resolve2.type = RESOLVE_NOT;
+ state->resolve2.bname = gf_strdup(args.newbname);
+ set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
+ args.newgfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_link_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_link_resume);
out:
- free (args.newbname);
+ free(args.newbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_rename (rpcsvc_request_t *req)
+server4_0_rename(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_rename_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_rename_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_rename_req, GF_FOP_RENAME);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_rename_req, GF_FOP_RENAME);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup (args.oldbname);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.oldgfid);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup(args.oldbname);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.oldgfid);
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup (args.newbname);
- set_resolve_gfid (frame->root->client, state->resolve2.pargfid,
- args.newgfid);
+ state->resolve2.type = RESOLVE_MAY;
+ state->resolve2.bname = gf_strdup(args.newbname);
+ set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
+ args.newgfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_rename_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_rename_resume);
out:
- free (args.oldbname);
- free (args.newbname);
+ free(args.oldbname);
+ free(args.newbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_lease (rpcsvc_request_t *req)
+server4_0_lease(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_lease_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_lease_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_lease_req, GF_FOP_LEASE);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_lease_req, GF_FOP_LEASE);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
- gf_proto_lease_to_lease (&args.lease, &state->lease);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ gf_proto_lease_to_lease(&args.lease, &state->lease);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_lease_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_lease_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
int
-server4_0_lk (rpcsvc_request_t *req)
+server4_0_lk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_lk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_lk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_lk_req, GF_FOP_LK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_lk_req,
+ GF_FOP_LK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.fd_no = args.fd;
- state->cmd = args.cmd;
- state->type = args.type;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.fd_no = args.fd;
+ state->cmd = args.cmd;
+ state->type = args.type;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- switch (state->cmd) {
+ switch (state->cmd) {
case GF_LK_GETLK:
- state->cmd = F_GETLK;
- break;
+ state->cmd = F_GETLK;
+ break;
case GF_LK_SETLK:
- state->cmd = F_SETLK;
- break;
+ state->cmd = F_SETLK;
+ break;
case GF_LK_SETLKW:
- state->cmd = F_SETLKW;
- break;
+ state->cmd = F_SETLKW;
+ break;
case GF_LK_RESLK_LCK:
- state->cmd = F_RESLK_LCK;
- break;
+ state->cmd = F_RESLK_LCK;
+ break;
case GF_LK_RESLK_LCKW:
- state->cmd = F_RESLK_LCKW;
- break;
+ state->cmd = F_RESLK_LCKW;
+ break;
case GF_LK_RESLK_UNLCK:
- state->cmd = F_RESLK_UNLCK;
- break;
+ state->cmd = F_RESLK_UNLCK;
+ break;
case GF_LK_GETLK_FD:
- state->cmd = F_GETLK_FD;
- break;
+ state->cmd = F_GETLK_FD;
+ break;
+ }
- }
-
-
- gf_proto_flock_to_flock (&args.flock, &state->flock);
+ gf_proto_flock_to_flock(&args.flock, &state->flock);
- switch (state->type) {
+ switch (state->type) {
case GF_LK_F_RDLCK:
- state->flock.l_type = F_RDLCK;
- break;
+ state->flock.l_type = F_RDLCK;
+ break;
case GF_LK_F_WRLCK:
- state->flock.l_type = F_WRLCK;
- break;
+ state->flock.l_type = F_WRLCK;
+ break;
case GF_LK_F_UNLCK:
- state->flock.l_type = F_UNLCK;
- break;
+ state->flock.l_type = F_UNLCK;
+ break;
default:
- gf_msg (frame->root->client->bound_xl->name, GF_LOG_ERROR,
- 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s): Unknown "
- "lock type: %"PRId32"!", state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid), state->type);
- break;
- }
-
-
- xdr_to_dict (&args.xdata, &state->xdata);
-
- ret = 0;
- resolve_and_resume (frame, server4_lk_resume);
+ gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_LOCK_ERROR,
+ "fd - %" PRId64
+ " (%s): Unknown "
+ "lock type: %" PRId32 "!",
+ state->resolve.fd_no, uuid_utoa(state->fd->inode->gfid),
+ state->type);
+ break;
+ }
+
+ xdr_to_dict(&args.xdata, &state->xdata);
+
+ ret = 0;
+ resolve_and_resume(frame, server4_lk_resume);
out:
+ free(args.flock.lk_owner.lk_owner_val);
- free (args.flock.lk_owner.lk_owner_val);
-
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
int
-server4_0_null (rpcsvc_request_t *req)
+server4_0_null(rpcsvc_request_t *req)
{
- gfx_common_rsp rsp = {0,};
+ gfx_common_rsp rsp = {
+ 0,
+ };
- /* Accepted */
- rsp.op_ret = 0;
+ /* Accepted */
+ rsp.op_ret = 0;
- server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_common_rsp);
+ server_submit_reply(NULL, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_rsp);
- return 0;
+ return 0;
}
int
-server4_0_lookup (rpcsvc_request_t *req)
+server4_0_lookup(rpcsvc_request_t *req)
{
- call_frame_t *frame = NULL;
- server_state_t *state = NULL;
- gfx_lookup_req args = {{0,},};
- int ret = -1;
+ call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
+ gfx_lookup_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
- GF_VALIDATE_OR_GOTO ("server", req, err);
+ GF_VALIDATE_OR_GOTO("server", req, err);
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_lookup_req, GF_FOP_LOOKUP);
- if (ret != 0) {
- goto err;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_lookup_req, GF_FOP_LOOKUP);
+ if (ret != 0) {
+ goto err;
+ }
- state->resolve.type = RESOLVE_DONTCARE;
+ state->resolve.type = RESOLVE_DONTCARE;
- if (args.bname && strcmp (args.bname, "")) {
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
- state->resolve.bname = gf_strdup (args.bname);
- } else {
- set_resolve_gfid (frame->root->client,
- state->resolve.gfid, args.gfid);
- }
+ if (args.bname && strcmp(args.bname, "")) {
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid,
+ args.pargfid);
+ state->resolve.bname = gf_strdup(args.bname);
+ } else {
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_lookup_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_lookup_resume);
err:
- free (args.bname);
+ free(args.bname);
- return ret;
+ return ret;
}
int
-server4_0_statfs (rpcsvc_request_t *req)
+server4_0_statfs(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_statfs_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_statfs_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_statfs_req, GF_FOP_STATFS);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_statfs_req, GF_FOP_STATFS);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_statfs_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_statfs_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_getactivelk (rpcsvc_request_t *req)
+server4_0_getactivelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_getactivelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_getactivelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_getactivelk_req,
- GF_FOP_GETACTIVELK);
- if (ret != 0) {
- goto out;
- }
+ if (!req)
+ return ret;
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_getactivelk_req, GF_FOP_GETACTIVELK);
+ if (ret != 0) {
+ goto out;
+ }
- /* here, dict itself works as xdata */
- xdr_to_dict (&args.xdata, &state->xdata);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
+ /* here, dict itself works as xdata */
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_getactivelk_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_getactivelk_resume);
out:
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ return ret;
}
-
int
-server4_0_setactivelk (rpcsvc_request_t *req)
+server4_0_setactivelk(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_setactivelk_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_setactivelk_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_setactivelk_req,
- GF_FOP_SETACTIVELK);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_setactivelk_req, GF_FOP_SETACTIVELK);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- set_resolve_gfid (frame->root->client, state->resolve.gfid, args.gfid);
+ state->resolve.type = RESOLVE_MUST;
+ set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- /* here, dict itself works as xdata */
- xdr_to_dict (&args.xdata, &state->xdata);
+ /* here, dict itself works as xdata */
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = unserialize_req_locklist_v2 (&args, &state->locklist);
- if (ret)
- goto out;
+ ret = unserialize_req_locklist_v2(&args, &state->locklist);
+ if (ret)
+ goto out;
- ret = 0;
+ ret = 0;
- resolve_and_resume (frame, server4_setactivelk_resume);
+ resolve_and_resume(frame, server4_setactivelk_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_namelink (rpcsvc_request_t *req)
+server4_0_namelink(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_namelink_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_namelink_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_namelink_req, GF_FOP_NAMELINK);
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_namelink_req, GF_FOP_NAMELINK);
- if (ret != 0)
- goto out;
+ if (ret != 0)
+ goto out;
- state->resolve.bname = gf_strdup (args.bname);
- memcpy (state->resolve.pargfid, args.pargfid, sizeof (uuid_t));
+ state->resolve.bname = gf_strdup(args.bname);
+ memcpy(state->resolve.pargfid, args.pargfid, sizeof(uuid_t));
- state->resolve.type = RESOLVE_NOT;
+ state->resolve.type = RESOLVE_NOT;
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_namelink_resume);
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ resolve_and_resume(frame, server4_namelink_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
-
- return ret;
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
+ return ret;
}
int
-server4_0_icreate (rpcsvc_request_t *req)
+server4_0_icreate(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_icreate_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
- uuid_t gfid = {0,};
-
- if (!req)
- return ret;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_icreate_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
+ uuid_t gfid = {
+ 0,
+ };
+
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_icreate_req, GF_FOP_ICREATE);
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_icreate_req, GF_FOP_ICREATE);
- if (ret != 0)
- goto out;
+ if (ret != 0)
+ goto out;
- memcpy (gfid, args.gfid, sizeof (uuid_t));
+ memcpy(gfid, args.gfid, sizeof(uuid_t));
- state->mode = args.mode;
- gf_asprintf (&state->resolve.bname, INODE_PATH_FMT, uuid_utoa (gfid));
+ state->mode = args.mode;
+ gf_asprintf(&state->resolve.bname, INODE_PATH_FMT, uuid_utoa(gfid));
- /* parent is an auxiliary inode number */
- memset (state->resolve.pargfid, 0, sizeof (uuid_t));
- state->resolve.pargfid[15] = GF_AUXILLARY_PARGFID;
+ /* parent is an auxiliary inode number */
+ memset(state->resolve.pargfid, 0, sizeof(uuid_t));
+ state->resolve.pargfid[15] = GF_AUXILLARY_PARGFID;
- state->resolve.type = RESOLVE_NOT;
+ state->resolve.type = RESOLVE_NOT;
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_icreate_resume);
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ resolve_and_resume(frame, server4_icreate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_fsetattr (rpcsvc_request_t *req)
+server4_0_fsetattr(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_fsetattr_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_fsetattr_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_fsetattr_req,
- GF_FOP_FSETATTR);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_fsetattr_req, GF_FOP_FSETATTR);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = args.fd;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ memcpy(state->resolve.gfid, args.gfid, 16);
- gfx_stat_to_iattx (&args.stbuf, &state->stbuf);
- state->valid = args.valid;
+ gfx_stat_to_iattx(&args.stbuf, &state->stbuf);
+ state->valid = args.valid;
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_fsetattr_resume);
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ resolve_and_resume(frame, server4_fsetattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_rchecksum (rpcsvc_request_t *req)
+server4_0_rchecksum(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_rchecksum_req args = {{0},};
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_rchecksum_req args = {
+ {0},
+ };
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, NULL, &args,
- xdr_gfx_rchecksum_req,
- GF_FOP_RCHECKSUM);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, NULL, &args,
+ xdr_gfx_rchecksum_req, GF_FOP_RCHECKSUM);
+ if (ret != 0) {
+ goto out;
+ }
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = args.fd;
- state->offset = args.offset;
- state->size = args.len;
+ state->resolve.type = RESOLVE_MAY;
+ state->resolve.fd_no = args.fd;
+ state->offset = args.offset;
+ state->size = args.len;
- memcpy (state->resolve.gfid, args.gfid, 16);
+ memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict (&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_rchecksum_resume);
+ xdr_to_dict(&args.xdata, &state->xdata);
+ ret = 0;
+ resolve_and_resume(frame, server4_rchecksum_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_0_put (rpcsvc_request_t *req)
+server4_0_put(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_put_req args = {{0,},};
- int ret = -1;
- int op_errno = 0;
- ssize_t len = 0;
- int i = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_put_req args = {
+ {
+ 0,
+ },
+ };
+ int ret = -1;
+ int op_errno = 0;
+ ssize_t len = 0;
+ int i = 0;
+
+ if (!req)
+ return ret;
- if (!req)
- return ret;
+ ret = rpc_receive_common(req, &frame, &state, &len, &args, xdr_gfx_put_req,
+ GF_FOP_PUT);
+ if (ret != 0) {
+ goto out;
+ }
- ret = rpc_receive_common (req, &frame, &state, &len, &args,
- xdr_gfx_put_req, GF_FOP_PUT);
- if (ret != 0) {
- goto out;
- }
+ state->resolve.bname = gf_strdup(args.bname);
+ state->mode = args.mode;
+ state->umask = args.umask;
+ state->flags = gf_flags_to_flags(args.flag);
+ state->offset = args.offset;
+ state->size = args.size;
+ state->iobref = iobref_ref(req->iobref);
- state->resolve.bname = gf_strdup (args.bname);
- state->mode = args.mode;
- state->umask = args.umask;
- state->flags = gf_flags_to_flags (args.flag);
- state->offset = args.offset;
- state->size = args.size;
- state->iobref = iobref_ref (req->iobref);
-
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base
- = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len
- = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
+ if (len < req->msg[0].iov_len) {
+ state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
+ state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
+ state->payload_count = 1;
+ }
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++]
- = req->msg[i];
- }
+ for (i = 1; i < req->count; i++) {
+ state->payload_vector[state->payload_count++] = req->msg[i];
+ }
- len = iov_length (state->payload_vector, state->payload_count);
+ len = iov_length(state->payload_vector, state->payload_count);
- GF_ASSERT (state->size == len);
+ GF_ASSERT(state->size == len);
- set_resolve_gfid (frame->root->client, state->resolve.pargfid,
- args.pargfid);
+ set_resolve_gfid(frame->root->client, state->resolve.pargfid, args.pargfid);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
- xdr_to_dict (&args.xattr, &state->dict);
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xattr, &state->dict);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_put_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_put_resume);
out:
- free (args.bname);
+ free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
int
-server4_compound_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+server4_compound_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, void *data,
dict_t *xdata)
{
- struct gfx_compound_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- compound_args_cbk_t *args_cbk = data;
- int i = 0;
-
- req = frame->local;
- state = CALL_STATE (frame);
-
- dict_to_xdr (xdata, &rsp.xdata);
+ struct gfx_compound_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ compound_args_cbk_t *args_cbk = data;
+ int i = 0;
+
+ req = frame->local;
+ state = CALL_STATE(frame);
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret) {
+ gf_msg(this->name, fop_log_level(GF_FOP_COMPOUND, op_errno), op_errno,
+ PS_MSG_COMPOUND_INFO,
+ "%" PRId64 ": COMPOUND%" PRId64
+ " (%s), client: %s, "
+ "error-xlator: %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
+ STACK_ERR_XL_NAME(frame->root));
+ }
+
+ /* TODO: I assume a single 10MB payload is large, if not, we need to
+ agree to valid payload */
+ if ((args_cbk->fop_length <= 0) ||
+ ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC(
+ args_cbk->fop_length, sizeof(compound_rsp_v2),
+ gf_server_mt_compound_rsp_t);
+
+ if (!rsp.compound_rsp_array.compound_rsp_array_val) {
+ op_ret = -1;
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
+
+ for (i = 0; i < args_cbk->fop_length; i++) {
+ op_ret = server_populate_compound_response_v2(this, &rsp, frame,
+ args_cbk, i);
if (op_ret) {
- gf_msg (this->name, fop_log_level (GF_FOP_COMPOUND, op_errno),
- op_errno, PS_MSG_COMPOUND_INFO,
- "%"PRId64": COMPOUND%"PRId64" (%s), client: %s, "
- "error-xlator: %s", frame->root->unique,
- state->resolve.fd_no, uuid_utoa (state->resolve.gfid),
- STACK_CLIENT_NAME (frame->root),
- STACK_ERR_XL_NAME (frame->root));
- }
-
- /* TODO: I assume a single 10MB payload is large, if not, we need to
- agree to valid payload */
- if ((args_cbk->fop_length <= 0) ||
- ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
- op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC
- (args_cbk->fop_length,
- sizeof (compound_rsp_v2),
- gf_server_mt_compound_rsp_t);
-
- if (!rsp.compound_rsp_array.compound_rsp_array_val) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
-
- for (i = 0; i < args_cbk->fop_length; i++) {
- op_ret = server_populate_compound_response_v2 (this, &rsp,
- frame,
- args_cbk, i);
-
- if (op_ret) {
- op_errno = op_ret;
- op_ret = -1;
- goto out;
- }
+ op_errno = op_ret;
+ op_ret = -1;
+ goto out;
}
+ }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error (op_errno);
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
- server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t) xdr_gfx_compound_rsp);
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_compound_rsp);
- server_compound_rsp_cleanup_v2 (&rsp, args_cbk);
- GF_FREE (rsp.xdata.pairs.pairs_val);
+ server_compound_rsp_cleanup_v2(&rsp, args_cbk);
+ GF_FREE(rsp.xdata.pairs.pairs_val);
- return 0;
+ return 0;
}
int
-server4_compound_resume (call_frame_t *frame, xlator_t *bound_xl)
+server4_compound_resume(call_frame_t *frame, xlator_t *bound_xl)
{
- server_state_t *state = NULL;
- gfx_compound_req *req = NULL;
- compound_args_t *args = NULL;
- int i = 0;
- int ret = -1;
- int length = 0;
- int op_errno = ENOMEM;
- compound_req_v2 *c_req = NULL;
+ server_state_t *state = NULL;
+ gfx_compound_req *req = NULL;
+ compound_args_t *args = NULL;
+ int i = 0;
+ int ret = -1;
+ int length = 0;
+ int op_errno = ENOMEM;
+ compound_req_v2 *c_req = NULL;
- state = CALL_STATE (frame);
+ state = CALL_STATE(frame);
- if (state->resolve.op_ret != 0) {
- ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
+ if (state->resolve.op_ret != 0) {
+ ret = state->resolve.op_ret;
+ op_errno = state->resolve.op_errno;
+ goto err;
+ }
- req = &state->req_v2;
+ req = &state->req_v2;
- length = req->compound_req_array.compound_req_array_len;
- state->args = compound_fop_alloc (length, req->compound_fop_enum,
- state->xdata);
- args = state->args;
+ length = req->compound_req_array.compound_req_array_len;
+ state->args = compound_fop_alloc(length, req->compound_fop_enum,
+ state->xdata);
+ args = state->args;
- if (!args)
- goto err;
+ if (!args)
+ goto err;
- for (i = 0; i < length; i++) {
- c_req = &req->compound_req_array.compound_req_array_val[i];
- args->enum_list[i] = c_req->fop_enum;
+ for (i = 0; i < length; i++) {
+ c_req = &req->compound_req_array.compound_req_array_val[i];
+ args->enum_list[i] = c_req->fop_enum;
- ret = server_populate_compound_request_v2 (req, frame,
- &args->req_list[i],
- i);
+ ret = server_populate_compound_request_v2(req, frame,
+ &args->req_list[i], i);
- if (ret) {
- op_errno = ret;
- ret = -1;
- goto err;
- }
+ if (ret) {
+ op_errno = ret;
+ ret = -1;
+ goto err;
}
+ }
- STACK_WIND (frame, server4_compound_cbk,
- bound_xl, bound_xl->fops->compound,
- args, state->xdata);
+ STACK_WIND(frame, server4_compound_cbk, bound_xl, bound_xl->fops->compound,
+ args, state->xdata);
- return 0;
+ return 0;
err:
- server4_compound_cbk (frame, NULL, frame->this, ret, op_errno,
- NULL, NULL);
+ server4_compound_cbk(frame, NULL, frame->this, ret, op_errno, NULL, NULL);
- return ret;
+ return ret;
}
int
-server4_0_compound (rpcsvc_request_t *req)
+server4_0_compound(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfx_compound_req args = {0,};
- ssize_t len = 0;
- int length = 0;
- int i = 0;
- int ret = -1;
- int op_errno = 0;
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfx_compound_req args = {
+ 0,
+ };
+ ssize_t len = 0;
+ int length = 0;
+ int i = 0;
+ int ret = -1;
+ int op_errno = 0;
- if (!req)
- return ret;
+ if (!req)
+ return ret;
- ret = rpc_receive_common (req, &frame, &state, &len, &args,
- xdr_gfx_compound_req,
- GF_FOP_COMPOUND);
- if (ret != 0) {
- goto out;
- }
+ ret = rpc_receive_common(req, &frame, &state, &len, &args,
+ xdr_gfx_compound_req, GF_FOP_COMPOUND);
+ if (ret != 0) {
+ goto out;
+ }
- state->req_v2 = args;
- state->iobref = iobref_ref (req->iobref);
+ state->req_v2 = args;
+ state->iobref = iobref_ref(req->iobref);
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base
- = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len
- = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
+ if (len < req->msg[0].iov_len) {
+ state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
+ state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
+ state->payload_count = 1;
+ }
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++]
- = req->msg[i];
- }
+ for (i = 1; i < req->count; i++) {
+ state->payload_vector[state->payload_count++] = req->msg[i];
+ }
- state->size = iov_length (state->payload_vector, state->payload_count);
+ state->size = iov_length(state->payload_vector, state->payload_count);
- ret = server_get_compound_resolve_v2 (state, &args);
+ ret = server_get_compound_resolve_v2(state, &args);
- if (ret) {
- SERVER_REQ_SET_ERROR (req, ret);
- goto out;
- }
+ if (ret) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
- xdr_to_dict (&args.xdata, &state->xdata);
+ xdr_to_dict(&args.xdata, &state->xdata);
- ret = 0;
- resolve_and_resume (frame, server4_compound_resume);
+ ret = 0;
+ resolve_and_resume(frame, server4_compound_resume);
out:
- length = args.compound_req_array.compound_req_array_len;
- server_compound_req_cleanup_v2 (&args, length);
- free (args.compound_req_array.compound_req_array_val);
+ length = args.compound_req_array.compound_req_array_len;
+ server_compound_req_cleanup_v2(&args, length);
+ free(args.compound_req_array.compound_req_array_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR (req, ret);
+ if (op_errno)
+ SERVER_REQ_SET_ERROR(req, ret);
- return ret;
+ return ret;
}
-
rpcsvc_actor_t glusterfs4_0_fop_actors[] = {
- [GFS3_OP_NULL] = { "NULL", GFS3_OP_NULL, server_null, NULL, 0},
- [GFS3_OP_STAT] = { "STAT", GFS3_OP_STAT, server4_0_stat, NULL, 0},
- [GFS3_OP_READLINK] = { "READLINK", GFS3_OP_READLINK, server4_0_readlink, NULL, 0},
- [GFS3_OP_MKNOD] = { "MKNOD", GFS3_OP_MKNOD, server4_0_mknod, NULL, 0},
- [GFS3_OP_MKDIR] = { "MKDIR", GFS3_OP_MKDIR, server4_0_mkdir, NULL, 0},
- [GFS3_OP_UNLINK] = { "UNLINK", GFS3_OP_UNLINK, server4_0_unlink, NULL, 0},
- [GFS3_OP_RMDIR] = { "RMDIR", GFS3_OP_RMDIR, server4_0_rmdir, NULL, 0},
- [GFS3_OP_SYMLINK] = { "SYMLINK", GFS3_OP_SYMLINK, server4_0_symlink, NULL, 0},
- [GFS3_OP_RENAME] = { "RENAME", GFS3_OP_RENAME, server4_0_rename, NULL, 0},
- [GFS3_OP_LINK] = { "LINK", GFS3_OP_LINK, server4_0_link, NULL, 0},
- [GFS3_OP_TRUNCATE] = { "TRUNCATE", GFS3_OP_TRUNCATE, server4_0_truncate, NULL, 0},
- [GFS3_OP_OPEN] = { "OPEN", GFS3_OP_OPEN, server4_0_open, NULL, 0},
- [GFS3_OP_READ] = { "READ", GFS3_OP_READ, server4_0_readv, NULL, 0},
- [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server4_0_writev, server4_0_writev_vecsizer, 0},
- [GFS3_OP_STATFS] = { "STATFS", GFS3_OP_STATFS, server4_0_statfs, NULL, 0},
- [GFS3_OP_FLUSH] = { "FLUSH", GFS3_OP_FLUSH, server4_0_flush, NULL, 0},
- [GFS3_OP_FSYNC] = { "FSYNC", GFS3_OP_FSYNC, server4_0_fsync, NULL, 0},
- [GFS3_OP_GETXATTR] = { "GETXATTR", GFS3_OP_GETXATTR, server4_0_getxattr, NULL, 0},
- [GFS3_OP_SETXATTR] = { "SETXATTR", GFS3_OP_SETXATTR, server4_0_setxattr, NULL, 0},
- [GFS3_OP_REMOVEXATTR] = { "REMOVEXATTR", GFS3_OP_REMOVEXATTR, server4_0_removexattr, NULL, 0},
- [GFS3_OP_OPENDIR] = { "OPENDIR", GFS3_OP_OPENDIR, server4_0_opendir, NULL, 0},
- [GFS3_OP_FSYNCDIR] = { "FSYNCDIR", GFS3_OP_FSYNCDIR, server4_0_fsyncdir, NULL, 0},
- [GFS3_OP_ACCESS] = { "ACCESS", GFS3_OP_ACCESS, server4_0_access, NULL, 0},
- [GFS3_OP_CREATE] = { "CREATE", GFS3_OP_CREATE, server4_0_create, NULL, 0},
- [GFS3_OP_FTRUNCATE] = { "FTRUNCATE", GFS3_OP_FTRUNCATE, server4_0_ftruncate, NULL, 0},
- [GFS3_OP_FSTAT] = { "FSTAT", GFS3_OP_FSTAT, server4_0_fstat, NULL, 0},
- [GFS3_OP_LK] = { "LK", GFS3_OP_LK, server4_0_lk, NULL, 0},
- [GFS3_OP_LOOKUP] = { "LOOKUP", GFS3_OP_LOOKUP, server4_0_lookup, NULL, 0},
- [GFS3_OP_READDIR] = { "READDIR", GFS3_OP_READDIR, server4_0_readdir, NULL, 0},
- [GFS3_OP_INODELK] = { "INODELK", GFS3_OP_INODELK, server4_0_inodelk, NULL, 0},
- [GFS3_OP_FINODELK] = { "FINODELK", GFS3_OP_FINODELK, server4_0_finodelk, NULL, 0},
- [GFS3_OP_ENTRYLK] = { "ENTRYLK", GFS3_OP_ENTRYLK, server4_0_entrylk, NULL, 0},
- [GFS3_OP_FENTRYLK] = { "FENTRYLK", GFS3_OP_FENTRYLK, server4_0_fentrylk, NULL, 0},
- [GFS3_OP_XATTROP] = { "XATTROP", GFS3_OP_XATTROP, server4_0_xattrop, NULL, 0},
- [GFS3_OP_FXATTROP] = { "FXATTROP", GFS3_OP_FXATTROP, server4_0_fxattrop, NULL, 0},
- [GFS3_OP_FGETXATTR] = { "FGETXATTR", GFS3_OP_FGETXATTR, server4_0_fgetxattr, NULL, 0},
- [GFS3_OP_FSETXATTR] = { "FSETXATTR", GFS3_OP_FSETXATTR, server4_0_fsetxattr, NULL, 0},
- [GFS3_OP_RCHECKSUM] = { "RCHECKSUM", GFS3_OP_RCHECKSUM, server4_0_rchecksum, NULL, 0},
- [GFS3_OP_SETATTR] = { "SETATTR", GFS3_OP_SETATTR, server4_0_setattr, NULL, 0},
- [GFS3_OP_FSETATTR] = { "FSETATTR", GFS3_OP_FSETATTR, server4_0_fsetattr, NULL, 0},
- [GFS3_OP_READDIRP] = { "READDIRP", GFS3_OP_READDIRP, server4_0_readdirp, NULL, 0},
- [GFS3_OP_RELEASE] = { "RELEASE", GFS3_OP_RELEASE, server4_0_release, NULL, 0},
- [GFS3_OP_RELEASEDIR] = { "RELEASEDIR", GFS3_OP_RELEASEDIR, server4_0_releasedir, NULL, 0},
- [GFS3_OP_FREMOVEXATTR] = { "FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server4_0_fremovexattr, NULL, 0},
- [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server4_0_fallocate, NULL, 0, DRC_NA},
- [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server4_0_discard, NULL, 0, DRC_NA},
- [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server4_0_zerofill, NULL, 0, DRC_NA},
- [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server4_0_ipc, NULL, 0, DRC_NA},
- [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server4_0_seek, NULL, 0, DRC_NA},
- [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server4_0_lease, NULL, 0, DRC_NA},
- [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK, server4_0_getactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK, server4_0_setactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server4_0_compound, NULL, 0, DRC_NA},
- [GFS3_OP_ICREATE] = {"ICREATE", GFS3_OP_ICREATE, server4_0_icreate, NULL, 0, DRC_NA},
- [GFS3_OP_NAMELINK] = {"NAMELINK", GFS3_OP_NAMELINK, server4_0_namelink, NULL, 0, DRC_NA},
+ [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0},
+ [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server4_0_stat, NULL, 0},
+ [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server4_0_readlink,
+ NULL, 0},
+ [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server4_0_mknod, NULL, 0},
+ [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server4_0_mkdir, NULL, 0},
+ [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server4_0_unlink, NULL, 0},
+ [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server4_0_rmdir, NULL, 0},
+ [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server4_0_symlink, NULL,
+ 0},
+ [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server4_0_rename, NULL, 0},
+ [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server4_0_link, NULL, 0},
+ [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server4_0_truncate,
+ NULL, 0},
+ [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server4_0_open, NULL, 0},
+ [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server4_0_readv, NULL, 0},
+ [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server4_0_writev,
+ server4_0_writev_vecsizer, 0},
+ [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server4_0_statfs, NULL, 0},
+ [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server4_0_flush, NULL, 0},
+ [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server4_0_fsync, NULL, 0},
+ [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server4_0_getxattr,
+ NULL, 0},
+ [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server4_0_setxattr,
+ NULL, 0},
+ [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR,
+ server4_0_removexattr, NULL, 0},
+ [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server4_0_opendir, NULL,
+ 0},
+ [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server4_0_fsyncdir,
+ NULL, 0},
+ [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server4_0_access, NULL, 0},
+ [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server4_0_create, NULL, 0},
+ [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server4_0_ftruncate,
+ NULL, 0},
+ [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server4_0_fstat, NULL, 0},
+ [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server4_0_lk, NULL, 0},
+ [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server4_0_lookup, NULL, 0},
+ [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server4_0_readdir, NULL,
+ 0},
+ [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server4_0_inodelk, NULL,
+ 0},
+ [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server4_0_finodelk,
+ NULL, 0},
+ [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server4_0_entrylk, NULL,
+ 0},
+ [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server4_0_fentrylk,
+ NULL, 0},
+ [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server4_0_xattrop, NULL,
+ 0},
+ [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server4_0_fxattrop,
+ NULL, 0},
+ [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server4_0_fgetxattr,
+ NULL, 0},
+ [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server4_0_fsetxattr,
+ NULL, 0},
+ [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server4_0_rchecksum,
+ NULL, 0},
+ [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server4_0_setattr, NULL,
+ 0},
+ [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server4_0_fsetattr,
+ NULL, 0},
+ [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server4_0_readdirp,
+ NULL, 0},
+ [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server4_0_release, NULL,
+ 0},
+ [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR,
+ server4_0_releasedir, NULL, 0},
+ [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR,
+ server4_0_fremovexattr, NULL, 0},
+ [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server4_0_fallocate,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server4_0_discard, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server4_0_zerofill,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server4_0_ipc, NULL, 0, DRC_NA},
+ [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server4_0_seek, NULL, 0, DRC_NA},
+ [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server4_0_lease, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK,
+ server4_0_getactivelk, NULL, 0, DRC_NA},
+ [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK,
+ server4_0_setactivelk, NULL, 0, DRC_NA},
+ [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server4_0_compound,
+ NULL, 0, DRC_NA},
+ [GFS3_OP_ICREATE] = {"ICREATE", GFS3_OP_ICREATE, server4_0_icreate, NULL, 0,
+ DRC_NA},
+ [GFS3_OP_NAMELINK] = {"NAMELINK", GFS3_OP_NAMELINK, server4_0_namelink,
+ NULL, 0, DRC_NA},
};
-
struct rpcsvc_program glusterfs4_0_fop_prog = {
- .progname = "GlusterFS 4.x v1",
- .prognum = GLUSTER_FOP_PROGRAM,
- .progver = GLUSTER_FOP_VERSION_v2,
- .numactors = GLUSTER_FOP_PROCCNT,
- .actors = glusterfs4_0_fop_actors,
- .ownthread = _gf_true,
+ .progname = "GlusterFS 4.x v1",
+ .prognum = GLUSTER_FOP_PROGRAM,
+ .progver = GLUSTER_FOP_VERSION_v2,
+ .numactors = GLUSTER_FOP_PROCCNT,
+ .actors = glusterfs4_0_fop_actors,
+ .ownthread = _gf_true,
};
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 02096b65e2c..b9879cdf148 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -8,11 +8,9 @@
cases as published by the Free Software Foundation.
*/
-
#include <sys/time.h>
#include <sys/resource.h>
-
#include "server.h"
#include "server-helpers.h"
#include "glusterfs3-xdr.h"
@@ -27,1222 +25,1176 @@
#include "glusterfsd.h"
rpcsvc_cbk_program_t server_cbk_prog = {
- .progname = "Gluster Callback",
- .prognum = GLUSTER_CBK_PROGRAM,
- .progver = GLUSTER_CBK_VERSION,
+ .progname = "Gluster Callback",
+ .prognum = GLUSTER_CBK_PROGRAM,
+ .progver = GLUSTER_CBK_VERSION,
};
struct iobuf *
-gfs_serialize_reply (rpcsvc_request_t *req, void *arg, struct iovec *outmsg,
- xdrproc_t xdrproc)
+gfs_serialize_reply(rpcsvc_request_t *req, void *arg, struct iovec *outmsg,
+ xdrproc_t xdrproc)
{
- struct iobuf *iob = NULL;
- ssize_t retlen = 0;
- ssize_t xdr_size = 0;
-
- GF_VALIDATE_OR_GOTO ("server", req, ret);
-
- /* First, get the io buffer into which the reply in arg will
- * be serialized.
+ struct iobuf *iob = NULL;
+ ssize_t retlen = 0;
+ ssize_t xdr_size = 0;
+
+ GF_VALIDATE_OR_GOTO("server", req, ret);
+
+ /* First, get the io buffer into which the reply in arg will
+ * be serialized.
+ */
+ if (arg && xdrproc) {
+ xdr_size = xdr_sizeof(xdrproc, arg);
+ iob = iobuf_get2(req->svc->ctx->iobuf_pool, xdr_size);
+ if (!iob) {
+ gf_msg_callingfn(THIS->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "Failed to get iobuf");
+ goto ret;
+ };
+
+ iobuf_to_iovec(iob, outmsg);
+ /* Use the given serializer to translate the give C structure in arg
+ * to XDR format which will be written into the buffer in outmsg.
+ */
+ /* retlen is used to received the error since size_t is unsigned and we
+ * need -1 for error notification during encoding.
*/
- if (arg && xdrproc) {
- xdr_size = xdr_sizeof (xdrproc, arg);
- iob = iobuf_get2 (req->svc->ctx->iobuf_pool, xdr_size);
- if (!iob) {
- gf_msg_callingfn (THIS->name, GF_LOG_ERROR, ENOMEM,
- PS_MSG_NO_MEMORY,
- "Failed to get iobuf");
- goto ret;
- };
-
- iobuf_to_iovec (iob, outmsg);
- /* Use the given serializer to translate the give C structure in arg
- * to XDR format which will be written into the buffer in outmsg.
- */
- /* retlen is used to received the error since size_t is unsigned and we
- * need -1 for error notification during encoding.
- */
- retlen = xdr_serialize_generic (*outmsg, arg, xdrproc);
- if (retlen == -1) {
- /* Failed to Encode 'GlusterFS' msg in RPC is not exactly
- failure of RPC return values.. client should get
- notified about this, so there are no missing frames */
- gf_msg_callingfn ("", GF_LOG_ERROR, 0,
- PS_MSG_ENCODE_MSG_FAILED,
- "Failed to encode message");
- req->rpc_err = GARBAGE_ARGS;
- retlen = 0;
- }
+ retlen = xdr_serialize_generic(*outmsg, arg, xdrproc);
+ if (retlen == -1) {
+ /* Failed to Encode 'GlusterFS' msg in RPC is not exactly
+ failure of RPC return values.. client should get
+ notified about this, so there are no missing frames */
+ gf_msg_callingfn("", GF_LOG_ERROR, 0, PS_MSG_ENCODE_MSG_FAILED,
+ "Failed to encode message");
+ req->rpc_err = GARBAGE_ARGS;
+ retlen = 0;
}
- outmsg->iov_len = retlen;
+ }
+ outmsg->iov_len = retlen;
ret:
- return iob;
+ return iob;
}
int
-server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
- struct iovec *payload, int payloadcount,
- struct iobref *iobref, xdrproc_t xdrproc)
+server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg,
+ struct iovec *payload, int payloadcount,
+ struct iobref *iobref, xdrproc_t xdrproc)
{
- struct iobuf *iob = NULL;
- int ret = -1;
- struct iovec rsp = {0,};
- server_state_t *state = NULL;
- char new_iobref = 0;
- client_t *client = NULL;
-
- GF_VALIDATE_OR_GOTO ("server", req, ret);
-
- if (frame) {
- state = CALL_STATE (frame);
- frame->local = NULL;
- client = frame->root->client;
- }
-
+ struct iobuf *iob = NULL;
+ int ret = -1;
+ struct iovec rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ char new_iobref = 0;
+ client_t *client = NULL;
+
+ GF_VALIDATE_OR_GOTO("server", req, ret);
+
+ if (frame) {
+ state = CALL_STATE(frame);
+ frame->local = NULL;
+ client = frame->root->client;
+ }
+
+ if (!iobref) {
+ iobref = iobref_new();
if (!iobref) {
- iobref = iobref_new ();
- if (!iobref) {
- goto ret;
- }
-
- new_iobref = 1;
- }
-
- iob = gfs_serialize_reply (req, arg, &rsp, xdrproc);
- if (!iob) {
- gf_msg ("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED,
- "Failed to serialize reply");
- goto ret;
+ goto ret;
}
- iobref_add (iobref, iob);
-
- /* Then, submit the message for transmission. */
- ret = rpcsvc_submit_generic (req, &rsp, 1, payload, payloadcount,
- iobref);
-
- /* TODO: this is demo purpose only */
- /* ret = rpcsvc_callback_submit (req->svc, req->trans, req->prog,
- GF_CBK_NULL, &rsp, 1);
- */
- /* Now that we've done our job of handing the message to the RPC layer
- * we can safely unref the iob in the hope that RPC layer must have
- * ref'ed the iob on receiving into the txlist.
- */
- iobuf_unref (iob);
- if (ret == -1) {
- gf_msg_callingfn ("", GF_LOG_ERROR, 0,
- PS_MSG_REPLY_SUBMIT_FAILED,
- "Reply submission failed");
- if (frame && client) {
- server_connection_cleanup (frame->this, client,
- INTERNAL_LOCKS | POSIX_LOCKS);
- } else {
- gf_msg_callingfn ("", GF_LOG_ERROR, 0,
- PS_MSG_REPLY_SUBMIT_FAILED,
- "Reply submission failed");
- /* TODO: Failure of open(dir), create, inodelk, entrylk
- or lk fops send failure must be handled specially. */
- }
- goto ret;
+ new_iobref = 1;
+ }
+
+ iob = gfs_serialize_reply(req, arg, &rsp, xdrproc);
+ if (!iob) {
+ gf_msg("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED,
+ "Failed to serialize reply");
+ goto ret;
+ }
+
+ iobref_add(iobref, iob);
+
+ /* Then, submit the message for transmission. */
+ ret = rpcsvc_submit_generic(req, &rsp, 1, payload, payloadcount, iobref);
+
+ /* TODO: this is demo purpose only */
+ /* ret = rpcsvc_callback_submit (req->svc, req->trans, req->prog,
+ GF_CBK_NULL, &rsp, 1);
+ */
+ /* Now that we've done our job of handing the message to the RPC layer
+ * we can safely unref the iob in the hope that RPC layer must have
+ * ref'ed the iob on receiving into the txlist.
+ */
+ iobuf_unref(iob);
+ if (ret == -1) {
+ gf_msg_callingfn("", GF_LOG_ERROR, 0, PS_MSG_REPLY_SUBMIT_FAILED,
+ "Reply submission failed");
+ if (frame && client) {
+ server_connection_cleanup(frame->this, client,
+ INTERNAL_LOCKS | POSIX_LOCKS);
+ } else {
+ gf_msg_callingfn("", GF_LOG_ERROR, 0, PS_MSG_REPLY_SUBMIT_FAILED,
+ "Reply submission failed");
+ /* TODO: Failure of open(dir), create, inodelk, entrylk
+ or lk fops send failure must be handled specially. */
}
+ goto ret;
+ }
- ret = 0;
+ ret = 0;
ret:
- if (client)
- gf_client_unref (client);
+ if (client)
+ gf_client_unref(client);
- if (frame)
- STACK_DESTROY (frame->root);
+ if (frame)
+ STACK_DESTROY(frame->root);
- if (new_iobref)
- iobref_unref (iobref);
+ if (new_iobref)
+ iobref_unref(iobref);
- if (state)
- free_state (state);
+ if (state)
+ free_state(state);
- return ret;
+ return ret;
}
-
int
-server_priv_to_dict (xlator_t *this, dict_t *dict, char *brickname)
+server_priv_to_dict(xlator_t *this, dict_t *dict, char *brickname)
{
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
- peer_info_t *peerinfo = NULL;
- char key[32] = {0,};
- int count = 0;
- int ret = -1;
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ peer_info_t *peerinfo = NULL;
+ char key[32] = {
+ 0,
+ };
+ int count = 0;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO(THIS->name, this, out);
+ GF_VALIDATE_OR_GOTO(THIS->name, dict, out);
+
+ conf = this->private;
+ if (!conf)
+ return 0;
+ // TODO: Dump only specific info to dict
- GF_VALIDATE_OR_GOTO (THIS->name, this, out);
- GF_VALIDATE_OR_GOTO (THIS->name, dict, out);
+ pthread_mutex_lock(&conf->mutex);
+ {
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ if ((xprt->xl_private) && (xprt->xl_private->bound_xl) &&
+ (xprt->xl_private->bound_xl->name) && (brickname) &&
+ (!strcmp(brickname, xprt->xl_private->bound_xl->name))) {
+ peerinfo = &xprt->peerinfo;
+ snprintf(key, sizeof(key), "client%d.hostname", count);
+ ret = dict_set_str(dict, key, peerinfo->identifier);
+ if (ret)
+ goto unlock;
- conf = this->private;
- if (!conf)
- return 0;
- //TODO: Dump only specific info to dict
+ snprintf(key, sizeof(key), "client%d.bytesread", count);
+ ret = dict_set_uint64(dict, key, xprt->total_bytes_read);
+ if (ret)
+ goto unlock;
- pthread_mutex_lock (&conf->mutex);
- {
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- if ((xprt->xl_private) &&
- (xprt->xl_private->bound_xl) &&
- (xprt->xl_private->bound_xl->name) && (brickname) &&
- (!strcmp (brickname,
- xprt->xl_private->bound_xl->name))) {
- peerinfo = &xprt->peerinfo;
- snprintf (key, sizeof (key),
- "client%d.hostname",
- count);
- ret = dict_set_str (dict, key,
- peerinfo->identifier);
- if (ret)
- goto unlock;
-
- snprintf (key, sizeof (key),
- "client%d.bytesread",
- count);
- ret = dict_set_uint64 (dict, key,
- xprt->total_bytes_read);
- if (ret)
- goto unlock;
-
- snprintf (key, sizeof (key),
- "client%d.byteswrite",
- count);
- ret = dict_set_uint64 (dict, key,
- xprt->total_bytes_write);
- if (ret)
- goto unlock;
-
- snprintf (key, sizeof (key),
- "client%d.opversion",
- count);
- ret = dict_set_uint32 (dict, key,
- peerinfo->max_op_version);
- if (ret)
- goto unlock;
-
- snprintf (key, sizeof (key), "client%d.name",
- count);
- ret = dict_set_str (dict, key,
- xprt->xl_private->client_name);
- if (ret)
- goto unlock;
-
- count++;
- }
- }
+ snprintf(key, sizeof(key), "client%d.byteswrite", count);
+ ret = dict_set_uint64(dict, key, xprt->total_bytes_write);
+ if (ret)
+ goto unlock;
+
+ snprintf(key, sizeof(key), "client%d.opversion", count);
+ ret = dict_set_uint32(dict, key, peerinfo->max_op_version);
+ if (ret)
+ goto unlock;
+
+ snprintf(key, sizeof(key), "client%d.name", count);
+ ret = dict_set_str(dict, key, xprt->xl_private->client_name);
+ if (ret)
+ goto unlock;
+
+ count++;
+ }
}
+ }
unlock:
- pthread_mutex_unlock (&conf->mutex);
- if (ret)
- goto out;
+ pthread_mutex_unlock(&conf->mutex);
+ if (ret)
+ goto out;
- ret = dict_set_int32 (dict, "clientcount", count);
+ ret = dict_set_int32(dict, "clientcount", count);
out:
- return ret;
+ return ret;
}
int
-server_priv (xlator_t *this)
+server_priv(xlator_t *this)
{
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
- char key[GF_DUMP_MAX_BUF_LEN] = {0,};
- uint64_t total_read = 0;
- uint64_t total_write = 0;
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
-
- conf = this->private;
- if (!conf)
- return 0;
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ char key[GF_DUMP_MAX_BUF_LEN] = {
+ 0,
+ };
+ uint64_t total_read = 0;
+ uint64_t total_write = 0;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+
+ conf = this->private;
+ if (!conf)
+ return 0;
- gf_proc_dump_build_key (key, "xlator.protocol.server", "priv");
- gf_proc_dump_add_section (key);
+ gf_proc_dump_build_key(key, "xlator.protocol.server", "priv");
+ gf_proc_dump_add_section(key);
- ret = pthread_mutex_trylock (&conf->mutex);
- if (ret != 0)
- goto out;
+ ret = pthread_mutex_trylock(&conf->mutex);
+ if (ret != 0)
+ goto out;
+ {
+ list_for_each_entry(xprt, &conf->xprt_list, list)
{
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- total_read += xprt->total_bytes_read;
- total_write += xprt->total_bytes_write;
- }
+ total_read += xprt->total_bytes_read;
+ total_write += xprt->total_bytes_write;
}
- pthread_mutex_unlock (&conf->mutex);
+ }
+ pthread_mutex_unlock(&conf->mutex);
- gf_proc_dump_build_key(key, "server", "total-bytes-read");
- gf_proc_dump_write(key, "%"PRIu64, total_read);
+ gf_proc_dump_build_key(key, "server", "total-bytes-read");
+ gf_proc_dump_write(key, "%" PRIu64, total_read);
- gf_proc_dump_build_key(key, "server", "total-bytes-write");
- gf_proc_dump_write(key, "%"PRIu64, total_write);
+ gf_proc_dump_build_key(key, "server", "total-bytes-write");
+ gf_proc_dump_write(key, "%" PRIu64, total_write);
- ret = 0;
+ ret = 0;
out:
- if (ret)
- gf_proc_dump_write ("Unable to print priv",
- "(Lock acquisition failed) %s",
- this?this->name:"server");
+ if (ret)
+ gf_proc_dump_write("Unable to print priv",
+ "(Lock acquisition failed) %s",
+ this ? this->name : "server");
- return ret;
+ return ret;
}
-
static int
-get_auth_types (dict_t *this, char *key, data_t *value, void *data)
+get_auth_types(dict_t *this, char *key, data_t *value, void *data)
{
- dict_t *auth_dict = NULL;
- char *saveptr = NULL;
- char *tmp = NULL;
- char *key_cpy = NULL;
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", key, out);
- GF_VALIDATE_OR_GOTO ("server", data, out);
-
- auth_dict = data;
- key_cpy = gf_strdup (key);
- GF_VALIDATE_OR_GOTO("server", key_cpy, out);
-
- tmp = strtok_r (key_cpy, ".", &saveptr);
- ret = strcmp (tmp, "auth");
- if (ret == 0) {
- tmp = strtok_r (NULL, ".", &saveptr);
- if (strcmp (tmp, "ip") == 0) {
- /* TODO: backward compatibility, remove when
- newer versions are available */
- tmp = "addr";
- gf_msg ("server", GF_LOG_WARNING, 0,
- PS_MSG_AUTH_IP_ERROR,
- "assuming 'auth.ip' to be 'auth.addr'");
- }
- ret = dict_set_dynptr (auth_dict, tmp, NULL, 0);
- if (ret < 0) {
- gf_msg_debug ("server", 0, "failed to "
- "dict_set_dynptr");
- }
+ dict_t *auth_dict = NULL;
+ char *saveptr = NULL;
+ char *tmp = NULL;
+ char *key_cpy = NULL;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", key, out);
+ GF_VALIDATE_OR_GOTO("server", data, out);
+
+ auth_dict = data;
+ key_cpy = gf_strdup(key);
+ GF_VALIDATE_OR_GOTO("server", key_cpy, out);
+
+ tmp = strtok_r(key_cpy, ".", &saveptr);
+ ret = strcmp(tmp, "auth");
+ if (ret == 0) {
+ tmp = strtok_r(NULL, ".", &saveptr);
+ if (strcmp(tmp, "ip") == 0) {
+ /* TODO: backward compatibility, remove when
+ newer versions are available */
+ tmp = "addr";
+ gf_msg("server", GF_LOG_WARNING, 0, PS_MSG_AUTH_IP_ERROR,
+ "assuming 'auth.ip' to be 'auth.addr'");
}
+ ret = dict_set_dynptr(auth_dict, tmp, NULL, 0);
+ if (ret < 0) {
+ gf_msg_debug("server", 0,
+ "failed to "
+ "dict_set_dynptr");
+ }
+ }
- GF_FREE (key_cpy);
+ GF_FREE(key_cpy);
out:
- return 0;
+ return 0;
}
int
-_check_for_auth_option (dict_t *d, char *k, data_t *v,
- void *tmp)
+_check_for_auth_option(dict_t *d, char *k, data_t *v, void *tmp)
{
- int ret = 0;
- xlator_t *xl = NULL;
- char *tail = NULL;
-
- xl = tmp;
-
- tail = strtail (k, "auth.");
- if (!tail)
- goto out;
-
- if (strncmp(tail, "addr.", 5) != 0) {
- gf_msg (xl->name, GF_LOG_TRACE, 0, PS_MSG_SKIP_FORMAT_CHK,
- "skip format check for non-addr auth option %s", k);
- goto out;
- }
-
- /* fast fwd through module type */
- tail = strchr (tail, '.');
- if (!tail)
- goto out;
- tail++;
-
- tail = strtail (tail, xl->name);
- if (!tail)
- goto out;
-
- if (*tail == '.') {
- /* when we are here, the key is checked for
- * valid auth.allow.<xlator>
- * Now we verify the ip address
- */
- ret = xlator_option_validate_addr_list (xl, "auth-*", v->data,
- NULL, NULL);
- if (ret)
- gf_msg (xl->name, GF_LOG_ERROR, 0,
- PS_MSG_INTERNET_ADDR_ERROR,
- "internet address '%s' does not conform "
- "to standards.", v->data);
- }
+ int ret = 0;
+ xlator_t *xl = NULL;
+ char *tail = NULL;
+
+ xl = tmp;
+
+ tail = strtail(k, "auth.");
+ if (!tail)
+ goto out;
+
+ if (strncmp(tail, "addr.", 5) != 0) {
+ gf_msg(xl->name, GF_LOG_TRACE, 0, PS_MSG_SKIP_FORMAT_CHK,
+ "skip format check for non-addr auth option %s", k);
+ goto out;
+ }
+
+ /* fast fwd through module type */
+ tail = strchr(tail, '.');
+ if (!tail)
+ goto out;
+ tail++;
+
+ tail = strtail(tail, xl->name);
+ if (!tail)
+ goto out;
+
+ if (*tail == '.') {
+ /* when we are here, the key is checked for
+ * valid auth.allow.<xlator>
+ * Now we verify the ip address
+ */
+ ret = xlator_option_validate_addr_list(xl, "auth-*", v->data, NULL,
+ NULL);
+ if (ret)
+ gf_msg(xl->name, GF_LOG_ERROR, 0, PS_MSG_INTERNET_ADDR_ERROR,
+ "internet address '%s' does not conform "
+ "to standards.",
+ v->data);
+ }
out:
- return ret;
+ return ret;
}
int
-validate_auth_options (xlator_t *this, dict_t *dict)
+validate_auth_options(xlator_t *this, dict_t *dict)
{
- int error = -1;
- xlator_list_t *trav = NULL;
-
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", dict, out);
-
- trav = this->children;
- while (trav) {
- error = dict_foreach (dict, _check_for_auth_option,
- trav->xlator);
-
- if (-1 == error) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_AUTHENTICATE_ERROR, "volume '%s' "
- "defined as subvolume, but no authentication "
- "defined for the same", trav->xlator->name);
- break;
- }
- trav = trav->next;
+ int error = -1;
+ xlator_list_t *trav = NULL;
+
+ GF_VALIDATE_OR_GOTO("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", dict, out);
+
+ trav = this->children;
+ while (trav) {
+ error = dict_foreach(dict, _check_for_auth_option, trav->xlator);
+
+ if (-1 == error) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
+ "volume '%s' "
+ "defined as subvolume, but no authentication "
+ "defined for the same",
+ trav->xlator->name);
+ break;
}
+ trav = trav->next;
+ }
out:
- return error;
+ return error;
}
-
int
-server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
- void *data)
+server_rpc_notify(rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, void *data)
{
- gf_boolean_t detached = _gf_false;
- xlator_t *this = NULL;
- rpc_transport_t *trans = NULL;
- server_conf_t *conf = NULL;
- client_t *client = NULL;
- char *auth_path = NULL;
- int ret = -1;
- gf_boolean_t victim_found = _gf_false;
- char *xlator_name = NULL;
- glusterfs_ctx_t *ctx = NULL;
- xlator_t *top = NULL;
- xlator_list_t **trav_p = NULL;
- xlator_t *travxl = NULL;
- uint64_t xprtrefcount = 0;
- struct _child_status *tmp = NULL;
-
-
- if (!xl || !data) {
- gf_msg_callingfn ("server", GF_LOG_WARNING, 0,
- PS_MSG_RPC_NOTIFY_ERROR,
- "Calling rpc_notify without initializing");
- goto out;
- }
-
- this = xl;
- trans = data;
- conf = this->private;
- ctx = this->ctx;
-
- switch (event) {
- case RPCSVC_EVENT_ACCEPT:
- {
- /* Have a structure per new connection */
- /* TODO: Should we create anything here at all ? * /
- client->conn = create_server_conn_state (this, trans);
- if (!client->conn)
- goto out;
-
- trans->protocol_private = client->conn;
- */
-
- pthread_mutex_lock (&conf->mutex);
- rpc_transport_ref (trans);
- list_add_tail (&trans->list, &conf->xprt_list);
- pthread_mutex_unlock (&conf->mutex);
-
- break;
+ gf_boolean_t detached = _gf_false;
+ xlator_t *this = NULL;
+ rpc_transport_t *trans = NULL;
+ server_conf_t *conf = NULL;
+ client_t *client = NULL;
+ char *auth_path = NULL;
+ int ret = -1;
+ gf_boolean_t victim_found = _gf_false;
+ char *xlator_name = NULL;
+ glusterfs_ctx_t *ctx = NULL;
+ xlator_t *top = NULL;
+ xlator_list_t **trav_p = NULL;
+ xlator_t *travxl = NULL;
+ uint64_t xprtrefcount = 0;
+ struct _child_status *tmp = NULL;
+
+ if (!xl || !data) {
+ gf_msg_callingfn("server", GF_LOG_WARNING, 0, PS_MSG_RPC_NOTIFY_ERROR,
+ "Calling rpc_notify without initializing");
+ goto out;
+ }
+
+ this = xl;
+ trans = data;
+ conf = this->private;
+ ctx = this->ctx;
+
+ switch (event) {
+ case RPCSVC_EVENT_ACCEPT: {
+ /* Have a structure per new connection */
+ /* TODO: Should we create anything here at all ? * /
+ client->conn = create_server_conn_state (this, trans);
+ if (!client->conn)
+ goto out;
+
+ trans->protocol_private = client->conn;
+ */
+
+ pthread_mutex_lock(&conf->mutex);
+ rpc_transport_ref(trans);
+ list_add_tail(&trans->list, &conf->xprt_list);
+ pthread_mutex_unlock(&conf->mutex);
+
+ break;
}
case RPCSVC_EVENT_DISCONNECT:
- /* A DISCONNECT event could come without an ACCEPT event
- * happening for this transport. This happens when the server is
- * expecting encrypted connections by the client tries to
- * connect unecnrypted
- */
- if (list_empty (&trans->list)) {
- break;
- }
-
- /* transport has to be removed from the list upon disconnect
- * irrespective of whether lock self heal is off or on, since
- * new transport will be created upon reconnect.
- */
- pthread_mutex_lock (&conf->mutex);
- client = trans->xl_private;
- list_del_init (&trans->list);
- pthread_mutex_unlock (&conf->mutex);
-
- if (!client)
- goto unref_transport;
-
- gf_msg (this->name, GF_LOG_INFO, 0,
- PS_MSG_CLIENT_DISCONNECTING, "disconnecting connection"
- " from %s", client->client_uid);
-
- ret = dict_get_str (this->options, "auth-path", &auth_path);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PS_MSG_DICT_GET_FAILED,
- "failed to get auth-path");
- auth_path = NULL;
- }
-
- gf_client_ref (client);
- gf_client_put (client, &detached);
- if (detached) {
- server_connection_cleanup (this, client,
- INTERNAL_LOCKS | POSIX_LOCKS);
- gf_event (EVENT_CLIENT_DISCONNECT, "client_uid=%s;"
- "client_identifier=%s;server_identifier=%s;"
- "brick_path=%s",
- client->client_uid,
- trans->peerinfo.identifier,
- trans->myinfo.identifier,
- auth_path);
- }
-
- /*
- * gf_client_unref will be done while handling
- * RPC_EVENT_TRANSPORT_DESTROY
- */
-
-unref_transport:
- /* rpc_transport_unref() causes a RPCSVC_EVENT_TRANSPORT_DESTROY
- * to be called in blocking manner
- * So no code should ideally be after this unref
- */
- rpc_transport_unref (trans);
+ /* A DISCONNECT event could come without an ACCEPT event
+ * happening for this transport. This happens when the server is
+ * expecting encrypted connections by the client tries to
+ * connect unecnrypted
+ */
+ if (list_empty(&trans->list)) {
break;
+ }
+
+ /* transport has to be removed from the list upon disconnect
+ * irrespective of whether lock self heal is off or on, since
+ * new transport will be created upon reconnect.
+ */
+ pthread_mutex_lock(&conf->mutex);
+ client = trans->xl_private;
+ list_del_init(&trans->list);
+ pthread_mutex_unlock(&conf->mutex);
+
+ if (!client)
+ goto unref_transport;
+
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_DISCONNECTING,
+ "disconnecting connection"
+ " from %s",
+ client->client_uid);
+
+ ret = dict_get_str(this->options, "auth-path", &auth_path);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_DICT_GET_FAILED,
+ "failed to get auth-path");
+ auth_path = NULL;
+ }
+
+ gf_client_ref(client);
+ gf_client_put(client, &detached);
+ if (detached) {
+ server_connection_cleanup(this, client,
+ INTERNAL_LOCKS | POSIX_LOCKS);
+ gf_event(EVENT_CLIENT_DISCONNECT,
+ "client_uid=%s;"
+ "client_identifier=%s;server_identifier=%s;"
+ "brick_path=%s",
+ client->client_uid, trans->peerinfo.identifier,
+ trans->myinfo.identifier, auth_path);
+ }
+
+ /*
+ * gf_client_unref will be done while handling
+ * RPC_EVENT_TRANSPORT_DESTROY
+ */
+
+ unref_transport:
+ /* rpc_transport_unref() causes a RPCSVC_EVENT_TRANSPORT_DESTROY
+ * to be called in blocking manner
+ * So no code should ideally be after this unref
+ */
+ rpc_transport_unref(trans);
+ break;
case RPCSVC_EVENT_TRANSPORT_DESTROY:
- client = trans->xl_private;
- if (!client)
- break;
- pthread_mutex_lock (&conf->mutex);
- list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
- if (tmp->name && client->bound_xl &&
- client->bound_xl->cleanup_starting &&
- !strcmp (tmp->name, client->bound_xl->name)) {
- xprtrefcount = GF_ATOMIC_GET (tmp->xprtrefcnt);
- if (xprtrefcount > 0) {
- xprtrefcount = GF_ATOMIC_DEC (tmp->xprtrefcnt);
- if (xprtrefcount == 0)
- xlator_name = gf_strdup(client->bound_xl->name);
- }
- break;
- }
+ client = trans->xl_private;
+ if (!client)
+ break;
+ pthread_mutex_lock(&conf->mutex);
+ list_for_each_entry(tmp, &conf->child_status->status_list,
+ status_list)
+ {
+ if (tmp->name && client->bound_xl &&
+ client->bound_xl->cleanup_starting &&
+ !strcmp(tmp->name, client->bound_xl->name)) {
+ xprtrefcount = GF_ATOMIC_GET(tmp->xprtrefcnt);
+ if (xprtrefcount > 0) {
+ xprtrefcount = GF_ATOMIC_DEC(tmp->xprtrefcnt);
+ if (xprtrefcount == 0)
+ xlator_name = gf_strdup(client->bound_xl->name);
+ }
+ break;
}
- pthread_mutex_unlock (&conf->mutex);
-
- gf_client_unref (client);
-
- if (xlator_name) {
- if (this->ctx->active) {
- top = this->ctx->active->first;
- LOCK (&ctx->volfile_lock);
- for (trav_p = &top->children; *trav_p;
- trav_p = &(*trav_p)->next) {
- travxl = (*trav_p)->xlator;
- if (!travxl->call_cleanup &&
- strcmp (travxl->name, xlator_name) == 0) {
- victim_found = _gf_true;
- break;
- }
- }
- UNLOCK (&ctx->volfile_lock);
- if (victim_found) {
- xlator_mem_cleanup (travxl);
- rpcsvc_autoscale_threads (ctx, conf->rpc, -1);
- }
+ }
+ pthread_mutex_unlock(&conf->mutex);
+
+ gf_client_unref(client);
+
+ if (xlator_name) {
+ if (this->ctx->active) {
+ top = this->ctx->active->first;
+ LOCK(&ctx->volfile_lock);
+ for (trav_p = &top->children; *trav_p;
+ trav_p = &(*trav_p)->next) {
+ travxl = (*trav_p)->xlator;
+ if (!travxl->call_cleanup &&
+ strcmp(travxl->name, xlator_name) == 0) {
+ victim_found = _gf_true;
+ break;
}
- GF_FREE (xlator_name);
+ }
+ UNLOCK(&ctx->volfile_lock);
+ if (victim_found) {
+ xlator_mem_cleanup(travxl);
+ rpcsvc_autoscale_threads(ctx, conf->rpc, -1);
+ }
}
+ GF_FREE(xlator_name);
+ }
- trans->xl_private = NULL;
- break;
+ trans->xl_private = NULL;
+ break;
default:
- break;
- }
+ break;
+ }
out:
- return 0;
+ return 0;
}
int32_t
-server_mem_acct_init (xlator_t *this)
+server_mem_acct_init(xlator_t *this)
{
- int ret = -1;
+ int ret = -1;
- GF_VALIDATE_OR_GOTO ("server", this, out);
+ GF_VALIDATE_OR_GOTO("server", this, out);
- ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
+ ret = xlator_mem_acct_init(this, gf_server_mt_end + 1);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
- "Memory accounting init failed");
- return ret;
- }
-out:
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "Memory accounting init failed");
return ret;
+ }
+out:
+ return ret;
}
-
static int
-_delete_auth_opt (dict_t *this, char *key, data_t *value, void *data)
+_delete_auth_opt(dict_t *this, char *key, data_t *value, void *data)
{
- char *auth_option_pattern[] = { "auth.addr.*.allow",
- "auth.addr.*.reject",
- "auth.login.*.allow",
- "auth.login.*.password",
- "auth.login.*.ssl-allow",
- NULL};
- int i = 0;
-
- for (i = 0; auth_option_pattern[i]; i++) {
- if (fnmatch (auth_option_pattern[i], key, 0) == 0) {
- dict_del (this, key);
- break;
- }
+ char *auth_option_pattern[] = {
+ "auth.addr.*.allow", "auth.addr.*.reject", "auth.login.*.allow",
+ "auth.login.*.password", "auth.login.*.ssl-allow", NULL};
+ int i = 0;
+
+ for (i = 0; auth_option_pattern[i]; i++) {
+ if (fnmatch(auth_option_pattern[i], key, 0) == 0) {
+ dict_del(this, key);
+ break;
}
+ }
- return 0;
+ return 0;
}
-
static int
-_copy_auth_opt (dict_t *unused, char *key, data_t *value, void *xl_dict)
+_copy_auth_opt(dict_t *unused, char *key, data_t *value, void *xl_dict)
{
- char *auth_option_pattern[] = { "auth.addr.*.allow",
- "auth.addr.*.reject",
- "auth.login.*.allow",
- "auth.login.*.password",
- "auth.login.*.ssl-allow",
- NULL};
- int i = 0;
-
- for (i = 0; auth_option_pattern [i]; i++) {
- if (fnmatch (auth_option_pattern[i], key, 0) == 0) {
- dict_set ((dict_t *)xl_dict, key, value);
- break;
- }
+ char *auth_option_pattern[] = {
+ "auth.addr.*.allow", "auth.addr.*.reject", "auth.login.*.allow",
+ "auth.login.*.password", "auth.login.*.ssl-allow", NULL};
+ int i = 0;
+
+ for (i = 0; auth_option_pattern[i]; i++) {
+ if (fnmatch(auth_option_pattern[i], key, 0) == 0) {
+ dict_set((dict_t *)xl_dict, key, value);
+ break;
}
+ }
- return 0;
+ return 0;
}
int
-server_check_event_threads (xlator_t *this, server_conf_t *conf, int32_t new)
+server_check_event_threads(xlator_t *this, server_conf_t *conf, int32_t new)
{
- struct event_pool *pool = this->ctx->event_pool;
- int target;
+ struct event_pool *pool = this->ctx->event_pool;
+ int target;
- target = new + pool->auto_thread_count;
- conf->event_threads = new;
+ target = new + pool->auto_thread_count;
+ conf->event_threads = new;
- if (target == pool->eventthreadcount) {
- return 0;
- }
+ if (target == pool->eventthreadcount) {
+ return 0;
+ }
- return event_reconfigure_threads (pool, target);
+ return event_reconfigure_threads(pool, target);
}
int
-server_reconfigure (xlator_t *this, dict_t *options)
+server_reconfigure(xlator_t *this, dict_t *options)
{
+ server_conf_t *conf = NULL;
+ rpcsvc_t *rpc_conf;
+ rpcsvc_listener_t *listeners;
+ rpc_transport_t *xprt = NULL;
+ rpc_transport_t *xp_next = NULL;
+ int inode_lru_limit;
+ gf_boolean_t trace;
+ data_t *data;
+ int ret = 0;
+ char *statedump_path = NULL;
+ int32_t new_nthread = 0;
+ char *auth_path = NULL;
+ char *xprt_path = NULL;
+ xlator_t *oldTHIS;
+ xlator_t *kid;
+
+ /*
+ * Since we're not a fop, we can't really count on THIS being set
+ * correctly, and it needs to be or else GF_OPTION_RECONF won't work
+ * (because it won't find our options list). This is another thing
+ * that "just happened" to work before multiplexing, but now we need to
+ * handle it more explicitly.
+ */
+ oldTHIS = THIS;
+ THIS = this;
+
+ conf = this->private;
+
+ if (!conf) {
+ gf_msg_callingfn(this->name, GF_LOG_DEBUG, EINVAL, PS_MSG_INVALID_ENTRY,
+ "conf == null!!!");
+ goto out;
+ }
+
+ /*
+ * For some of the auth/rpc stuff, we need to operate on the correct
+ * child, but for other stuff we need to operate on the server
+ * translator itself.
+ */
+ kid = NULL;
+ if (dict_get_str(options, "auth-path", &auth_path) == 0) {
+ kid = get_xlator_by_name(this, auth_path);
+ }
+ if (!kid) {
+ kid = this;
+ }
+
+ if (dict_get_int32(options, "inode-lru-limit", &inode_lru_limit) == 0) {
+ conf->inode_lru_limit = inode_lru_limit;
+ gf_msg_trace(this->name, 0,
+ "Reconfigured inode-lru-limit to "
+ "%d",
+ conf->inode_lru_limit);
+
+ /* traverse through the xlator graph. For each xlator in the
+ graph check whether it is a bound_xl or not (bound_xl means
+ the xlator will have its itable pointer set). If so, then
+ set the lru limit for the itable.
+ */
+ xlator_foreach(this, xlator_set_inode_lru_limit, &inode_lru_limit);
+ }
- server_conf_t *conf =NULL;
- rpcsvc_t *rpc_conf;
- rpcsvc_listener_t *listeners;
- rpc_transport_t *xprt = NULL;
- rpc_transport_t *xp_next = NULL;
- int inode_lru_limit;
- gf_boolean_t trace;
- data_t *data;
- int ret = 0;
- char *statedump_path = NULL;
- int32_t new_nthread = 0;
- char *auth_path = NULL;
- char *xprt_path = NULL;
- xlator_t *oldTHIS;
- xlator_t *kid;
-
- /*
- * Since we're not a fop, we can't really count on THIS being set
- * correctly, and it needs to be or else GF_OPTION_RECONF won't work
- * (because it won't find our options list). This is another thing
- * that "just happened" to work before multiplexing, but now we need to
- * handle it more explicitly.
- */
- oldTHIS = THIS;
- THIS = this;
-
- conf = this->private;
-
- if (!conf) {
- gf_msg_callingfn (this->name, GF_LOG_DEBUG, EINVAL,
- PS_MSG_INVALID_ENTRY, "conf == null!!!");
- goto out;
- }
-
- /*
- * For some of the auth/rpc stuff, we need to operate on the correct
- * child, but for other stuff we need to operate on the server
- * translator itself.
- */
- kid = NULL;
- if (dict_get_str (options, "auth-path", &auth_path) == 0) {
- kid = get_xlator_by_name (this, auth_path);
- }
- if (!kid) {
- kid = this;
- }
-
- if (dict_get_int32 ( options, "inode-lru-limit", &inode_lru_limit) == 0){
- conf->inode_lru_limit = inode_lru_limit;
- gf_msg_trace (this->name, 0, "Reconfigured inode-lru-limit to "
- "%d", conf->inode_lru_limit);
-
- /* traverse through the xlator graph. For each xlator in the
- graph check whether it is a bound_xl or not (bound_xl means
- the xlator will have its itable pointer set). If so, then
- set the lru limit for the itable.
- */
- xlator_foreach (this, xlator_set_inode_lru_limit,
- &inode_lru_limit);
- }
-
- data = dict_get (options, "trace");
- if (data) {
- ret = gf_string2boolean (data->data, &trace);
- if (ret != 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PS_MSG_INVALID_ENTRY, "'trace' takes on only "
- "boolean values. Neglecting option");
- ret = -1;
- goto out;
- }
- conf->trace = trace;
- gf_msg_trace (this->name, 0, "Reconfigured trace to %d",
- conf->trace);
-
- }
-
- GF_OPTION_RECONF ("statedump-path", statedump_path,
- options, path, do_auth);
- if (!statedump_path) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_STATEDUMP_PATH_ERROR,
- "Error while reconfiguring statedump path");
- goto do_auth;
+ data = dict_get(options, "trace");
+ if (data) {
+ ret = gf_string2boolean(data->data, &trace);
+ if (ret != 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ "'trace' takes on only "
+ "boolean values. Neglecting option");
+ ret = -1;
+ goto out;
}
- gf_path_strip_trailing_slashes (statedump_path);
- GF_FREE (this->ctx->statedump_path);
- this->ctx->statedump_path = gf_strdup (statedump_path);
+ conf->trace = trace;
+ gf_msg_trace(this->name, 0, "Reconfigured trace to %d", conf->trace);
+ }
+
+ GF_OPTION_RECONF("statedump-path", statedump_path, options, path, do_auth);
+ if (!statedump_path) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_STATEDUMP_PATH_ERROR,
+ "Error while reconfiguring statedump path");
+ goto do_auth;
+ }
+ gf_path_strip_trailing_slashes(statedump_path);
+ GF_FREE(this->ctx->statedump_path);
+ this->ctx->statedump_path = gf_strdup(statedump_path);
do_auth:
- if (!conf->auth_modules)
- conf->auth_modules = dict_new ();
-
- dict_foreach (options, get_auth_types, conf->auth_modules);
- ret = validate_auth_options (kid, options);
- if (ret == -1) {
- /* logging already done in validate_auth_options function. */
- goto out;
- }
-
- dict_foreach (kid->options, _delete_auth_opt, NULL);
- dict_foreach (options, _copy_auth_opt, kid->options);
-
- ret = gf_auth_init (kid, conf->auth_modules);
- if (ret) {
- dict_unref (conf->auth_modules);
- goto out;
- }
-
- GF_OPTION_RECONF ("manage-gids", conf->server_manage_gids, options,
- bool, do_rpc);
-
- GF_OPTION_RECONF ("gid-timeout", conf->gid_cache_timeout, options,
- int32, do_rpc);
- if (gid_cache_reconf (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
- "Failed to reconfigure group cache.");
- goto do_rpc;
- }
+ if (!conf->auth_modules)
+ conf->auth_modules = dict_new();
+
+ dict_foreach(options, get_auth_types, conf->auth_modules);
+ ret = validate_auth_options(kid, options);
+ if (ret == -1) {
+ /* logging already done in validate_auth_options function. */
+ goto out;
+ }
+
+ dict_foreach(kid->options, _delete_auth_opt, NULL);
+ dict_foreach(options, _copy_auth_opt, kid->options);
+
+ ret = gf_auth_init(kid, conf->auth_modules);
+ if (ret) {
+ dict_unref(conf->auth_modules);
+ goto out;
+ }
+
+ GF_OPTION_RECONF("manage-gids", conf->server_manage_gids, options, bool,
+ do_rpc);
+
+ GF_OPTION_RECONF("gid-timeout", conf->gid_cache_timeout, options, int32,
+ do_rpc);
+ if (gid_cache_reconf(&conf->gid_cache, conf->gid_cache_timeout) < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
+ "Failed to reconfigure group cache.");
+ goto do_rpc;
+ }
do_rpc:
- rpc_conf = conf->rpc;
- if (!rpc_conf) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "No rpc_conf !!!!");
- goto out;
- }
-
- ret = rpcsvc_auth_reconf (rpc_conf, options);
- if (ret == -1) {
- gf_log (GF_RPCSVC, GF_LOG_ERROR,
- "Failed to reconfigure authentication");
- goto out;
- }
-
- GF_OPTION_RECONF ("strict-auth-accept", conf->strict_auth_enabled,
- options, bool, out);
-
-
- GF_OPTION_RECONF ("dynamic-auth", conf->dync_auth, options,
- bool, out);
-
- if (conf->dync_auth) {
- pthread_mutex_lock (&conf->mutex);
- {
- /*
- * Disconnecting will (usually) drop the last ref,
- * which will cause the transport to be unlinked and
- * freed while we're still traversing, which will cause
- * us to crash unless we use list_for_each_entry_safe.
- */
- list_for_each_entry_safe (xprt, xp_next,
- &conf->xprt_list, list) {
- /* check for client authorization */
- if (!xprt->clnt_options) {
- /* If clnt_options dictionary is null,
- * which means for this transport
- * server_setvolume was not called.
- *
- * So here we can skip authentication
- * because server_setvolume will do
- * gf_authenticate.
- *
- */
- continue;
- }
- /*
- * Make sure we're only operating on
- * connections that are relevant to the brick
- * we're reconfiguring.
- */
- if (dict_get_str (xprt->clnt_options,
- "remote-subvolume",
- &xprt_path) != 0) {
- continue;
- }
- if (strcmp (xprt_path, auth_path) != 0) {
- continue;
- }
- ret = gf_authenticate (xprt->clnt_options,
- options,
- conf->auth_modules);
- if (ret == AUTH_ACCEPT) {
- gf_msg (kid->name, GF_LOG_TRACE, 0,
- PS_MSG_CLIENT_ACCEPTED,
- "authorized client, hence we "
- "continue with this connection");
- } else {
- gf_event (EVENT_CLIENT_AUTH_REJECT,
- "client_uid=%s;"
- "client_identifier=%s;"
- "server_identifier=%s;"
- "brick_path=%s",
- xprt->xl_private->client_uid,
- xprt->peerinfo.identifier,
- xprt->myinfo.identifier,
- auth_path);
- gf_msg (this->name, GF_LOG_INFO,
- EACCES,
- PS_MSG_AUTHENTICATE_ERROR,
- "unauthorized client, hence "
- "terminating the connection %s",
- xprt->peerinfo.identifier);
- rpc_transport_disconnect(xprt,
- _gf_false);
- }
- }
+ rpc_conf = conf->rpc;
+ if (!rpc_conf) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
+ "No rpc_conf !!!!");
+ goto out;
+ }
+
+ ret = rpcsvc_auth_reconf(rpc_conf, options);
+ if (ret == -1) {
+ gf_log(GF_RPCSVC, GF_LOG_ERROR, "Failed to reconfigure authentication");
+ goto out;
+ }
+
+ GF_OPTION_RECONF("strict-auth-accept", conf->strict_auth_enabled, options,
+ bool, out);
+
+ GF_OPTION_RECONF("dynamic-auth", conf->dync_auth, options, bool, out);
+
+ if (conf->dync_auth) {
+ pthread_mutex_lock(&conf->mutex);
+ {
+ /*
+ * Disconnecting will (usually) drop the last ref,
+ * which will cause the transport to be unlinked and
+ * freed while we're still traversing, which will cause
+ * us to crash unless we use list_for_each_entry_safe.
+ */
+ list_for_each_entry_safe(xprt, xp_next, &conf->xprt_list, list)
+ {
+ /* check for client authorization */
+ if (!xprt->clnt_options) {
+ /* If clnt_options dictionary is null,
+ * which means for this transport
+ * server_setvolume was not called.
+ *
+ * So here we can skip authentication
+ * because server_setvolume will do
+ * gf_authenticate.
+ *
+ */
+ continue;
}
- pthread_mutex_unlock (&conf->mutex);
- }
-
- ret = rpcsvc_set_outstanding_rpc_limit (rpc_conf, options,
- RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "Failed to reconfigure outstanding-rpc-limit");
- goto out;
- }
-
- list_for_each_entry (listeners, &(rpc_conf->listeners), list) {
- if (listeners->trans != NULL) {
- if (listeners->trans->reconfigure )
- listeners->trans->reconfigure (listeners->trans, options);
- else
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_TRANSPORT_ERROR, "Reconfigure "
- "not found for transport");
+ /*
+ * Make sure we're only operating on
+ * connections that are relevant to the brick
+ * we're reconfiguring.
+ */
+ if (dict_get_str(xprt->clnt_options, "remote-subvolume",
+ &xprt_path) != 0) {
+ continue;
+ }
+ if (strcmp(xprt_path, auth_path) != 0) {
+ continue;
+ }
+ ret = gf_authenticate(xprt->clnt_options, options,
+ conf->auth_modules);
+ if (ret == AUTH_ACCEPT) {
+ gf_msg(kid->name, GF_LOG_TRACE, 0, PS_MSG_CLIENT_ACCEPTED,
+ "authorized client, hence we "
+ "continue with this connection");
+ } else {
+ gf_event(EVENT_CLIENT_AUTH_REJECT,
+ "client_uid=%s;"
+ "client_identifier=%s;"
+ "server_identifier=%s;"
+ "brick_path=%s",
+ xprt->xl_private->client_uid,
+ xprt->peerinfo.identifier, xprt->myinfo.identifier,
+ auth_path);
+ gf_msg(this->name, GF_LOG_INFO, EACCES,
+ PS_MSG_AUTHENTICATE_ERROR,
+ "unauthorized client, hence "
+ "terminating the connection %s",
+ xprt->peerinfo.identifier);
+ rpc_transport_disconnect(xprt, _gf_false);
}
+ }
}
-
- /*
- * Update:
- * We don't need to reset auto_thread_count since it has been derived
- * out of the total bricks attached. We can reconfigure event threads
- * but not auto threads.
- */
-
- GF_OPTION_RECONF ("event-threads", new_nthread, options, int32, out);
- ret = server_check_event_threads (this, conf, new_nthread);
- if (ret)
- goto out;
-
- /* rpcsvc thread reconfigure should be after events thread
- * reconfigure
- */
- new_nthread =
- ((struct event_pool *)(this->ctx->event_pool))->eventthreadcount;
- ret = rpcsvc_ownthread_reconf (rpc_conf, new_nthread);
+ pthread_mutex_unlock(&conf->mutex);
+ }
+
+ ret = rpcsvc_set_outstanding_rpc_limit(
+ rpc_conf, options, RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
+ "Failed to reconfigure outstanding-rpc-limit");
+ goto out;
+ }
+
+ list_for_each_entry(listeners, &(rpc_conf->listeners), list)
+ {
+ if (listeners->trans != NULL) {
+ if (listeners->trans->reconfigure)
+ listeners->trans->reconfigure(listeners->trans, options);
+ else
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
+ "Reconfigure "
+ "not found for transport");
+ }
+ }
+
+ /*
+ * Update:
+ * We don't need to reset auto_thread_count since it has been derived
+ * out of the total bricks attached. We can reconfigure event threads
+ * but not auto threads.
+ */
+
+ GF_OPTION_RECONF("event-threads", new_nthread, options, int32, out);
+ ret = server_check_event_threads(this, conf, new_nthread);
+ if (ret)
+ goto out;
+
+ /* rpcsvc thread reconfigure should be after events thread
+ * reconfigure
+ */
+ new_nthread = ((struct event_pool *)(this->ctx->event_pool))
+ ->eventthreadcount;
+ ret = rpcsvc_ownthread_reconf(rpc_conf, new_nthread);
out:
- THIS = oldTHIS;
- gf_msg_debug ("", 0, "returning %d", ret);
- return ret;
+ THIS = oldTHIS;
+ gf_msg_debug("", 0, "returning %d", ret);
+ return ret;
}
static int32_t
-client_destroy_cbk (xlator_t *this, client_t *client)
+client_destroy_cbk(xlator_t *this, client_t *client)
{
- void *tmp = NULL;
- server_ctx_t *ctx = NULL;
+ void *tmp = NULL;
+ server_ctx_t *ctx = NULL;
- client_ctx_del (client, this, &tmp);
+ client_ctx_del(client, this, &tmp);
- ctx = tmp;
+ ctx = tmp;
- if (ctx == NULL)
- return 0;
+ if (ctx == NULL)
+ return 0;
- gf_fd_fdtable_destroy (ctx->fdtable);
- LOCK_DESTROY (&ctx->fdtable_lock);
- GF_FREE (ctx);
+ gf_fd_fdtable_destroy(ctx->fdtable);
+ LOCK_DESTROY(&ctx->fdtable_lock);
+ GF_FREE(ctx);
- return 0;
+ return 0;
}
int32_t
-server_dump_metrics (xlator_t *this, int fd)
+server_dump_metrics(xlator_t *this, int fd)
{
- rpc_transport_t *xprt = NULL;
- server_conf_t *conf = NULL;
- client_t *client = NULL;
+ rpc_transport_t *xprt = NULL;
+ server_conf_t *conf = NULL;
+ client_t *client = NULL;
- conf = this->private;
+ conf = this->private;
- pthread_mutex_lock (&conf->mutex);
+ pthread_mutex_lock(&conf->mutex);
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- client = xprt->xl_private;
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ client = xprt->xl_private;
- if (!client)
- continue;
+ if (!client)
+ continue;
- dprintf (fd, "%s.total.rpc.%s.bytes_read %lu\n", this->name,
- client->client_uid, xprt->total_bytes_read);
- dprintf (fd, "%s.total.rpc.%s.bytes_write %lu\n", this->name,
- client->client_uid, xprt->total_bytes_write);
- dprintf (fd, "%s.total.rpc.%s.outstanding %d\n", this->name,
- client->client_uid, xprt->outstanding_rpc_count);
- }
+ dprintf(fd, "%s.total.rpc.%s.bytes_read %lu\n", this->name,
+ client->client_uid, xprt->total_bytes_read);
+ dprintf(fd, "%s.total.rpc.%s.bytes_write %lu\n", this->name,
+ client->client_uid, xprt->total_bytes_write);
+ dprintf(fd, "%s.total.rpc.%s.outstanding %d\n", this->name,
+ client->client_uid, xprt->outstanding_rpc_count);
+ }
- pthread_mutex_unlock (&conf->mutex);
+ pthread_mutex_unlock(&conf->mutex);
- return 0;
+ return 0;
}
int
-server_init (xlator_t *this)
+server_init(xlator_t *this)
{
- int32_t ret = -1;
- server_conf_t *conf = NULL;
- char *transport_type = NULL;
- char *statedump_path = NULL;
- int total_transport = 0;
-
- GF_VALIDATE_OR_GOTO ("init", this, out);
-
- if (this->children == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL,
- "protocol/server should have subvolume");
- goto out;
- }
-
- if (this->parents != NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR,
- "protocol/server should not have parent volumes");
- goto out;
- }
-
- conf = GF_CALLOC (1, sizeof (server_conf_t),
- gf_server_mt_server_conf_t);
-
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
-
- INIT_LIST_HEAD (&conf->xprt_list);
- pthread_mutex_init (&conf->mutex, NULL);
-
- LOCK_INIT (&conf->itable_lock);
-
- /* Set event threads to the configured default */
- GF_OPTION_INIT("event-threads", conf->event_threads, int32, out);
- ret = server_check_event_threads (this, conf, conf->event_threads);
- if (ret)
- goto out;
-
- ret = server_build_config (this, conf);
- if (ret)
- goto out;
-
- ret = dict_get_str (this->options, "config-directory", &conf->conf_dir);
- if (ret)
- conf->conf_dir = CONFDIR;
-
- conf->child_status = GF_CALLOC (1, sizeof (struct _child_status),
- gf_server_mt_child_status);
- INIT_LIST_HEAD (&conf->child_status->status_list);
- GF_ATOMIC_INIT (conf->child_status->xprtrefcnt, 0);
-
- /*ret = dict_get_str (this->options, "statedump-path", &statedump_path);
- if (!ret) {
- gf_path_strip_trailing_slashes (statedump_path);
- this->ctx->statedump_path = statedump_path;
- }*/
- GF_OPTION_INIT ("statedump-path", statedump_path, path, out);
- if (statedump_path) {
- gf_path_strip_trailing_slashes (statedump_path);
- this->ctx->statedump_path = gf_strdup (statedump_path);
- } else {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_STATEDUMP_PATH_ERROR,
- "Error setting statedump path");
- ret = -1;
- goto out;
- }
-
- /* Authentication modules */
- conf->auth_modules = dict_new ();
- GF_VALIDATE_OR_GOTO(this->name, conf->auth_modules, out);
-
- dict_foreach (this->options, get_auth_types, conf->auth_modules);
- ret = validate_auth_options (this, this->options);
- if (ret == -1) {
- /* logging already done in validate_auth_options function. */
- goto out;
- }
-
- ret = gf_auth_init (this, conf->auth_modules);
- if (ret) {
- dict_unref (conf->auth_modules);
- goto out;
- }
-
- ret = dict_get_str_boolean (this->options, "manage-gids", _gf_false);
- if (ret == -1)
- conf->server_manage_gids = _gf_false;
- else
- conf->server_manage_gids = ret;
-
- GF_OPTION_INIT("gid-timeout", conf->gid_cache_timeout, int32, out);
- if (gid_cache_init (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
- "Failed to initialize group cache.");
- goto out;
- }
-
- ret = dict_get_str_boolean (this->options, "strict-auth-accept",
- _gf_false);
- if (ret == -1)
- conf->strict_auth_enabled = _gf_false;
- else
- conf->strict_auth_enabled = ret;
-
- ret = dict_get_str_boolean (this->options, "dynamic-auth",
- _gf_true);
- if (ret == -1)
- conf->dync_auth = _gf_true;
- else
- conf->dync_auth = ret;
-
- /* RPC related */
- conf->rpc = rpcsvc_init (this, this->ctx, this->options, 0);
- if (conf->rpc == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_RPCSVC_CREATE_FAILED, "creation of rpcsvc "
- "failed");
- ret = -1;
- goto out;
- }
-
- ret = rpcsvc_set_outstanding_rpc_limit (conf->rpc, this->options,
- RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "Failed to configure outstanding-rpc-limit");
- goto out;
- }
-
- /*
- * This is the only place where we want secure_srvr to reflect
- * the data-plane setting.
- */
- this->ctx->secure_srvr = MGMT_SSL_COPY_IO;
-
- ret = dict_get_str (this->options, "transport-type", &transport_type);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
- "option transport-type not set");
- ret = -1;
- goto out;
- }
- total_transport = rpc_transport_count (transport_type);
- if (total_transport <= 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
- "failed to get total number of available tranpsorts");
- ret = -1;
- goto out;
- }
- ret = rpcsvc_create_listeners (conf->rpc, this->options,
- this->name);
- if (ret < 1) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
- "creation of listener failed");
- if (ret != -EADDRINUSE)
- ret = -1;
- goto out;
- } else if (ret < total_transport) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
- "creation of %d listeners failed, continuing with "
- "succeeded transport", (total_transport - ret));
- }
-
- ret = rpcsvc_register_notify (conf->rpc, server_rpc_notify, this);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY,
- "registration of notify with rpcsvc failed");
- goto out;
- }
-
- glusterfs3_3_fop_prog.options = this->options;
- /* make sure we register the fop program at the head to optimize
- * lookup
- */
- ret = rpcsvc_program_register (conf->rpc, &glusterfs3_3_fop_prog,
- _gf_true);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
- "registration of program (name:%s, prognum:%d, "
- "progver:%d) failed", glusterfs3_3_fop_prog.progname,
- glusterfs3_3_fop_prog.prognum,
- glusterfs3_3_fop_prog.progver);
- goto out;
- }
-
- glusterfs4_0_fop_prog.options = this->options;
- ret = rpcsvc_program_register (conf->rpc, &glusterfs4_0_fop_prog,
- _gf_true);
- if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
- "registration of program (name:%s, prognum:%d, "
- "progver:%d) failed", glusterfs4_0_fop_prog.progname,
- glusterfs4_0_fop_prog.prognum,
- glusterfs4_0_fop_prog.progver);
- rpcsvc_program_unregister (conf->rpc, &glusterfs3_3_fop_prog);
- goto out;
- }
-
- gluster_handshake_prog.options = this->options;
- ret = rpcsvc_program_register (conf->rpc, &gluster_handshake_prog,
- _gf_false);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
- "registration of program (name:%s, prognum:%d, "
- "progver:%d) failed", gluster_handshake_prog.progname,
- gluster_handshake_prog.prognum,
- gluster_handshake_prog.progver);
- rpcsvc_program_unregister (conf->rpc, &glusterfs3_3_fop_prog);
- rpcsvc_program_unregister (conf->rpc, &glusterfs4_0_fop_prog);
- goto out;
- }
+ int32_t ret = -1;
+ server_conf_t *conf = NULL;
+ char *transport_type = NULL;
+ char *statedump_path = NULL;
+ int total_transport = 0;
+
+ GF_VALIDATE_OR_GOTO("init", this, out);
+
+ if (this->children == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL,
+ "protocol/server should have subvolume");
+ goto out;
+ }
+
+ if (this->parents != NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR,
+ "protocol/server should not have parent volumes");
+ goto out;
+ }
+
+ conf = GF_CALLOC(1, sizeof(server_conf_t), gf_server_mt_server_conf_t);
+
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ INIT_LIST_HEAD(&conf->xprt_list);
+ pthread_mutex_init(&conf->mutex, NULL);
+
+ LOCK_INIT(&conf->itable_lock);
+
+ /* Set event threads to the configured default */
+ GF_OPTION_INIT("event-threads", conf->event_threads, int32, out);
+ ret = server_check_event_threads(this, conf, conf->event_threads);
+ if (ret)
+ goto out;
+
+ ret = server_build_config(this, conf);
+ if (ret)
+ goto out;
+
+ ret = dict_get_str(this->options, "config-directory", &conf->conf_dir);
+ if (ret)
+ conf->conf_dir = CONFDIR;
+
+ conf->child_status = GF_CALLOC(1, sizeof(struct _child_status),
+ gf_server_mt_child_status);
+ INIT_LIST_HEAD(&conf->child_status->status_list);
+ GF_ATOMIC_INIT(conf->child_status->xprtrefcnt, 0);
+
+ /*ret = dict_get_str (this->options, "statedump-path", &statedump_path);
+ if (!ret) {
+ gf_path_strip_trailing_slashes (statedump_path);
+ this->ctx->statedump_path = statedump_path;
+ }*/
+ GF_OPTION_INIT("statedump-path", statedump_path, path, out);
+ if (statedump_path) {
+ gf_path_strip_trailing_slashes(statedump_path);
+ this->ctx->statedump_path = gf_strdup(statedump_path);
+ } else {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_STATEDUMP_PATH_ERROR,
+ "Error setting statedump path");
+ ret = -1;
+ goto out;
+ }
+
+ /* Authentication modules */
+ conf->auth_modules = dict_new();
+ GF_VALIDATE_OR_GOTO(this->name, conf->auth_modules, out);
+
+ dict_foreach(this->options, get_auth_types, conf->auth_modules);
+ ret = validate_auth_options(this, this->options);
+ if (ret == -1) {
+ /* logging already done in validate_auth_options function. */
+ goto out;
+ }
+
+ ret = gf_auth_init(this, conf->auth_modules);
+ if (ret) {
+ dict_unref(conf->auth_modules);
+ goto out;
+ }
+
+ ret = dict_get_str_boolean(this->options, "manage-gids", _gf_false);
+ if (ret == -1)
+ conf->server_manage_gids = _gf_false;
+ else
+ conf->server_manage_gids = ret;
+
+ GF_OPTION_INIT("gid-timeout", conf->gid_cache_timeout, int32, out);
+ if (gid_cache_init(&conf->gid_cache, conf->gid_cache_timeout) < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
+ "Failed to initialize group cache.");
+ goto out;
+ }
+
+ ret = dict_get_str_boolean(this->options, "strict-auth-accept", _gf_false);
+ if (ret == -1)
+ conf->strict_auth_enabled = _gf_false;
+ else
+ conf->strict_auth_enabled = ret;
+
+ ret = dict_get_str_boolean(this->options, "dynamic-auth", _gf_true);
+ if (ret == -1)
+ conf->dync_auth = _gf_true;
+ else
+ conf->dync_auth = ret;
+
+ /* RPC related */
+ conf->rpc = rpcsvc_init(this, this->ctx, this->options, 0);
+ if (conf->rpc == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPCSVC_CREATE_FAILED,
+ "creation of rpcsvc "
+ "failed");
+ ret = -1;
+ goto out;
+ }
+
+ ret = rpcsvc_set_outstanding_rpc_limit(
+ conf->rpc, this->options, RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
+ "Failed to configure outstanding-rpc-limit");
+ goto out;
+ }
+
+ /*
+ * This is the only place where we want secure_srvr to reflect
+ * the data-plane setting.
+ */
+ this->ctx->secure_srvr = MGMT_SSL_COPY_IO;
+
+ ret = dict_get_str(this->options, "transport-type", &transport_type);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
+ "option transport-type not set");
+ ret = -1;
+ goto out;
+ }
+ total_transport = rpc_transport_count(transport_type);
+ if (total_transport <= 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
+ "failed to get total number of available tranpsorts");
+ ret = -1;
+ goto out;
+ }
+ ret = rpcsvc_create_listeners(conf->rpc, this->options, this->name);
+ if (ret < 1) {
+ gf_msg(this->name, GF_LOG_WARNING, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
+ "creation of listener failed");
+ if (ret != -EADDRINUSE)
+ ret = -1;
+ goto out;
+ } else if (ret < total_transport) {
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
+ "creation of %d listeners failed, continuing with "
+ "succeeded transport",
+ (total_transport - ret));
+ }
+
+ ret = rpcsvc_register_notify(conf->rpc, server_rpc_notify, this);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY,
+ "registration of notify with rpcsvc failed");
+ goto out;
+ }
+
+ glusterfs3_3_fop_prog.options = this->options;
+ /* make sure we register the fop program at the head to optimize
+ * lookup
+ */
+ ret = rpcsvc_program_register(conf->rpc, &glusterfs3_3_fop_prog, _gf_true);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
+ "registration of program (name:%s, prognum:%d, "
+ "progver:%d) failed",
+ glusterfs3_3_fop_prog.progname, glusterfs3_3_fop_prog.prognum,
+ glusterfs3_3_fop_prog.progver);
+ goto out;
+ }
+
+ glusterfs4_0_fop_prog.options = this->options;
+ ret = rpcsvc_program_register(conf->rpc, &glusterfs4_0_fop_prog, _gf_true);
+ if (ret) {
+ gf_log(this->name, GF_LOG_WARNING,
+ "registration of program (name:%s, prognum:%d, "
+ "progver:%d) failed",
+ glusterfs4_0_fop_prog.progname, glusterfs4_0_fop_prog.prognum,
+ glusterfs4_0_fop_prog.progver);
+ rpcsvc_program_unregister(conf->rpc, &glusterfs3_3_fop_prog);
+ goto out;
+ }
+
+ gluster_handshake_prog.options = this->options;
+ ret = rpcsvc_program_register(conf->rpc, &gluster_handshake_prog,
+ _gf_false);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
+ "registration of program (name:%s, prognum:%d, "
+ "progver:%d) failed",
+ gluster_handshake_prog.progname, gluster_handshake_prog.prognum,
+ gluster_handshake_prog.progver);
+ rpcsvc_program_unregister(conf->rpc, &glusterfs3_3_fop_prog);
+ rpcsvc_program_unregister(conf->rpc, &glusterfs4_0_fop_prog);
+ goto out;
+ }
#ifndef GF_DARWIN_HOST_OS
- {
- struct rlimit lim;
-
- lim.rlim_cur = 1048576;
- lim.rlim_max = 1048576;
-
- if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_msg (this->name, GF_LOG_WARNING, errno,
- PS_MSG_ULIMIT_SET_FAILED, "WARNING: Failed to "
- "set 'ulimit -n 1M': %s", strerror(errno));
- lim.rlim_cur = 65536;
- lim.rlim_max = 65536;
-
- if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_msg (this->name, GF_LOG_WARNING, errno,
- PS_MSG_FD_NOT_FOUND, "Failed to set "
- "max open fd to 64k: %s",
- strerror(errno));
- } else {
- gf_msg_trace (this->name, 0, "max open fd set "
- "to 64k");
- }
- }
+ {
+ struct rlimit lim;
+
+ lim.rlim_cur = 1048576;
+ lim.rlim_max = 1048576;
+
+ if (setrlimit(RLIMIT_NOFILE, &lim) == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, errno, PS_MSG_ULIMIT_SET_FAILED,
+ "WARNING: Failed to "
+ "set 'ulimit -n 1M': %s",
+ strerror(errno));
+ lim.rlim_cur = 65536;
+ lim.rlim_max = 65536;
+
+ if (setrlimit(RLIMIT_NOFILE, &lim) == -1) {
+ gf_msg(this->name, GF_LOG_WARNING, errno, PS_MSG_FD_NOT_FOUND,
+ "Failed to set "
+ "max open fd to 64k: %s",
+ strerror(errno));
+ } else {
+ gf_msg_trace(this->name, 0,
+ "max open fd set "
+ "to 64k");
+ }
}
+ }
#endif
- if (!this->ctx->cmd_args.volfile_id) {
- /* In some use cases this is a valid case, but
- document this to be annoying log in that case */
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PS_MSG_VOL_FILE_OPEN_FAILED,
- "volfile-id argument not given. "
- "This is mandatory argument, defaulting to 'gluster'");
- this->ctx->cmd_args.volfile_id = gf_strdup ("gluster");
- }
- FIRST_CHILD(this)->volfile_id
- = gf_strdup (this->ctx->cmd_args.volfile_id);
-
- this->private = conf;
- ret = 0;
+ if (!this->ctx->cmd_args.volfile_id) {
+ /* In some use cases this is a valid case, but
+ document this to be annoying log in that case */
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_VOL_FILE_OPEN_FAILED,
+ "volfile-id argument not given. "
+ "This is mandatory argument, defaulting to 'gluster'");
+ this->ctx->cmd_args.volfile_id = gf_strdup("gluster");
+ }
+ FIRST_CHILD(this)->volfile_id = gf_strdup(this->ctx->cmd_args.volfile_id);
+
+ this->private = conf;
+ ret = 0;
out:
- if (ret) {
- if (this != NULL) {
- this->fini (this);
- }
+ if (ret) {
+ if (this != NULL) {
+ this->fini(this);
+ }
- if (conf && conf->rpc) {
- rpcsvc_listener_t *listener, *next;
- list_for_each_entry_safe (listener, next,
- &conf->rpc->listeners, list) {
- rpcsvc_listener_destroy (listener);
- }
- }
+ if (conf && conf->rpc) {
+ rpcsvc_listener_t *listener, *next;
+ list_for_each_entry_safe(listener, next, &conf->rpc->listeners,
+ list)
+ {
+ rpcsvc_listener_destroy(listener);
+ }
}
+ }
- return ret;
+ return ret;
}
-
void
-server_fini (xlator_t *this)
+server_fini(xlator_t *this)
{
#if 0
server_conf_t *conf = NULL;
@@ -1269,585 +1221,561 @@ server_fini (xlator_t *this)
this->private = NULL;
#endif
- return;
+ return;
}
int
-server_process_event_upcall (xlator_t *this, void *data)
+server_process_event_upcall(xlator_t *this, void *data)
{
- int ret = -1;
- server_conf_t *conf = NULL;
- client_t *client = NULL;
- char *client_uid = NULL;
- struct gf_upcall *upcall_data = NULL;
- void *up_req = NULL;
- rpc_transport_t *xprt = NULL;
- enum gf_cbk_procnum cbk_procnum = GF_CBK_NULL;
- gfs3_cbk_cache_invalidation_req gf_c_req = {0,};
- gfs3_recall_lease_req gf_recall_lease = {{0,},};
- gfs4_inodelk_contention_req gf_inodelk_contention = {{0},};
- gfs4_entrylk_contention_req gf_entrylk_contention = {{0},};
- xdrproc_t xdrproc;
-
- GF_VALIDATE_OR_GOTO(this->name, data, out);
-
- conf = this->private;
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
-
- upcall_data = (struct gf_upcall *)data;
- client_uid = upcall_data->client_uid;
- /* client_uid could be NULL if the upcall was intended for a server's
- * child xlator (so no client_uid available) but it hasn't handled
- * the notification. For this reason we silently ignore any upcall
- * request with a NULL client_uid, but -1 will be returned.
- */
- if (client_uid == NULL) {
- gf_msg_debug(this->name, 0,
- "NULL client_uid for an upcall request");
+ int ret = -1;
+ server_conf_t *conf = NULL;
+ client_t *client = NULL;
+ char *client_uid = NULL;
+ struct gf_upcall *upcall_data = NULL;
+ void *up_req = NULL;
+ rpc_transport_t *xprt = NULL;
+ enum gf_cbk_procnum cbk_procnum = GF_CBK_NULL;
+ gfs3_cbk_cache_invalidation_req gf_c_req = {
+ 0,
+ };
+ gfs3_recall_lease_req gf_recall_lease = {
+ {
+ 0,
+ },
+ };
+ gfs4_inodelk_contention_req gf_inodelk_contention = {
+ {0},
+ };
+ gfs4_entrylk_contention_req gf_entrylk_contention = {
+ {0},
+ };
+ xdrproc_t xdrproc;
+
+ GF_VALIDATE_OR_GOTO(this->name, data, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ upcall_data = (struct gf_upcall *)data;
+ client_uid = upcall_data->client_uid;
+ /* client_uid could be NULL if the upcall was intended for a server's
+ * child xlator (so no client_uid available) but it hasn't handled
+ * the notification. For this reason we silently ignore any upcall
+ * request with a NULL client_uid, but -1 will be returned.
+ */
+ if (client_uid == NULL) {
+ gf_msg_debug(this->name, 0, "NULL client_uid for an upcall request");
+ goto out;
+ }
+
+ switch (upcall_data->event_type) {
+ case GF_UPCALL_CACHE_INVALIDATION:
+ ret = gf_proto_cache_invalidation_from_upcall(this, &gf_c_req,
+ upcall_data);
+ if (ret < 0)
goto out;
- }
- switch (upcall_data->event_type) {
- case GF_UPCALL_CACHE_INVALIDATION:
- ret = gf_proto_cache_invalidation_from_upcall (this, &gf_c_req,
- upcall_data);
- if (ret < 0)
- goto out;
-
- up_req = &gf_c_req;
- cbk_procnum = GF_CBK_CACHE_INVALIDATION;
- xdrproc = (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req;
- break;
+ up_req = &gf_c_req;
+ cbk_procnum = GF_CBK_CACHE_INVALIDATION;
+ xdrproc = (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req;
+ break;
case GF_UPCALL_RECALL_LEASE:
- ret = gf_proto_recall_lease_from_upcall (this, &gf_recall_lease,
- upcall_data);
- if (ret < 0)
- goto out;
-
- up_req = &gf_recall_lease;
- cbk_procnum = GF_CBK_RECALL_LEASE;
- xdrproc = (xdrproc_t)xdr_gfs3_recall_lease_req;
- break;
+ ret = gf_proto_recall_lease_from_upcall(this, &gf_recall_lease,
+ upcall_data);
+ if (ret < 0)
+ goto out;
+
+ up_req = &gf_recall_lease;
+ cbk_procnum = GF_CBK_RECALL_LEASE;
+ xdrproc = (xdrproc_t)xdr_gfs3_recall_lease_req;
+ break;
case GF_UPCALL_INODELK_CONTENTION:
- ret = gf_proto_inodelk_contention_from_upcall (this,
- &gf_inodelk_contention,
- upcall_data);
- if (ret < 0)
- goto out;
-
- up_req = &gf_inodelk_contention;
- cbk_procnum = GF_CBK_INODELK_CONTENTION;
- xdrproc = (xdrproc_t)xdr_gfs4_inodelk_contention_req;
- break;
+ ret = gf_proto_inodelk_contention_from_upcall(
+ this, &gf_inodelk_contention, upcall_data);
+ if (ret < 0)
+ goto out;
+
+ up_req = &gf_inodelk_contention;
+ cbk_procnum = GF_CBK_INODELK_CONTENTION;
+ xdrproc = (xdrproc_t)xdr_gfs4_inodelk_contention_req;
+ break;
case GF_UPCALL_ENTRYLK_CONTENTION:
- ret = gf_proto_entrylk_contention_from_upcall (this,
- &gf_entrylk_contention,
- upcall_data);
- if (ret < 0)
- goto out;
-
- up_req = &gf_entrylk_contention;
- cbk_procnum = GF_CBK_ENTRYLK_CONTENTION;
- xdrproc = (xdrproc_t)xdr_gfs4_entrylk_contention_req;
- break;
- default:
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PS_MSG_INVALID_ENTRY,
- "Received invalid upcall event(%d)",
- upcall_data->event_type);
+ ret = gf_proto_entrylk_contention_from_upcall(
+ this, &gf_entrylk_contention, upcall_data);
+ if (ret < 0)
goto out;
- }
- pthread_mutex_lock (&conf->mutex);
+ up_req = &gf_entrylk_contention;
+ cbk_procnum = GF_CBK_ENTRYLK_CONTENTION;
+ xdrproc = (xdrproc_t)xdr_gfs4_entrylk_contention_req;
+ break;
+ default:
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ "Received invalid upcall event(%d)",
+ upcall_data->event_type);
+ goto out;
+ }
+
+ pthread_mutex_lock(&conf->mutex);
+ {
+ list_for_each_entry(xprt, &conf->xprt_list, list)
{
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- client = xprt->xl_private;
-
- /* 'client' is not atomically added during xprt entry
- * addition to the list. */
- if (!client || strcmp(client->client_uid, client_uid))
- continue;
-
- ret = rpcsvc_request_submit (conf->rpc, xprt,
- &server_cbk_prog,
- cbk_procnum,
- up_req,
- this->ctx,
- xdrproc);
- if (ret < 0) {
- gf_msg_debug (this->name, 0, "Failed to send "
- "upcall to client:%s upcall "
- "event:%d", client_uid,
- upcall_data->event_type);
- }
- break;
- }
+ client = xprt->xl_private;
+
+ /* 'client' is not atomically added during xprt entry
+ * addition to the list. */
+ if (!client || strcmp(client->client_uid, client_uid))
+ continue;
+
+ ret = rpcsvc_request_submit(conf->rpc, xprt, &server_cbk_prog,
+ cbk_procnum, up_req, this->ctx,
+ xdrproc);
+ if (ret < 0) {
+ gf_msg_debug(this->name, 0,
+ "Failed to send "
+ "upcall to client:%s upcall "
+ "event:%d",
+ client_uid, upcall_data->event_type);
+ }
+ break;
}
- pthread_mutex_unlock (&conf->mutex);
- ret = 0;
+ }
+ pthread_mutex_unlock(&conf->mutex);
+ ret = 0;
out:
- GF_FREE ((gf_c_req.xdata).xdata_val);
- GF_FREE ((gf_recall_lease.xdata).xdata_val);
- GF_FREE ((gf_inodelk_contention.xdata).xdata_val);
- GF_FREE ((gf_entrylk_contention.xdata).xdata_val);
+ GF_FREE((gf_c_req.xdata).xdata_val);
+ GF_FREE((gf_recall_lease.xdata).xdata_val);
+ GF_FREE((gf_inodelk_contention.xdata).xdata_val);
+ GF_FREE((gf_entrylk_contention.xdata).xdata_val);
- return ret;
+ return ret;
}
int
-server_process_child_event (xlator_t *this, int32_t event, void *data,
- enum gf_cbk_procnum cbk_procnum)
+server_process_child_event(xlator_t *this, int32_t event, void *data,
+ enum gf_cbk_procnum cbk_procnum)
{
- int ret = -1;
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
- xlator_t *victim = NULL;
- struct _child_status *tmp = NULL;
-
- GF_VALIDATE_OR_GOTO(this->name, data, out);
-
- conf = this->private;
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ int ret = -1;
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ xlator_t *victim = NULL;
+ struct _child_status *tmp = NULL;
+
+ GF_VALIDATE_OR_GOTO(this->name, data, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ victim = data;
+ pthread_mutex_lock(&conf->mutex);
+ {
+ if (cbk_procnum == GF_CBK_CHILD_UP) {
+ list_for_each_entry(tmp, &conf->child_status->status_list,
+ status_list)
+ {
+ if (tmp->name == NULL)
+ break;
+ if (strcmp(tmp->name, victim->name) == 0)
+ break;
+ }
+ if (tmp->name) {
+ tmp->child_up = _gf_true;
+ } else {
+ tmp = GF_CALLOC(1, sizeof(struct _child_status),
+ gf_server_mt_child_status);
+ INIT_LIST_HEAD(&tmp->status_list);
+ tmp->name = gf_strdup(victim->name);
+ tmp->child_up = _gf_true;
+ list_add_tail(&tmp->status_list,
+ &conf->child_status->status_list);
+ }
+ }
- victim = data;
- pthread_mutex_lock (&conf->mutex);
- {
- if (cbk_procnum == GF_CBK_CHILD_UP) {
- list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
- if (tmp->name == NULL)
- break;
- if (strcmp (tmp->name, victim->name) == 0)
- break;
- }
- if (tmp->name) {
- tmp->child_up = _gf_true;
- } else {
- tmp = GF_CALLOC (1, sizeof (struct _child_status),
- gf_server_mt_child_status);
- INIT_LIST_HEAD (&tmp->status_list);
- tmp->name = gf_strdup (victim->name);
- tmp->child_up = _gf_true;
- list_add_tail (&tmp->status_list,
- &conf->child_status->status_list);
- }
+ if (cbk_procnum == GF_CBK_CHILD_DOWN) {
+ list_for_each_entry(tmp, &conf->child_status->status_list,
+ status_list)
+ {
+ if (strcmp(tmp->name, victim->name) == 0) {
+ tmp->child_up = _gf_false;
+ break;
}
+ }
- if (cbk_procnum == GF_CBK_CHILD_DOWN) {
- list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
- if (strcmp (tmp->name, victim->name) == 0) {
- tmp->child_up = _gf_false;
- break;
- }
- }
-
- if (!tmp->name)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_CHILD_STATUS_FAILED,
- "No xlator %s is found in "
- "child status list", victim->name);
- }
- list_for_each_entry (xprt, &conf->xprt_list, list) {
- if (!xprt->xl_private) {
- continue;
- }
- if (xprt->xl_private->bound_xl == data) {
- rpcsvc_callback_submit (conf->rpc, xprt,
- &server_cbk_prog,
- cbk_procnum,
- NULL, 0, NULL);
- }
- }
+ if (!tmp->name)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
+ "No xlator %s is found in "
+ "child status list",
+ victim->name);
+ }
+ list_for_each_entry(xprt, &conf->xprt_list, list)
+ {
+ if (!xprt->xl_private) {
+ continue;
+ }
+ if (xprt->xl_private->bound_xl == data) {
+ rpcsvc_callback_submit(conf->rpc, xprt, &server_cbk_prog,
+ cbk_procnum, NULL, 0, NULL);
+ }
}
- pthread_mutex_unlock (&conf->mutex);
- ret = 0;
+ }
+ pthread_mutex_unlock(&conf->mutex);
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
int
-server_notify (xlator_t *this, int32_t event, void *data, ...)
+server_notify(xlator_t *this, int32_t event, void *data, ...)
{
- int ret = -1;
- server_conf_t *conf = NULL;
- rpc_transport_t *xprt = NULL;
- rpc_transport_t *xp_next = NULL;
- xlator_t *victim = NULL;
- xlator_t *top = NULL;
- xlator_t *travxl = NULL;
- xlator_list_t **trav_p = NULL;
- struct _child_status *tmp = NULL;
- gf_boolean_t victim_found = _gf_false;
- glusterfs_ctx_t *ctx = NULL;
- gf_boolean_t xprt_found = _gf_false;
- uint64_t totxprt = 0;
-
- GF_VALIDATE_OR_GOTO (THIS->name, this, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
- victim = data;
- ctx = THIS->ctx;
-
- switch (event) {
- case GF_EVENT_UPCALL:
- {
- GF_VALIDATE_OR_GOTO(this->name, data, out);
-
- ret = server_process_event_upcall (this, data);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_event_upcall failed");
- goto out;
- }
- break;
+ int ret = -1;
+ server_conf_t *conf = NULL;
+ rpc_transport_t *xprt = NULL;
+ rpc_transport_t *xp_next = NULL;
+ xlator_t *victim = NULL;
+ xlator_t *top = NULL;
+ xlator_t *travxl = NULL;
+ xlator_list_t **trav_p = NULL;
+ struct _child_status *tmp = NULL;
+ gf_boolean_t victim_found = _gf_false;
+ glusterfs_ctx_t *ctx = NULL;
+ gf_boolean_t xprt_found = _gf_false;
+ uint64_t totxprt = 0;
+
+ GF_VALIDATE_OR_GOTO(THIS->name, this, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ victim = data;
+ ctx = THIS->ctx;
+
+ switch (event) {
+ case GF_EVENT_UPCALL: {
+ GF_VALIDATE_OR_GOTO(this->name, data, out);
+
+ ret = server_process_event_upcall(this, data);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_EVENT_UPCALL_FAILED,
+ "server_process_event_upcall failed");
+ goto out;
+ }
+ break;
}
- case GF_EVENT_PARENT_UP:
- {
- conf = this->private;
+ case GF_EVENT_PARENT_UP: {
+ conf = this->private;
- conf->parent_up = _gf_true;
+ conf->parent_up = _gf_true;
- default_notify (this, event, data);
- break;
+ default_notify(this, event, data);
+ break;
}
- case GF_EVENT_CHILD_UP:
- {
- ret = server_process_child_event (this, event, data,
- GF_CBK_CHILD_UP);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_child_event failed");
- goto out;
- }
- default_notify (this, event, data);
- break;
+ case GF_EVENT_CHILD_UP: {
+ ret = server_process_child_event(this, event, data,
+ GF_CBK_CHILD_UP);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_EVENT_UPCALL_FAILED,
+ "server_process_child_event failed");
+ goto out;
+ }
+ default_notify(this, event, data);
+ break;
}
- case GF_EVENT_CHILD_DOWN:
- {
- ret = server_process_child_event (this, event, data,
- GF_CBK_CHILD_DOWN);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_child_event failed");
- goto out;
- }
- default_notify (this, event, data);
- break;
-
+ case GF_EVENT_CHILD_DOWN: {
+ ret = server_process_child_event(this, event, data,
+ GF_CBK_CHILD_DOWN);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_EVENT_UPCALL_FAILED,
+ "server_process_child_event failed");
+ goto out;
+ }
+ default_notify(this, event, data);
+ break;
}
case GF_EVENT_CLEANUP:
- conf = this->private;
- pthread_mutex_lock (&conf->mutex);
- /* Calculate total no. of xprt available in list for this
- brick xlator
- */
- list_for_each_entry_safe (xprt, xp_next,
- &conf->xprt_list, list) {
- if (!xprt->xl_private) {
- continue;
- }
- if (xprt->xl_private->bound_xl == data) {
- totxprt++;
- }
+ conf = this->private;
+ pthread_mutex_lock(&conf->mutex);
+ /* Calculate total no. of xprt available in list for this
+ brick xlator
+ */
+ list_for_each_entry_safe(xprt, xp_next, &conf->xprt_list, list)
+ {
+ if (!xprt->xl_private) {
+ continue;
}
-
- list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
- if (strcmp (tmp->name, victim->name) == 0) {
- tmp->child_up = _gf_false;
- GF_ATOMIC_INIT (tmp->xprtrefcnt, totxprt);
- break;
- }
+ if (xprt->xl_private->bound_xl == data) {
+ totxprt++;
}
-
- /*
- * Disconnecting will (usually) drop the last ref, which will
- * cause the transport to be unlinked and freed while we're
- * still traversing, which will cause us to crash unless we use
- * list_for_each_entry_safe.
- */
- list_for_each_entry_safe (xprt, xp_next,
- &conf->xprt_list, list) {
- if (!xprt->xl_private) {
- continue;
- }
- if (xprt->xl_private->bound_xl == data) {
- gf_log (this->name, GF_LOG_INFO,
- "disconnecting %s",
- xprt->peerinfo.identifier);
- xprt_found = _gf_true;
- rpc_transport_disconnect (xprt, _gf_false);
- }
+ }
+
+ list_for_each_entry(tmp, &conf->child_status->status_list,
+ status_list)
+ {
+ if (strcmp(tmp->name, victim->name) == 0) {
+ tmp->child_up = _gf_false;
+ GF_ATOMIC_INIT(tmp->xprtrefcnt, totxprt);
+ break;
}
+ }
+
+ /*
+ * Disconnecting will (usually) drop the last ref, which will
+ * cause the transport to be unlinked and freed while we're
+ * still traversing, which will cause us to crash unless we use
+ * list_for_each_entry_safe.
+ */
+ list_for_each_entry_safe(xprt, xp_next, &conf->xprt_list, list)
+ {
+ if (!xprt->xl_private) {
+ continue;
+ }
+ if (xprt->xl_private->bound_xl == data) {
+ gf_log(this->name, GF_LOG_INFO, "disconnecting %s",
+ xprt->peerinfo.identifier);
+ xprt_found = _gf_true;
+ rpc_transport_disconnect(xprt, _gf_false);
+ }
+ }
+
+ pthread_mutex_unlock(&conf->mutex);
+ if (this->ctx->active) {
+ top = this->ctx->active->first;
+ LOCK(&ctx->volfile_lock);
+ for (trav_p = &top->children; *trav_p;
+ trav_p = &(*trav_p)->next) {
+ travxl = (*trav_p)->xlator;
+ if (!travxl->call_cleanup &&
+ strcmp(travxl->name, victim->name) == 0) {
+ victim_found = _gf_true;
+ break;
+ }
+ }
+ if (victim_found)
+ glusterfs_delete_volfile_checksum(ctx, victim->volfile_id);
+ UNLOCK(&ctx->volfile_lock);
- pthread_mutex_unlock (&conf->mutex);
- if (this->ctx->active) {
- top = this->ctx->active->first;
- LOCK (&ctx->volfile_lock);
- for (trav_p = &top->children; *trav_p;
- trav_p = &(*trav_p)->next) {
- travxl = (*trav_p)->xlator;
- if (!travxl->call_cleanup &&
- strcmp (travxl->name, victim->name) == 0) {
- victim_found = _gf_true;
- break;
- }
- }
- if (victim_found)
- glusterfs_delete_volfile_checksum (ctx,
- victim->volfile_id);
- UNLOCK (&ctx->volfile_lock);
-
- rpc_clnt_mgmt_pmap_signout (ctx, victim->name);
-
- if (!xprt_found && victim_found) {
- xlator_mem_cleanup (victim);
- rpcsvc_autoscale_threads (ctx, conf->rpc, -1);
- }
+ rpc_clnt_mgmt_pmap_signout(ctx, victim->name);
+
+ if (!xprt_found && victim_found) {
+ xlator_mem_cleanup(victim);
+ rpcsvc_autoscale_threads(ctx, conf->rpc, -1);
}
- break;
+ }
+ break;
default:
- default_notify (this, event, data);
- break;
- }
- ret = 0;
+ default_notify(this, event, data);
+ break;
+ }
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
struct xlator_fops server_fops;
struct xlator_cbks server_cbks = {
- .client_destroy = client_destroy_cbk,
+ .client_destroy = client_destroy_cbk,
};
struct xlator_dumpops server_dumpops = {
- .priv = server_priv,
- .fd = gf_client_dump_fdtables,
- .inode = gf_client_dump_inodes,
- .priv_to_dict = server_priv_to_dict,
- .fd_to_dict = gf_client_dump_fdtables_to_dict,
- .inode_to_dict = gf_client_dump_inodes_to_dict,
+ .priv = server_priv,
+ .fd = gf_client_dump_fdtables,
+ .inode = gf_client_dump_inodes,
+ .priv_to_dict = server_priv_to_dict,
+ .fd_to_dict = gf_client_dump_fdtables_to_dict,
+ .inode_to_dict = gf_client_dump_inodes_to_dict,
};
-
struct volume_options server_options[] = {
- { .key = {"transport-type"},
- .value = {"rpc", "rpc-over-rdma", "tcp", "socket", "ib-verbs",
- "unix", "ib-sdp", "tcp/server", "ib-verbs/server", "rdma",
- "rdma*([ \t]),*([ \t])socket",
- "rdma*([ \t]),*([ \t])tcp",
- "tcp*([ \t]),*([ \t])rdma",
- "socket*([ \t]),*([ \t])rdma"},
- .type = GF_OPTION_TYPE_STR,
- .default_value = "{{ volume.transport }}"
- },
- { .key = {"transport.listen-backlog"},
- .type = GF_OPTION_TYPE_INT,
- .default_value = "10",
- },
- { .key = {"volume-filename.*"},
- .type = GF_OPTION_TYPE_PATH,
- },
- { .key = {"transport.tcp-user-timeout"},
- .type = GF_OPTION_TYPE_TIME,
- .min = 0,
- .max = 1013,
- .default_value = "42", /* default like network.ping-timeout */
- },
- { .key = {"transport.*"},
- .type = GF_OPTION_TYPE_ANY,
- },
- { .key = {"inode-lru-limit"},
- .type = GF_OPTION_TYPE_INT,
- .min = 0,
- .max = 1048576,
- .default_value = "16384",
- .description = "Specifies the limit on the number of inodes "
- "in the lru list of the inode cache.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"verify-volfile-checksum"},
- .type = GF_OPTION_TYPE_BOOL
- },
- { .key = {"trace"},
- .type = GF_OPTION_TYPE_BOOL
- },
- { .key = {"config-directory",
- "conf-dir"},
- .type = GF_OPTION_TYPE_PATH,
- },
- { .key = {"rpc-auth-allow-insecure", "allow-insecure"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "on",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"root-squash"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "off",
- .description = "Map requests from uid/gid 0 to the anonymous "
- "uid/gid. Note that this does not apply to any other "
- "uids or gids that might be equally sensitive, such "
- "as user bin or group staff.",
- .op_version = {2},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"anonuid"},
- .type = GF_OPTION_TYPE_INT,
- .default_value = "65534", /* RPC_NOBODY_UID */
- .min = 0,
- .max = (uint32_t) -1,
- .description = "value of the uid used for the anonymous "
- "user/nfsnobody when root-squash is enabled.",
- .op_version = {3},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"anongid"},
- .type = GF_OPTION_TYPE_INT,
- .default_value = "65534", /* RPC_NOBODY_GID */
- .min = 0,
- .max = (uint32_t) -1,
- .description = "value of the gid used for the anonymous "
- "user/nfsnobody when root-squash is enabled.",
- .op_version = {3},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"statedump-path"},
- .type = GF_OPTION_TYPE_PATH,
- .default_value = DEFAULT_VAR_RUN_DIRECTORY,
- .description = "Specifies directory in which gluster should save its"
- " statedumps.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- {.key = {"tcp-window-size"},
- .type = GF_OPTION_TYPE_SIZET,
- .min = GF_MIN_SOCKET_WINDOW_SIZE,
- .max = GF_MAX_SOCKET_WINDOW_SIZE,
- .description = "Specifies the window size for tcp socket.",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE
- },
-
- /* The following two options are defined in addr.c, redifined here *
- * for the sake of validation during volume set from cli */
-
- { .key = {"auth.addr.*.allow", "auth.allow"},
- .setkey = "auth.addr.{{ brick.path }}.allow",
- .default_value = "*",
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .description = "Allow a comma separated list of addresses and/or "
- "hostnames to connect to the server. Option "
- "auth.reject overrides this option. By default, all "
- "connections are allowed."
- },
- { .key = {"auth.addr.*.reject", "auth.reject"},
- .setkey = "auth.addr.{{ brick.path }}.reject",
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .description = "Reject a comma separated list of addresses and/or "
- "hostnames to connect to the server. This option "
- "overrides the auth.allow option. By default, all"
- " connections are allowed."
- },
- { .key = {"ssl-allow"},
- .setkey = "auth.login.{{ brick.path }}.ssl-allow",
- .default_value = "*",
- .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
- .description = "Allow a comma separated list of common names (CN) of"
- "the clients that are allowed to access the server."
- "By default, all TLS authenticated clients are"
- "allowed to access the server."
- },
- /* This is not a valid path w.r.t daemons, hence it's string */
- { .key = {"auth-path"},
- .type = GF_OPTION_TYPE_STR,
- .default_value = "{{ brick.path }}"
- },
- { .key = {"rpc.outstanding-rpc-limit"},
- .type = GF_OPTION_TYPE_INT,
- .min = RPCSVC_MIN_OUTSTANDING_RPC_LIMIT,
- .max = RPCSVC_MAX_OUTSTANDING_RPC_LIMIT,
- .default_value = TOSTRING(RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT),
- .description = "Parameter to throttle the number of incoming RPC "
- "requests from a client. 0 means no limit (can "
- "potentially run out of memory)",
- .op_version = {1},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_GLOBAL
- },
- { .key = {"manage-gids"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "off",
- .description = "Resolve groups on the server-side.",
- .op_version = {GD_OP_VERSION_3_6_0},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"gid-timeout"},
- .type = GF_OPTION_TYPE_INT,
- .default_value = "300",
- .description = "Timeout in seconds for the cached groups to expire.",
- .op_version = {GD_OP_VERSION_3_6_0},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"event-threads"},
- .type = GF_OPTION_TYPE_INT,
- .min = 1,
- .max = 1024,
- .default_value = "1",
- .description = "Specifies the number of event threads to execute "
- "in parallel. Larger values would help process"
- " responses faster, depending on available processing"
- " power.",
- .op_version = {GD_OP_VERSION_3_7_0},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"dynamic-auth"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "on",
- .description = "When 'on' perform dynamic authentication of volume "
- "options in order to allow/terminate client "
- "transport connection immediately in response to "
- "*.allow | *.reject volume set options.",
- .op_version = {GD_OP_VERSION_3_7_5},
- .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC
- },
- { .key = {"strict-auth-accept"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "off",
- .description = "strict-auth-accept reject connection with out"
- "a valid username and password."
- },
- { .key = {NULL} },
+ {.key = {"transport-type"},
+ .value = {"rpc", "rpc-over-rdma", "tcp", "socket", "ib-verbs", "unix",
+ "ib-sdp", "tcp/server", "ib-verbs/server", "rdma",
+ "rdma*([ \t]),*([ \t])socket", "rdma*([ \t]),*([ \t])tcp",
+ "tcp*([ \t]),*([ \t])rdma", "socket*([ \t]),*([ \t])rdma"},
+ .type = GF_OPTION_TYPE_STR,
+ .default_value = "{{ volume.transport }}"},
+ {
+ .key = {"transport.listen-backlog"},
+ .type = GF_OPTION_TYPE_INT,
+ .default_value = "10",
+ },
+ {
+ .key = {"volume-filename.*"},
+ .type = GF_OPTION_TYPE_PATH,
+ },
+ {
+ .key = {"transport.tcp-user-timeout"},
+ .type = GF_OPTION_TYPE_TIME,
+ .min = 0,
+ .max = 1013,
+ .default_value = "42", /* default like network.ping-timeout */
+ },
+ {
+ .key = {"transport.*"},
+ .type = GF_OPTION_TYPE_ANY,
+ },
+ {.key = {"inode-lru-limit"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 0,
+ .max = 1048576,
+ .default_value = "16384",
+ .description = "Specifies the limit on the number of inodes "
+ "in the lru list of the inode cache.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"verify-volfile-checksum"}, .type = GF_OPTION_TYPE_BOOL},
+ {.key = {"trace"}, .type = GF_OPTION_TYPE_BOOL},
+ {
+ .key = {"config-directory", "conf-dir"},
+ .type = GF_OPTION_TYPE_PATH,
+ },
+ {.key = {"rpc-auth-allow-insecure", "allow-insecure"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"root-squash"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "Map requests from uid/gid 0 to the anonymous "
+ "uid/gid. Note that this does not apply to any other "
+ "uids or gids that might be equally sensitive, such "
+ "as user bin or group staff.",
+ .op_version = {2},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"anonuid"},
+ .type = GF_OPTION_TYPE_INT,
+ .default_value = "65534", /* RPC_NOBODY_UID */
+ .min = 0,
+ .max = (uint32_t)-1,
+ .description = "value of the uid used for the anonymous "
+ "user/nfsnobody when root-squash is enabled.",
+ .op_version = {3},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"anongid"},
+ .type = GF_OPTION_TYPE_INT,
+ .default_value = "65534", /* RPC_NOBODY_GID */
+ .min = 0,
+ .max = (uint32_t)-1,
+ .description = "value of the gid used for the anonymous "
+ "user/nfsnobody when root-squash is enabled.",
+ .op_version = {3},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"statedump-path"},
+ .type = GF_OPTION_TYPE_PATH,
+ .default_value = DEFAULT_VAR_RUN_DIRECTORY,
+ .description = "Specifies directory in which gluster should save its"
+ " statedumps.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"tcp-window-size"},
+ .type = GF_OPTION_TYPE_SIZET,
+ .min = GF_MIN_SOCKET_WINDOW_SIZE,
+ .max = GF_MAX_SOCKET_WINDOW_SIZE,
+ .description = "Specifies the window size for tcp socket.",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE},
+
+ /* The following two options are defined in addr.c, redifined here *
+ * for the sake of validation during volume set from cli */
+
+ {.key = {"auth.addr.*.allow", "auth.allow"},
+ .setkey = "auth.addr.{{ brick.path }}.allow",
+ .default_value = "*",
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .description = "Allow a comma separated list of addresses and/or "
+ "hostnames to connect to the server. Option "
+ "auth.reject overrides this option. By default, all "
+ "connections are allowed."},
+ {.key = {"auth.addr.*.reject", "auth.reject"},
+ .setkey = "auth.addr.{{ brick.path }}.reject",
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .description = "Reject a comma separated list of addresses and/or "
+ "hostnames to connect to the server. This option "
+ "overrides the auth.allow option. By default, all"
+ " connections are allowed."},
+ {.key = {"ssl-allow"},
+ .setkey = "auth.login.{{ brick.path }}.ssl-allow",
+ .default_value = "*",
+ .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST,
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .description = "Allow a comma separated list of common names (CN) of"
+ "the clients that are allowed to access the server."
+ "By default, all TLS authenticated clients are"
+ "allowed to access the server."},
+ /* This is not a valid path w.r.t daemons, hence it's string */
+ {.key = {"auth-path"},
+ .type = GF_OPTION_TYPE_STR,
+ .default_value = "{{ brick.path }}"},
+ {.key = {"rpc.outstanding-rpc-limit"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = RPCSVC_MIN_OUTSTANDING_RPC_LIMIT,
+ .max = RPCSVC_MAX_OUTSTANDING_RPC_LIMIT,
+ .default_value = TOSTRING(RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT),
+ .description = "Parameter to throttle the number of incoming RPC "
+ "requests from a client. 0 means no limit (can "
+ "potentially run out of memory)",
+ .op_version = {1},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_GLOBAL},
+ {.key = {"manage-gids"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "Resolve groups on the server-side.",
+ .op_version = {GD_OP_VERSION_3_6_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"gid-timeout"},
+ .type = GF_OPTION_TYPE_INT,
+ .default_value = "300",
+ .description = "Timeout in seconds for the cached groups to expire.",
+ .op_version = {GD_OP_VERSION_3_6_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"event-threads"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 1,
+ .max = 1024,
+ .default_value = "1",
+ .description = "Specifies the number of event threads to execute "
+ "in parallel. Larger values would help process"
+ " responses faster, depending on available processing"
+ " power.",
+ .op_version = {GD_OP_VERSION_3_7_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"dynamic-auth"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .description = "When 'on' perform dynamic authentication of volume "
+ "options in order to allow/terminate client "
+ "transport connection immediately in response to "
+ "*.allow | *.reject volume set options.",
+ .op_version = {GD_OP_VERSION_3_7_5},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"strict-auth-accept"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "strict-auth-accept reject connection with out"
+ "a valid username and password."},
+ {.key = {NULL}},
};
-
xlator_api_t xlator_api = {
- .init = server_init,
- .fini = server_fini,
- .notify = server_notify,
- .reconfigure = server_reconfigure,
- .mem_acct_init = server_mem_acct_init,
- .dump_metrics = server_dump_metrics,
- .op_version = {1}, /* Present from the initial version */
- .dumpops = &server_dumpops,
- .fops = &server_fops,
- .cbks = &server_cbks,
- .options = server_options,
- .identifier = "server",
- .category = GF_MAINTAINED,
+ .init = server_init,
+ .fini = server_fini,
+ .notify = server_notify,
+ .reconfigure = server_reconfigure,
+ .mem_acct_init = server_mem_acct_init,
+ .dump_metrics = server_dump_metrics,
+ .op_version = {1}, /* Present from the initial version */
+ .dumpops = &server_dumpops,
+ .fops = &server_fops,
+ .cbks = &server_cbks,
+ .options = server_options,
+ .identifier = "server",
+ .category = GF_MAINTAINED,
};