summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src
diff options
context:
space:
mode:
authorGluster Ant <bugzilla-bot@gluster.org>2018-09-12 17:52:45 +0530
committerNigel Babu <nigelb@redhat.com>2018-09-12 17:52:45 +0530
commite16868dede6455cab644805af6fe1ac312775e13 (patch)
tree15aebdb4fff2d87cf8a72f836816b3aa634da58d /xlators/protocol/server/src
parent45a71c0548b6fd2c757aa2e7b7671a1411948894 (diff)
Land part 2 of clang-format changes
Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src')
-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
8 files changed, 17000 insertions, 17399 deletions
diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c
index 0d95b9a..c1229f9 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 071a1cf..b5d61ed 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 c0b0351..30e7e4b 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 ce20977..cb2a73c 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 b3eda0e..ba4d2f1 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 8efbb8d..c621743 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 : "",<