summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-rpc-fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/server/src/server-rpc-fops.c')
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c2236
1 files changed, 1374 insertions, 862 deletions
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 06cdc02db..138e601ce 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -1,20 +1,11 @@
/*
- Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com>
+ Copyright (c) 2010-2013 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
- GlusterFS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- GlusterFS is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
*/
@@ -33,6 +24,11 @@
#include "xdr-nfs3.h"
+#define SERVER_REQ_SET_ERROR(req, ret) \
+ do { \
+ rpcsvc_request_seterr (req, GARBAGE_ARGS); \
+ ret = RPCSVC_ACTOR_ERROR; \
+ } while (0)
/* Callback function section */
int
@@ -40,17 +36,14 @@ 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;
-
- req = frame->local;
+ gfs3_statfs_rsp rsp = {0,};
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "%"PRId64": STATFS (%s)",
+ gf_log (this->name, GF_LOG_WARNING, "%"PRId64": STATFS (%s)",
frame->root->unique, strerror (op_errno));
goto out;
}
@@ -61,7 +54,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
-
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_statfs_rsp);
@@ -76,16 +69,15 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *stbuf, dict_t *xdata,
struct iatt *postparent)
{
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
- inode_t *root_inode = NULL;
- inode_t *link_inode = NULL;
- loc_t fresh_loc = {0,};
- gfs3_lookup_rsp rsp = {0,};
- uuid_t rootgfid = {0,};
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+ inode_t *root_inode = NULL;
+ inode_t *link_inode = NULL;
+ loc_t fresh_loc = {0,};
+ gfs3_lookup_rsp rsp = {0,};
+ uuid_t rootgfid = {0,};
- req = frame->local;
- state = CALL_STATE(frame);
+ state = CALL_STATE (frame);
if (state->is_revalidate == 1 && op_ret == -1) {
state->is_revalidate = 2;
@@ -93,8 +85,9 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_unref (fresh_loc.inode);
fresh_loc.inode = inode_new (state->itable);
- STACK_WIND (frame, server_lookup_cbk, BOUND_XL (frame),
- BOUND_XL (frame)->fops->lookup,
+ 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);
@@ -103,7 +96,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_stat_from_iatt (&rsp.postparent, postparent);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret) {
@@ -117,7 +110,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- root_inode = BOUND_XL(frame)->itable->root;
+ root_inode = frame->root->client->bound_xl->itable->root;
if (inode == root_inode) {
/* we just looked up root ("/") */
stbuf->ia_ino = 1;
@@ -146,8 +139,9 @@ out:
if (state->resolve.bname) {
gf_log (this->name, ((op_errno == ENOENT) ?
GF_LOG_TRACE : GF_LOG_INFO),
- "%"PRId64": LOOKUP %s (%s/%s) ==> (%s)",
- frame->root->unique, state->loc.path,
+ "%"PRId64": LOOKUP %s (%s/%s) ==> "
+ "(%s)", frame->root->unique,
+ state->loc.path,
uuid_utoa (state->resolve.pargfid),
state->resolve.bname,
strerror (op_errno));
@@ -161,6 +155,7 @@ out:
}
}
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_lookup_rsp);
@@ -175,21 +170,20 @@ 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;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ 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),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret) {
if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
- "%"PRId64": LK %"PRId64" (%s) ==> (%s)",
- frame->root->unique, state->resolve.fd_no,
+ "%"PRId64": LK %"PRId64" (%s) ==> "
+ "(%s)", frame->root->unique,
+ state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
strerror (op_errno));
}
@@ -218,6 +212,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_lk_rsp);
@@ -231,21 +226,19 @@ int
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_connection_t *conn = NULL;
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- conn = SERVER_CONNECTION(frame);
- state = CALL_STATE(frame);
+ 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),
+ 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) {
if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_log (this->name, (op_errno == ENOENT)?
+ GF_LOG_DEBUG:GF_LOG_ERROR,
"%"PRId64": INODELK %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -254,20 +247,11 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn, state->volume,
- &state->loc, NULL, &frame->root->lk_owner,
- GF_FOP_INODELK);
- else
- gf_add_locker (conn, state->volume,
- &state->loc, NULL, frame->root->pid,
- &frame->root->lk_owner,
- GF_FOP_INODELK);
-
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -281,43 +265,32 @@ int
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;
- server_connection_t *conn = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- conn = SERVER_CONNECTION(frame);
- state = CALL_STATE(frame);
+ 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),
+ 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) {
if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {
gf_log (this->name, GF_LOG_INFO,
- "%"PRId64": FINODELK %"PRId64" (%s) ==> (%s)",
- frame->root->unique, state->resolve.fd_no,
+ "%"PRId64": FINODELK %"PRId64" (%s) "
+ "==> (%s)", frame->root->unique,
+ state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
strerror (op_errno));
}
goto out;
}
- if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn, state->volume,
- NULL, state->fd,
- &frame->root->lk_owner, GF_FOP_INODELK);
- else
- gf_add_locker (conn, state->volume,
- NULL, state->fd,
- frame->root->pid,
- &frame->root->lk_owner, GF_FOP_INODELK);
-
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -330,18 +303,15 @@ 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_connection_t *conn = NULL;
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gf_common_rsp rsp = {0,};
+ gf_common_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- req = frame->local;
- conn = SERVER_CONNECTION(frame);
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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) {
if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {
gf_log (this->name, GF_LOG_INFO,
@@ -353,20 +323,11 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn, state->volume,
- &state->loc, NULL, &frame->root->lk_owner,
- GF_FOP_ENTRYLK);
- else
- gf_add_locker (conn, state->volume,
- &state->loc, NULL, frame->root->pid,
- &frame->root->lk_owner,
- GF_FOP_ENTRYLK);
-
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -380,18 +341,15 @@ int
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_connection_t *conn = NULL;
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
+ gf_common_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- req = frame->local;
- conn = SERVER_CONNECTION(frame);
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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) {
if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {
gf_log (this->name, GF_LOG_INFO,
@@ -403,19 +361,11 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn, state->volume,
- NULL, state->fd, &frame->root->lk_owner,
- GF_FOP_ENTRYLK);
- else
- gf_add_locker (conn, state->volume,
- NULL, state->fd, frame->root->pid,
- &frame->root->lk_owner, GF_FOP_ENTRYLK);
-
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -429,17 +379,15 @@ int
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;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ 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),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": ACCESS %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
@@ -452,6 +400,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -465,17 +414,16 @@ 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;
- inode_t *parent = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_rmdir_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *parent = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
+ state = CALL_STATE (frame);
+
if (op_ret) {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": RMDIR %s (%s/%s) ==> (%s)",
@@ -504,6 +452,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_rmdir_rsp);
@@ -518,17 +467,16 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfs3_mkdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- inode_t *link_inode = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_mkdir_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *link_inode = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": MKDIR %s (%s/%s) ==> (%s)",
@@ -551,6 +499,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_mkdir_rsp);
@@ -565,17 +514,16 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfs3_mknod_rsp rsp = {0,};
- server_state_t *state = NULL;
- inode_t *link_inode = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_mknod_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *link_inode = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": MKNOD %s (%s/%s) ==> (%s)",
@@ -598,6 +546,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_mknod_rsp);
@@ -610,17 +559,15 @@ int
server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ 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),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": FSYNCDIR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -633,6 +580,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -646,18 +594,16 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
dict_t *xdata)
{
- gfs3_readdir_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_readdir_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": READDIR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -680,6 +626,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_readdir_rsp);
@@ -694,29 +641,33 @@ int
server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_connection_t *conn = NULL;
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- gfs3_opendir_rsp rsp = {0,};
- uint64_t fd_no = 0;
-
- req = frame->local;
- conn = SERVER_CONNECTION (frame);
- state = CALL_STATE (frame);
+ server_state_t *state = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ rpcsvc_request_t *req = NULL;
+ gfs3_opendir_rsp rsp = {0,};
+ uint64_t fd_no = 0;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ state = CALL_STATE (frame);
+ gf_log (this->name, (op_errno == ENOENT)?
+ GF_LOG_DEBUG:GF_LOG_ERROR,
"%"PRId64": OPENDIR %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
goto out;
}
+ serv_ctx = server_ctx_get (frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ goto out;
+ }
+
fd_bind (fd);
- fd_no = gf_fd_unused_get (conn->fdtable, fd);
+ fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
fd_ref (fd); // on behalf of the client
out:
@@ -724,6 +675,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_opendir_rsp);
@@ -736,17 +688,15 @@ int
server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ 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),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": REMOVEXATTR %s (%s) of key %s ==> (%s)",
frame->root->unique, state->loc.path,
@@ -759,6 +709,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -771,17 +722,15 @@ int
server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
+ gf_common_rsp rsp = {0,};
+ rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": FREMOVEXATTR %"PRId64" (%s) (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -794,6 +743,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -807,17 +757,15 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfs3_getxattr_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
- server_state_t *state = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_getxattr_rsp rsp = {0,};
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
+ state = CALL_STATE (frame);
gf_log (this->name, (((op_errno == ENOTSUP) ||
(op_errno == ENODATA) ||
(op_errno == ENOENT)) ?
@@ -829,13 +777,14 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, (&rsp.dict.dict_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
rsp.dict.dict_len, op_errno, out);
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_getxattr_rsp);
@@ -852,17 +801,15 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfs3_fgetxattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_fgetxattr_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
+ state = CALL_STATE (frame);
gf_log (this->name, ((op_errno == ENOTSUP) ?
GF_LOG_DEBUG : GF_LOG_INFO),
"%"PRId64": FGETXATTR %"PRId64" (%s) (%s) ==> (%s)",
@@ -872,7 +819,7 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, (&rsp.dict.dict_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
rsp.dict.dict_len, op_errno, out);
out:
@@ -880,6 +827,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_fgetxattr_rsp);
@@ -890,6 +838,24 @@ out:
return 0;
}
+/* print every key */
+static int
+_gf_server_log_setxattr_failure (dict_t *d, char *k, data_t *v,
+ void *tmp)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+
+ frame = tmp;
+ state = CALL_STATE (frame);
+
+ gf_log (THIS->name, GF_LOG_INFO,
+ "%"PRId64": SETXATTR %s (%s) ==> %s",
+ frame->root->unique, state->loc.path,
+ uuid_utoa (state->resolve.gfid), k);
+ return 0;
+}
+
int
server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
@@ -898,26 +864,19 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
- /* print every key */
- int _log_setxattr_failure (dict_t *d, char *k, data_t *v,
- void *tmp)
- {
- gf_log (this->name, ((op_errno == ENOTSUP) ?
- GF_LOG_DEBUG : GF_LOG_INFO),
- "%"PRId64": SETXATTR %s (%s) ==> %s (%s)",
- frame->root->unique, state->loc.path,
- uuid_utoa (state->resolve.gfid), k,
- strerror (op_errno));
- return 0;
- }
- dict_foreach (state->dict, _log_setxattr_failure, NULL);
+ state = CALL_STATE (frame);
+ if (op_errno != ENOTSUP)
+ dict_foreach (state->dict,
+ _gf_server_log_setxattr_failure,
+ frame);
+
+ gf_log (THIS->name, ((op_errno == ENOTSUP) ?
+ GF_LOG_DEBUG : GF_LOG_INFO),
+ "%s", strerror (op_errno));
goto out;
}
@@ -925,6 +884,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -933,6 +893,24 @@ out:
return 0;
}
+/* print every key here */
+static int
+_gf_server_log_fsetxattr_failure (dict_t *d, char *k, data_t *v,
+ void *tmp)
+{
+ call_frame_t *frame = NULL;
+ server_state_t *state = NULL;
+
+ frame = tmp;
+ state = CALL_STATE (frame);
+
+ gf_log (THIS->name, GF_LOG_INFO,
+ "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa (state->resolve.gfid), k);
+
+ return 0;
+}
int
server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -942,26 +920,19 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret == -1) {
- /* print every key here */
- int _log_setxattr_failure (dict_t *d, char *k, data_t *v,
- void *tmp)
- {
- gf_log (this->name, ((op_errno == ENOTSUP) ?
- GF_LOG_DEBUG : GF_LOG_INFO),
- "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s (%s)",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid), k,
- strerror (op_errno));
- return 0;
+ state = CALL_STATE (frame);
+ if (op_errno != ENOTSUP) {
+ dict_foreach (state->dict,
+ _gf_server_log_fsetxattr_failure,
+ frame);
}
- dict_foreach (state->dict, _log_setxattr_failure, NULL);
+ gf_log (THIS->name, ((op_errno == ENOTSUP) ?
+ GF_LOG_DEBUG : GF_LOG_INFO),
+ "%s", strerror (op_errno));
goto out;
}
@@ -969,6 +940,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -984,20 +956,19 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *prenewparent, struct iatt *postnewparent,
dict_t *xdata)
{
- gfs3_rename_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- inode_t *tmp_inode = NULL;
- inode_t *tmp_parent = NULL;
- char oldpar_str[50] = {0,};
- char newpar_str[50] = {0,};
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_rename_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ inode_t *tmp_inode = NULL;
+ inode_t *tmp_parent = NULL;
+ char oldpar_str[50] = {0,};
+ char newpar_str[50] = {0,};
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
+ state = CALL_STATE (frame);
+
if (op_ret == -1) {
uuid_utoa_r (state->resolve.gfid, oldpar_str);
uuid_utoa_r (state->resolve2.gfid, newpar_str);
@@ -1012,7 +983,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
stbuf->ia_type = state->loc.inode->ia_type;
/* TODO: log gfid of the inodes */
- gf_log (state->conn->bound_xl->name, GF_LOG_TRACE,
+ gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
"%"PRId64": RENAME_CBK %s ==> %s",
frame->root->unique, state->loc.name, state->loc2.name);
@@ -1054,6 +1025,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_rename_rsp);
@@ -1067,17 +1039,16 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfs3_unlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- inode_t *parent = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_unlink_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *parent = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
+ state = CALL_STATE (frame);
+
if (op_ret) {
gf_log (this->name, (op_errno == ENOENT)?
GF_LOG_DEBUG:GF_LOG_ERROR,
@@ -1089,7 +1060,7 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/* TODO: log gfid of the inodes */
- gf_log (state->conn->bound_xl->name, GF_LOG_TRACE,
+ gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
"%"PRId64": UNLINK_CBK %s",
frame->root->unique, state->loc.name);
@@ -1109,6 +1080,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_unlink_rsp);
@@ -1123,17 +1095,16 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfs3_symlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- inode_t *link_inode = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_symlink_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *link_inode = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": SYMLINK %s (%s/%s) ==> (%s)",
@@ -1156,6 +1127,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_symlink_rsp);
@@ -1171,27 +1143,27 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- gfs3_link_rsp rsp = {0,};
- server_state_t *state = NULL;
- inode_t *link_inode = NULL;
- rpcsvc_request_t *req = NULL;
+ gfs3_link_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ inode_t *link_inode = NULL;
+ rpcsvc_request_t *req = NULL;
char gfid_str[50] = {0,};
char newpar_str[50] = {0,};
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
+ state = CALL_STATE (frame);
+
if (op_ret) {
uuid_utoa_r (state->resolve.gfid, gfid_str);
uuid_utoa_r (state->resolve2.pargfid, newpar_str);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": LINK %s (%s) -> %s/%s ==> (%s)",
- frame->root->unique, state->loc.path, gfid_str,
- newpar_str, state->resolve2.bname, strerror (op_errno));
+ frame->root->unique, state->loc.path,
+ gfid_str, newpar_str, state->resolve2.bname,
+ strerror (op_errno));
goto out;
}
@@ -1207,6 +1179,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_link_rsp);
@@ -1220,17 +1193,15 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfs3_truncate_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_truncate_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": TRUNCATE %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
@@ -1245,6 +1216,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_truncate_rsp);
@@ -1258,17 +1230,15 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
dict_t *xdata)
{
- gfs3_fstat_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_fstat_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": FSTAT %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1282,6 +1252,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_fstat_rsp);
@@ -1295,17 +1266,15 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfs3_ftruncate_rsp rsp = {0};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_ftruncate_rsp rsp = {0};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": FTRUNCATE %"PRId64" (%s)==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1320,6 +1289,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_ftruncate_rsp);
@@ -1332,21 +1302,20 @@ int
server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- gf_common_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ 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),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
- "%"PRId64": FLUSH %"PRId64" (%s) ==> (%s)",
+ state = CALL_STATE (frame);
+ gf_log (this->name, (op_errno == ENOENT)?
+ GF_LOG_DEBUG:GF_LOG_ERROR,
+ "%"PRId64": FLUSH %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->resolve.gfid), strerror (op_errno));
+ uuid_utoa (state->resolve.gfid), strerror (op_errno));
goto out;
}
@@ -1354,6 +1323,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -1367,17 +1337,15 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfs3_fsync_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_fsync_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": FSYNC %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1392,6 +1360,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_fsync_rsp);
@@ -1405,17 +1374,15 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
- gfs3_write_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_write_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": WRITEV %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1430,6 +1397,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_write_rsp);
@@ -1445,12 +1413,9 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iovec *vector, int32_t count,
struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
{
- gfs3_read_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_read_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
#ifdef GF_TESTING_IO_XDATA
{
@@ -1462,10 +1427,11 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"testing-xdata-value");
}
#endif
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": READV %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1480,6 +1446,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, vector, count, iobref,
(xdrproc_t)xdr_gfs3_read_rsp);
@@ -1494,17 +1461,15 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uint32_t weak_checksum, uint8_t *strong_checksum,
dict_t *xdata)
{
- gfs3_rchecksum_rsp rsp = {0,};
- rpcsvc_request_t *req = NULL;
+ gfs3_rchecksum_rsp rsp = {0,};
+ rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": RCHECKSUM %"PRId64" (%s)==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1521,6 +1486,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_rchecksum_rsp);
@@ -1534,21 +1500,19 @@ int
server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
- server_connection_t *conn = NULL;
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- uint64_t fd_no = 0;
- gfs3_open_rsp rsp = {0,};
-
- req = frame->local;
- conn = SERVER_CONNECTION (frame);
- state = CALL_STATE (frame);
+ server_state_t *state = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ rpcsvc_request_t *req = NULL;
+ uint64_t fd_no = 0;
+ gfs3_open_rsp rsp = {0,};
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ state = CALL_STATE (frame);
+ gf_log (this->name, (op_errno == ENOENT)?
+ GF_LOG_DEBUG:GF_LOG_ERROR,
"%"PRId64": OPEN %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1556,8 +1520,14 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
+ serv_ctx = server_ctx_get (frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ goto out;
+ }
+
fd_bind (fd);
- fd_no = gf_fd_unused_get (conn->fdtable, fd);
+ fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
fd_ref (fd);
rsp.fd = fd_no;
@@ -1565,6 +1535,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_open_rsp);
GF_FREE (rsp.xdata.xdata_val);
@@ -1579,20 +1550,18 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *stbuf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- server_connection_t *conn = NULL;
server_state_t *state = NULL;
+ server_ctx_t *serv_ctx = NULL;
inode_t *link_inode = NULL;
rpcsvc_request_t *req = NULL;
uint64_t fd_no = 0;
gfs3_create_rsp rsp = {0,};
- req = frame->local;
- conn = SERVER_CONNECTION (frame);
- state = CALL_STATE (frame);
-
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": CREATE %s (%s/%s) ==> (%s)",
@@ -1603,7 +1572,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/* TODO: log gfid too */
- gf_log (state->conn->bound_xl->name, GF_LOG_TRACE,
+ gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
"%"PRId64": CREATE %s (%s)",
frame->root->unique, state->loc.name,
uuid_utoa (stbuf->ia_gfid));
@@ -1630,9 +1599,14 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_lookup (link_inode);
inode_unref (link_inode);
- fd_bind (fd);
+ serv_ctx = server_ctx_get (frame->root->client, this);
+ if (serv_ctx == NULL) {
+ gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ goto out;
+ }
- fd_no = gf_fd_unused_get (conn->fdtable, fd);
+ fd_bind (fd);
+ fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd);
fd_ref (fd);
if ((fd_no < 0) || (fd == 0)) {
@@ -1649,6 +1623,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_create_rsp);
@@ -1662,17 +1637,15 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, const char *buf,
struct iatt *stbuf, dict_t *xdata)
{
- gfs3_readlink_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_readlink_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": READLINK %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
@@ -1691,6 +1664,7 @@ out:
if (!rsp.path)
rsp.path = "";
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_readlink_rsp);
@@ -1704,18 +1678,17 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *stbuf,
dict_t *xdata)
{
- gfs3_stat_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_stat_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret) {
- gf_log (this->name, GF_LOG_INFO,
+ state = CALL_STATE (frame);
+ gf_log (this->name, (op_errno == ENOENT)?
+ GF_LOG_DEBUG:GF_LOG_ERROR,
"%"PRId64": STAT %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1729,6 +1702,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_stat_rsp);
@@ -1743,17 +1717,15 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
{
- gfs3_setattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_setattr_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": SETATTR %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
@@ -1769,6 +1741,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_setattr_rsp);
@@ -1782,17 +1755,15 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
{
- gfs3_fsetattr_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_fsetattr_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ 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_log (this->name, GF_LOG_INFO,
"%"PRId64": FSETATTR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1808,6 +1779,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_fsetattr_rsp);
@@ -1822,17 +1794,15 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfs3_xattrop_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE (frame);
+ gfs3_xattrop_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": XATTROP %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
@@ -1841,13 +1811,14 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, (&rsp.dict.dict_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
rsp.dict.dict_len, op_errno, out);
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_xattrop_rsp);
@@ -1864,17 +1835,15 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict,
dict_t *xdata)
{
- gfs3_xattrop_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_xattrop_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": FXATTROP %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1883,13 +1852,14 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- GF_PROTOCOL_DICT_SERIALIZE (this, dict, (&rsp.dict.dict_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, dict, &rsp.dict.dict_val,
rsp.dict.dict_len, op_errno, out);
out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_fxattrop_rsp);
@@ -1903,20 +1873,19 @@ out:
int
server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata)
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
+ dict_t *xdata)
{
- gfs3_readdirp_rsp rsp = {0,};
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- int ret = 0;
-
- req = frame->local;
- state = CALL_STATE(frame);
+ gfs3_readdirp_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ int ret = 0;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
+ state = CALL_STATE (frame);
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": READDIRP %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
@@ -1942,6 +1911,7 @@ out:
rsp.op_ret = op_ret;
rsp.op_errno = gf_errno_to_error (op_errno);
+ req = frame->local;
server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gfs3_readdirp_rsp);
@@ -1952,6 +1922,122 @@ out:
return 0;
}
+int
+server_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_fallocate_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE (frame);
+ gf_log (this->name, GF_LOG_INFO,
+ "%"PRId64": FALLOCATE %"PRId64" (%s) ==> (%s)",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa (state->resolve.gfid),
+ strerror (op_errno));
+ goto out;
+ }
+
+ gf_stat_from_iatt (&rsp.statpre, statpre);
+ gf_stat_from_iatt (&rsp.statpost, statpost);
+
+out:
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error (op_errno);
+
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t) xdr_gfs3_fallocate_rsp);
+
+ GF_FREE (rsp.xdata.xdata_val);
+
+ return 0;
+}
+
+int
+server_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_discard_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ state = CALL_STATE (frame);
+ gf_log (this->name, GF_LOG_INFO,
+ "%"PRId64": DISCARD %"PRId64" (%s) ==> (%s)",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa (state->resolve.gfid),
+ strerror (op_errno));
+ goto out;
+ }
+
+ gf_stat_from_iatt (&rsp.statpre, statpre);
+ gf_stat_from_iatt (&rsp.statpost, statpost);
+
+out:
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error (op_errno);
+
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t) xdr_gfs3_discard_rsp);
+
+ GF_FREE (rsp.xdata.xdata_val);
+
+ return 0;
+}
+
+int
+server_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *statpre, struct iatt *statpost, dict_t *xdata)
+{
+ gfs3_zerofill_rsp rsp = {0,};
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+
+ req = frame->local;
+ state = CALL_STATE (frame);
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val),
+ rsp.xdata.xdata_len, op_errno, out);
+
+ if (op_ret) {
+ gf_log (this->name, GF_LOG_INFO,
+ "%"PRId64": ZEROFILL%"PRId64" (%s) ==> (%s)",
+ frame->root->unique, state->resolve.fd_no,
+ uuid_utoa (state->resolve.gfid),
+ strerror (op_errno));
+ goto out;
+ }
+
+ gf_stat_from_iatt (&rsp.statpre, statpre);
+ gf_stat_from_iatt (&rsp.statpost, statpost);
+
+out:
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error (op_errno);
+
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t) xdr_gfs3_zerofill_rsp);
+
+ GF_FREE (rsp.xdata.xdata_val);
+
+ return 0;
+}
+
+
/* Resume function section */
int
@@ -2115,6 +2201,7 @@ err:
int
server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
{
+ GF_UNUSED int ret = -1;
server_state_t *state = NULL;
state = CALL_STATE (frame);
@@ -2122,6 +2209,13 @@ server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
if (state->resolve.op_ret != 0)
goto err;
+ if (!state->xdata)
+ state->xdata = dict_new ();
+
+ if (state->xdata)
+ ret = dict_set_str (state->xdata, "connection-id",
+ frame->root->client->client_uid);
+
STACK_WIND (frame, server_fentrylk_cbk, bound_xl,
bound_xl->fops->fentrylk,
state->volume, state->fd, state->name,
@@ -2138,6 +2232,7 @@ err:
int
server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
{
+ GF_UNUSED int ret = -1;
server_state_t *state = NULL;
state = CALL_STATE (frame);
@@ -2145,6 +2240,13 @@ server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl)
if (state->resolve.op_ret != 0)
goto err;
+ if (!state->xdata)
+ state->xdata = dict_new ();
+
+ if (state->xdata)
+ ret = dict_set_str (state->xdata, "connection-id",
+ frame->root->client->client_uid);
+
STACK_WIND (frame, server_entrylk_cbk,
bound_xl, bound_xl->fops->entrylk,
state->volume, &state->loc, state->name,
@@ -2160,13 +2262,24 @@ err:
int
server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
{
+ GF_UNUSED int ret = -1;
server_state_t *state = NULL;
+ gf_log (bound_xl->name, GF_LOG_WARNING, "frame %p, xlator %p",
+ frame, bound_xl);
+
state = CALL_STATE (frame);
if (state->resolve.op_ret != 0)
goto err;
+ if (!state->xdata)
+ state->xdata = dict_new ();
+
+ if (state->xdata)
+ ret = dict_set_str (state->xdata, "connection-id",
+ frame->root->client->client_uid);
+
STACK_WIND (frame, server_finodelk_cbk, bound_xl,
bound_xl->fops->finodelk, state->volume, state->fd,
state->cmd, &state->flock, state->xdata);
@@ -2182,13 +2295,24 @@ err:
int
server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
{
+ GF_UNUSED int ret = -1;
server_state_t *state = NULL;
+ gf_log (bound_xl->name, GF_LOG_WARNING, "frame %p, xlator %p",
+ frame, bound_xl);
+
state = CALL_STATE (frame);
if (state->resolve.op_ret != 0)
goto err;
+ if (!state->xdata)
+ state->xdata = dict_new ();
+
+ if (state->xdata)
+ ret = dict_set_str (state->xdata, "connection-id",
+ frame->root->client->client_uid);
+
STACK_WIND (frame, server_inodelk_cbk, bound_xl,
bound_xl->fops->inodelk, state->volume, &state->loc,
state->cmd, &state->flock, state->xdata);
@@ -2897,6 +3021,69 @@ err:
return 0;
}
+int
+server_fallocate_resume (call_frame_t *frame, xlator_t *bound_xl)
+{
+ server_state_t *state = NULL;
+
+ state = CALL_STATE (frame);
+
+ if (state->resolve.op_ret != 0)
+ goto err;
+
+ STACK_WIND (frame, server_fallocate_cbk,
+ bound_xl, bound_xl->fops->fallocate,
+ state->fd, state->flags, state->offset, state->size,
+ state->xdata);
+ return 0;
+err:
+ server_fallocate_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+
+ return 0;
+}
+
+int
+server_discard_resume (call_frame_t *frame, xlator_t *bound_xl)
+{
+ server_state_t *state = NULL;
+
+ state = CALL_STATE (frame);
+
+ if (state->resolve.op_ret != 0)
+ goto err;
+
+ STACK_WIND (frame, server_discard_cbk,
+ bound_xl, bound_xl->fops->discard,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
+err:
+ server_discard_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+
+ return 0;
+}
+
+int
+server_zerofill_resume (call_frame_t *frame, xlator_t *bound_xl)
+{
+ server_state_t *state = NULL;
+
+ state = CALL_STATE (frame);
+
+ if (state->resolve.op_ret != 0)
+ goto err;
+
+ STACK_WIND (frame, server_zerofill_cbk,
+ bound_xl, bound_xl->fops->zerofill,
+ state->fd, state->offset, state->size, state->xdata);
+ return 0;
+err:
+ server_zerofill_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL);
+
+ return 0;
+}
@@ -2916,33 +3103,34 @@ server3_3_stat (rpcsvc_request_t *req)
/* Initialize args first, then decode */
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_stat_req)) {
+ ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_stat_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
- // something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_STAT;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
state->resolve.type = RESOLVE_MUST;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
@@ -2953,7 +3141,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -2971,24 +3159,26 @@ server3_3_setattr (rpcsvc_request_t *req)
if (!req)
return 0;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_setattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_setattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_SETATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -2998,9 +3188,10 @@ server3_3_setattr (rpcsvc_request_t *req)
gf_stat_to_iatt (&args.stbuf, &state->stbuf);
state->valid = args.valid;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3008,7 +3199,7 @@ server3_3_setattr (rpcsvc_request_t *req)
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
free (args.xdata.xdata_val);
@@ -3028,24 +3219,25 @@ server3_3_fsetattr (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fsetattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fsetattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
- // something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FSETATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3055,13 +3247,196 @@ server3_3_fsetattr (rpcsvc_request_t *req)
gf_stat_to_iatt (&args.stbuf, &state->stbuf);
state->valid = args.valid;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
+ op_errno, out);
+
+ ret = 0;
+ resolve_and_resume (frame, server_fsetattr_resume);
+
+out:
+ free (args.xdata.xdata_val);
+
+ if (op_errno)
+ SERVER_REQ_SET_ERROR (req, ret);
+
+ return ret;
+}
+
+int
+server3_3_fallocate(rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fallocate_req args = {{0},};
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
+
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fallocate_req);
+ if (ret < 0) {
+ //failed to decode msg;
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+
+ frame = get_frame_from_request (req);
+ if (!frame) {
+ // something wrong, mostly insufficient memory
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+ frame->root->op = GF_FOP_FALLOCATE;
+
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
+ /* auth failure, request on subvolume without setvolume */
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+
+ state->flags = args.flags;
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
+ op_errno, out);
+
+ ret = 0;
+ resolve_and_resume (frame, server_fallocate_resume);
+
+out:
+ free (args.xdata.xdata_val);
+
+ if (op_errno)
+ SERVER_REQ_SET_ERROR (req, ret);
+
+ return ret;
+}
+
+
+int
+server3_3_discard(rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_discard_req args = {{0},};
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
+
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_discard_req);
+ if (ret < 0) {
+ //failed to decode msg;
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+
+ frame = get_frame_from_request (req);
+ if (!frame) {
+ // something wrong, mostly insufficient memory
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+ frame->root->op = GF_FOP_DISCARD;
+
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
+ /* auth failure, request on subvolume without setvolume */
+ SERVER_REQ_SET_ERROR (req, ret);
+ goto out;
+ }
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
+ op_errno, out);
+
+ ret = 0;
+ resolve_and_resume (frame, server_discard_resume);
+
+out:
+ free (args.xdata.xdata_val);
+
+ if (op_errno)
+ SERVER_REQ_SET_ERROR (req, ret);
+
+ return ret;
+}
+
+
+int
+server3_3_zerofill(rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_zerofill_req args = {{0},};
+ int ret = -1;
+ int op_errno = 0;
+
+ if (!req)
+ return ret;
+
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_zerofill_req);
+ if (ret < 0) {
+ /*failed to decode msg*/;
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ frame = get_frame_from_request (req);
+ if (!frame) {
+ /* something wrong, mostly insufficient memory*/
+ req->rpc_err = GARBAGE_ARGS; /* TODO */
+ goto out;
+ }
+ frame->root->op = GF_FOP_ZEROFILL;
+
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
+ /* auth failure, request on subvolume without setvolume */
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+
+ state->offset = args.offset;
+ state->size = args.size;
+ memcpy(state->resolve.gfid, args.gfid, 16);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl, state->xdata,
(args.xdata.xdata_val),
(args.xdata.xdata_len), ret,
op_errno, out);
ret = 0;
- resolve_and_resume (frame, server_fsetattr_resume);
+ resolve_and_resume (frame, server_zerofill_resume);
out:
free (args.xdata.xdata_val);
@@ -3072,7 +3447,6 @@ out:
return ret;
}
-
int
server3_3_readlink (rpcsvc_request_t *req)
{
@@ -3085,24 +3459,26 @@ server3_3_readlink (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_readlink_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_readlink_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_READLINK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3111,9 +3487,10 @@ server3_3_readlink (rpcsvc_request_t *req)
state->size = args.size;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3123,7 +3500,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3143,24 +3520,26 @@ server3_3_create (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_create_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_create_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_CREATE;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3178,9 +3557,10 @@ server3_3_create (rpcsvc_request_t *req)
}
/* TODO: can do alloca for xdata field instead of stdalloc */
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3191,7 +3571,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3209,24 +3589,25 @@ server3_3_open (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_open_req)) {
+ ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_open_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_OPEN;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3235,16 +3616,17 @@ server3_3_open (rpcsvc_request_t *req)
state->flags = gf_flags_to_flags (args.flags);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
resolve_and_resume (frame, server_open_resume);
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
free (args.xdata.xdata_val);
@@ -3264,24 +3646,25 @@ server3_3_readv (rpcsvc_request_t *req)
if (!req)
goto out;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_read_req)) {
+ ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_read_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_READ;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3293,9 +3676,10 @@ server3_3_readv (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3305,7 +3689,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3325,25 +3709,26 @@ server3_3_writev (rpcsvc_request_t *req)
if (!req)
return ret;
- len = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_write_req);
- if (len == 0) {
+ len = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_write_req);
+ if (len < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_WRITE;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3371,9 +3756,10 @@ server3_3_writev (rpcsvc_request_t *req)
state->size += state->payload_vector[i].iov_len;
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
#ifdef GF_TESTING_IO_XDATA
@@ -3386,7 +3772,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3452,24 +3838,36 @@ server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
int
server3_3_release (rpcsvc_request_t *req)
{
- server_connection_t *conn = NULL;
- gfs3_release_req args = {{0,},};
- gf_common_rsp rsp = {0,};
- int ret = -1;
-
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_release_req)) {
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfs3_release_req args = {{0,},};
+ gf_common_rsp rsp = {0,};
+ int ret = -1;
+
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_release_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
- conn = req->trans->xl_private;
- if (!conn) {
+ client = req->trans->xl_private;
+ if (!client) {
/* Handshake is not complete yet. */
req->rpc_err = SYSTEM_ERR;
goto out;
}
- gf_fd_put (conn->fdtable, args.fd);
+
+ serv_ctx = server_ctx_get (client, client->this);
+ if (serv_ctx == NULL) {
+ gf_log (req->trans->name, GF_LOG_INFO,
+ "server_ctx_get() failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put (serv_ctx->fdtable, args.fd);
server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -3482,24 +3880,35 @@ out:
int
server3_3_releasedir (rpcsvc_request_t *req)
{
- server_connection_t *conn = NULL;
- gfs3_releasedir_req args = {{0,},};
- gf_common_rsp rsp = {0,};
- int ret = -1;
+ client_t *client = NULL;
+ server_ctx_t *serv_ctx = NULL;
+ gfs3_releasedir_req args = {{0,},};
+ gf_common_rsp rsp = {0,};
+ int ret = -1;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_release_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_release_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
- conn = req->trans->xl_private;
- if (!conn) {
- req->rpc_err = GARBAGE_ARGS;
+ client = req->trans->xl_private;
+ if (!client) {
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
- gf_fd_put (conn->fdtable, args.fd);
+ serv_ctx = server_ctx_get (client, client->this);
+ if (serv_ctx == NULL) {
+ gf_log (req->trans->name, GF_LOG_INFO,
+ "server_ctx_get() failed");
+ req->rpc_err = SYSTEM_ERR;
+ goto out;
+ }
+
+ gf_fd_put (serv_ctx->fdtable, args.fd);
server_submit_reply (NULL, req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_common_rsp);
@@ -3522,24 +3931,26 @@ server3_3_fsync (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fsync_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fsync_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FSYNC;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3548,9 +3959,10 @@ server3_3_fsync (rpcsvc_request_t *req)
state->flags = args.data;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3559,7 +3971,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3578,24 +3990,26 @@ server3_3_flush (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_flush_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_flush_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FLUSH;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3603,9 +4017,10 @@ server3_3_flush (rpcsvc_request_t *req)
state->resolve.fd_no = args.fd;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3614,7 +4029,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3633,24 +4048,26 @@ server3_3_ftruncate (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_ftruncate_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_ftruncate_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FTRUNCATE;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3659,9 +4076,10 @@ server3_3_ftruncate (rpcsvc_request_t *req)
state->offset = args.offset;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3670,7 +4088,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3688,24 +4106,26 @@ server3_3_fstat (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fstat_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fstat_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FSTAT;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3713,9 +4133,10 @@ server3_3_fstat (rpcsvc_request_t *req)
state->resolve.fd_no = args.fd;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3724,7 +4145,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3742,24 +4163,26 @@ server3_3_truncate (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_truncate_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_truncate_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_TRUNCATE;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3767,9 +4190,10 @@ server3_3_truncate (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
state->offset = args.offset;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3778,7 +4202,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3799,24 +4223,26 @@ server3_3_unlink (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_unlink_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_unlink_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_UNLINK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3826,9 +4252,10 @@ server3_3_unlink (rpcsvc_request_t *req)
state->flags = args.xflags;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3837,7 +4264,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -3858,24 +4285,26 @@ server3_3_setxattr (rpcsvc_request_t *req)
args.dict.dict_val = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_setxattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_setxattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_SETXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3883,7 +4312,8 @@ server3_3_setxattr (rpcsvc_request_t *req)
state->flags = args.flags;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, dict,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ dict,
(args.dict.dict_val),
(args.dict.dict_len), ret,
op_errno, out);
@@ -3893,9 +4323,10 @@ server3_3_setxattr (rpcsvc_request_t *req)
/* There can be some commands hidden in key, check and proceed */
gf_server_check_setxattr_cmd (frame, dict);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3906,7 +4337,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
if (dict)
dict_unref (dict);
@@ -3930,24 +4361,26 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
return ret;
args.dict.dict_val = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fsetxattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fsetxattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FSETXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -3956,16 +4389,18 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
state->flags = args.flags;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, dict,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ dict,
(args.dict.dict_val),
(args.dict.dict_len), ret,
op_errno, out);
state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -3976,7 +4411,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
if (dict)
dict_unref (dict);
@@ -4000,24 +4435,26 @@ server3_3_fxattrop (rpcsvc_request_t *req)
return ret;
args.dict.dict_val = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fxattrop_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fxattrop_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FXATTROP;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4026,16 +4463,18 @@ server3_3_fxattrop (rpcsvc_request_t *req)
state->flags = args.flags;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, dict,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ dict,
(args.dict.dict_val),
(args.dict.dict_len), ret,
op_errno, out);
state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4047,7 +4486,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
if (dict)
dict_unref (dict);
@@ -4072,24 +4511,26 @@ server3_3_xattrop (rpcsvc_request_t *req)
args.dict.dict_val = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_xattrop_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_xattrop_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_XATTROP;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4097,16 +4538,18 @@ server3_3_xattrop (rpcsvc_request_t *req)
state->flags = args.flags;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, dict,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ dict,
(args.dict.dict_val),
(args.dict.dict_len), ret,
op_errno, out);
state->dict = dict;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4117,7 +4560,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
if (dict)
dict_unref (dict);
@@ -4140,24 +4583,26 @@ server3_3_getxattr (rpcsvc_request_t *req)
args.name = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_getxattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_getxattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_GETXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4170,9 +4615,10 @@ server3_3_getxattr (rpcsvc_request_t *req)
gf_server_check_getxattr_cmd (frame, state->name);
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4181,7 +4627,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4200,24 +4646,26 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
return ret;
args.name = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fgetxattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fgetxattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FGETXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4228,9 +4676,10 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
if (args.namelen)
state->name = gf_strdup (args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4239,7 +4688,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4260,24 +4709,26 @@ server3_3_removexattr (rpcsvc_request_t *req)
args.name = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_removexattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_removexattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_REMOVEXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4285,9 +4736,10 @@ server3_3_removexattr (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
state->name = gf_strdup (args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4296,7 +4748,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4315,25 +4767,26 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
args.name = alloca (4096);
- if (!xdr_to_generic (req->msg[0], &args,
- (xdrproc_t)xdr_gfs3_fremovexattr_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fremovexattr_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FREMOVEXATTR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4342,9 +4795,10 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
state->name = gf_strdup (args.name);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4353,7 +4807,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4373,33 +4827,36 @@ server3_3_opendir (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_opendir_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_opendir_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_OPENDIR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
state->resolve.type = RESOLVE_MUST;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4408,7 +4865,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4427,24 +4884,26 @@ server3_3_readdirp (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_readdirp_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_readdirp_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_READDIRP;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4465,7 +4924,8 @@ server3_3_readdirp (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
/* here, dict itself works as xdata */
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->dict,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->dict,
(args.dict.dict_val),
(args.dict.dict_len), ret,
op_errno, out);
@@ -4475,7 +4935,7 @@ server3_3_readdirp (rpcsvc_request_t *req)
resolve_and_resume (frame, server_readdirp_resume);
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
free (args.dict.dict_val);
@@ -4495,24 +4955,26 @@ server3_3_readdir (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_readdir_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_readdir_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_READDIR;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4532,9 +4994,10 @@ server3_3_readdir (rpcsvc_request_t *req)
state->offset = args.offset;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4543,7 +5006,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4560,24 +5023,26 @@ server3_3_fsyncdir (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fsyncdir_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fsyncdir_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FSYNCDIR;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4586,9 +5051,10 @@ server3_3_fsyncdir (rpcsvc_request_t *req)
state->flags = args.data;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4597,7 +5063,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4618,24 +5084,26 @@ server3_3_mknod (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_mknod_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_mknod_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_MKNOD;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4647,9 +5115,10 @@ server3_3_mknod (rpcsvc_request_t *req)
state->dev = args.dev;
state->umask = args.umask;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4657,7 +5126,7 @@ server3_3_mknod (rpcsvc_request_t *req)
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
@@ -4681,24 +5150,26 @@ server3_3_mkdir (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_mkdir_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_mkdir_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_MKDIR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4710,9 +5181,10 @@ server3_3_mkdir (rpcsvc_request_t *req)
state->umask = args.umask;
/* TODO: can do alloca for xdata field instead of stdalloc */
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4720,7 +5192,7 @@ server3_3_mkdir (rpcsvc_request_t *req)
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
free (args.xdata.xdata_val);
@@ -4742,24 +5214,26 @@ server3_3_rmdir (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_rmdir_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_rmdir_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_RMDIR;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4769,9 +5243,10 @@ server3_3_rmdir (rpcsvc_request_t *req)
state->flags = args.xflags;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4780,7 +5255,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4802,24 +5277,26 @@ server3_3_inodelk (rpcsvc_request_t *req)
args.volume = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_inodelk_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_inodelk_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_INODELK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4856,9 +5333,10 @@ server3_3_inodelk (rpcsvc_request_t *req)
break;
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4869,7 +5347,7 @@ out:
free (args.flock.lk_owner.lk_owner_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4887,24 +5365,26 @@ server3_3_finodelk (rpcsvc_request_t *req)
return ret;
args.volume = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_finodelk_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_finodelk_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FINODELK;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -4942,9 +5422,10 @@ server3_3_finodelk (rpcsvc_request_t *req)
break;
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -4955,7 +5436,7 @@ out:
free (args.flock.lk_owner.lk_owner_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -4976,24 +5457,26 @@ server3_3_entrylk (rpcsvc_request_t *req)
args.volume = alloca (256);
args.name = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_entrylk_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_entrylk_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_ENTRYLK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5007,9 +5490,10 @@ server3_3_entrylk (rpcsvc_request_t *req)
state->cmd = args.cmd;
state->type = args.type;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5018,7 +5502,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5038,24 +5522,26 @@ server3_3_fentrylk (rpcsvc_request_t *req)
args.name = alloca (256);
args.volume = alloca (256);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_fentrylk_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fentrylk_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_FENTRYLK;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5069,9 +5555,10 @@ server3_3_fentrylk (rpcsvc_request_t *req)
state->name = gf_strdup (args.name);
state->volume = gf_strdup (args.volume);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5080,7 +5567,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5097,24 +5584,26 @@ server3_3_access (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_access_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_access_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_ACCESS;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5122,9 +5611,10 @@ server3_3_access (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
state->mask = args.mask;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5133,7 +5623,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5155,24 +5645,26 @@ server3_3_symlink (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
args.linkname = alloca (4096);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_symlink_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_symlink_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_SYMLINK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5182,9 +5674,10 @@ server3_3_symlink (rpcsvc_request_t *req)
state->name = gf_strdup (args.linkname);
state->umask = args.umask;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5192,7 +5685,7 @@ server3_3_symlink (rpcsvc_request_t *req)
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
@@ -5216,24 +5709,25 @@ server3_3_link (rpcsvc_request_t *req)
args.newbname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_link_req)) {
+ ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_link_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_LINK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5244,9 +5738,10 @@ server3_3_link (rpcsvc_request_t *req)
state->resolve2.bname = gf_strdup (args.newbname);
memcpy (state->resolve2.pargfid, args.newgfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5255,7 +5750,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5276,24 +5771,26 @@ server3_3_rename (rpcsvc_request_t *req)
args.oldbname = alloca (req->msg[0].iov_len);
args.newbname = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_rename_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_rename_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_RENAME;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5305,9 +5802,10 @@ server3_3_rename (rpcsvc_request_t *req)
state->resolve2.bname = gf_strdup (args.newbname);
memcpy (state->resolve2.pargfid, args.newgfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5316,7 +5814,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5333,24 +5831,25 @@ server3_3_lk (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lk_req)) {
+ ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lk_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_LK;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5398,7 +5897,7 @@ server3_3_lk (rpcsvc_request_t *req)
state->flock.l_type = F_UNLCK;
break;
default:
- gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ gf_log (frame->root->client->bound_xl->name, GF_LOG_ERROR,
"fd - %"PRId64" (%s): Unknown lock type: %"PRId32"!",
state->resolve.fd_no,
uuid_utoa (state->fd->inode->gfid), state->type);
@@ -5406,9 +5905,10 @@ server3_3_lk (rpcsvc_request_t *req)
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5419,7 +5919,7 @@ out:
free (args.flock.lk_owner.lk_owner_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5437,24 +5937,26 @@ server3_3_rchecksum (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_rchecksum_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_rchecksum_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_RCHECKSUM;
- state = CALL_STATE(frame);
- if (!state->conn->bound_xl) {
+ state = CALL_STATE (frame);
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5463,9 +5965,10 @@ server3_3_rchecksum (rpcsvc_request_t *req)
state->offset = args.offset;
state->size = args.len;
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5474,7 +5977,7 @@ out:
free (args.xdata.xdata_val);
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
@@ -5507,16 +6010,18 @@ server3_3_lookup (rpcsvc_request_t *req)
args.bname = alloca (req->msg[0].iov_len);
args.xdata.xdata_val = alloca (req->msg[0].iov_len);
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lookup_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_lookup_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto err;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto err;
}
frame->root->op = GF_FOP_LOOKUP;
@@ -5526,9 +6031,9 @@ server3_3_lookup (rpcsvc_request_t *req)
*/
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
@@ -5541,9 +6046,10 @@ server3_3_lookup (rpcsvc_request_t *req)
memcpy (state->resolve.gfid, args.gfid, 16);
}
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
@@ -5571,90 +6077,96 @@ server3_3_statfs (rpcsvc_request_t *req)
if (!req)
return ret;
- if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_statfs_req)) {
+ ret = xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_statfs_req);
+ if (ret < 0) {
//failed to decode msg;
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame = get_frame_from_request (req);
if (!frame) {
// something wrong, mostly insufficient memory
- req->rpc_err = GARBAGE_ARGS; /* TODO */
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
frame->root->op = GF_FOP_STATFS;
state = CALL_STATE (frame);
- if (!state->conn->bound_xl) {
+ if (!frame->root->client->bound_xl) {
/* auth failure, request on subvolume without setvolume */
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
state->resolve.type = RESOLVE_MUST;
memcpy (state->resolve.gfid, args.gfid, 16);
- GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata,
- (args.xdata.xdata_val),
- (args.xdata.xdata_len), ret,
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ state->xdata,
+ args.xdata.xdata_val,
+ args.xdata.xdata_len, ret,
op_errno, out);
ret = 0;
resolve_and_resume (frame, server_statfs_resume);
out:
if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
+ SERVER_REQ_SET_ERROR (req, ret);
return ret;
}
rpcsvc_actor_t glusterfs3_3_fop_actors[] = {
- [GFS3_OP_NULL] = { "NULL", GFS3_OP_NULL, server_null, NULL, 0},
- [GFS3_OP_STAT] = { "STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0},
- [GFS3_OP_READLINK] = { "READLINK", GFS3_OP_READLINK, server3_3_readlink, NULL, 0},
- [GFS3_OP_MKNOD] = { "MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0},
- [GFS3_OP_MKDIR] = { "MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0},
- [GFS3_OP_UNLINK] = { "UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0},
- [GFS3_OP_RMDIR] = { "RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0},
- [GFS3_OP_SYMLINK] = { "SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0},
- [GFS3_OP_RENAME] = { "RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0},
- [GFS3_OP_LINK] = { "LINK", GFS3_OP_LINK, server3_3_link, NULL, 0},
- [GFS3_OP_TRUNCATE] = { "TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate, NULL, 0},
- [GFS3_OP_OPEN] = { "OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0},
- [GFS3_OP_READ] = { "READ", GFS3_OP_READ, server3_3_readv, NULL, 0},
- [GFS3_OP_WRITE] = { "WRITE", GFS3_OP_WRITE, server3_3_writev, server3_3_writev_vecsizer, 0},
- [GFS3_OP_STATFS] = { "STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0},
- [GFS3_OP_FLUSH] = { "FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0},
- [GFS3_OP_FSYNC] = { "FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0},
- [GFS3_OP_SETXATTR] = { "SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr, NULL, 0},
- [GFS3_OP_GETXATTR] = { "GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr, NULL, 0},
- [GFS3_OP_REMOVEXATTR] = { "REMOVEXATTR", GFS3_OP_REMOVEXATTR, server3_3_removexattr, NULL, 0},
- [GFS3_OP_OPENDIR] = { "OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0},
- [GFS3_OP_FSYNCDIR] = { "FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir, NULL, 0},
- [GFS3_OP_ACCESS] = { "ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0},
- [GFS3_OP_CREATE] = { "CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0},
- [GFS3_OP_FTRUNCATE] = { "FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate, NULL, 0},
- [GFS3_OP_FSTAT] = { "FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0},
- [GFS3_OP_LK] = { "LK", GFS3_OP_LK, server3_3_lk, NULL, 0},
- [GFS3_OP_LOOKUP] = { "LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0},
- [GFS3_OP_READDIR] = { "READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0},
- [GFS3_OP_INODELK] = { "INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0},
- [GFS3_OP_FINODELK] = { "FINODELK", GFS3_OP_FINODELK, server3_3_finodelk, NULL, 0},
- [GFS3_OP_ENTRYLK] = { "ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0},
- [GFS3_OP_FENTRYLK] = { "FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk, NULL, 0},
- [GFS3_OP_XATTROP] = { "XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0},
- [GFS3_OP_FXATTROP] = { "FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop, NULL, 0},
- [GFS3_OP_FGETXATTR] = { "FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr, NULL, 0},
- [GFS3_OP_FSETXATTR] = { "FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr, NULL, 0},
- [GFS3_OP_RCHECKSUM] = { "RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum, NULL, 0},
- [GFS3_OP_SETATTR] = { "SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0},
- [GFS3_OP_FSETATTR] = { "FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr, NULL, 0},
- [GFS3_OP_READDIRP] = { "READDIRP", GFS3_OP_READDIRP, server3_3_readdirp, NULL, 0},
- [GFS3_OP_RELEASE] = { "RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0},
- [GFS3_OP_RELEASEDIR] = { "RELEASEDIR", GFS3_OP_RELEASEDIR, server3_3_releasedir, NULL, 0},
- [GFS3_OP_FREMOVEXATTR] = { "FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server3_3_fremovexattr, NULL, 0},
+ [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0, DRC_NA},
+ [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0, DRC_NA},
+ [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server3_3_readlink, NULL, 0, DRC_NA},
+ [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0, DRC_NA},
+ [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0, DRC_NA},
+ [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0, DRC_NA},
+ [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0, DRC_NA},
+ [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0, DRC_NA},
+ [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0, DRC_NA},
+ [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server3_3_link, NULL, 0, DRC_NA},
+ [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate, NULL, 0, DRC_NA},
+ [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0, DRC_NA},
+ [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server3_3_readv, NULL, 0, DRC_NA},
+ [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server3_3_writev, server3_3_writev_vecsizer, 0, DRC_NA},
+ [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0, DRC_NA},
+ [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0, DRC_NA},
+ [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0, DRC_NA},
+ [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr, NULL, 0, DRC_NA},
+ [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr, NULL, 0, DRC_NA},
+ [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR, server3_3_removexattr, NULL, 0, DRC_NA},
+ [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0, DRC_NA},
+ [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir, NULL, 0, DRC_NA},
+ [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0, DRC_NA},
+ [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0, DRC_NA},
+ [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate, NULL, 0, DRC_NA},
+ [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0, DRC_NA},
+ [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server3_3_lk, NULL, 0, DRC_NA},
+ [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0, DRC_NA},
+ [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0, DRC_NA},
+ [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0, DRC_NA},
+ [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server3_3_finodelk, NULL, 0, DRC_NA},
+ [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0, DRC_NA},
+ [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk, NULL, 0, DRC_NA},
+ [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0, DRC_NA},
+ [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop, NULL, 0, DRC_NA},
+ [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr, NULL, 0, DRC_NA},
+ [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr, NULL, 0, DRC_NA},
+ [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum, NULL, 0, DRC_NA},
+ [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0, DRC_NA},
+ [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr, NULL, 0, DRC_NA},
+ [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server3_3_readdirp, NULL, 0, DRC_NA},
+ [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0, DRC_NA},
+ [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR, server3_3_releasedir, NULL, 0, DRC_NA},
+ [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server3_3_fremovexattr, NULL, 0, DRC_NA},
+ [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server3_3_fallocate, NULL, 0, DRC_NA},
+ [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server3_3_discard, NULL, 0, DRC_NA},
+ [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server3_3_zerofill, NULL, 0, DRC_NA},
};