summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/auth/addr/src/addr.c18
-rw-r--r--xlators/protocol/client/src/client-callback.c91
-rw-r--r--xlators/protocol/client/src/client-common.c66
-rw-r--r--xlators/protocol/client/src/client-common.h10
-rw-r--r--xlators/protocol/client/src/client-handshake.c762
-rw-r--r--xlators/protocol/client/src/client-helpers.c2355
-rw-r--r--xlators/protocol/client/src/client-lk.c47
-rw-r--r--xlators/protocol/client/src/client-mem-types.h3
-rw-r--r--xlators/protocol/client/src/client-messages.h125
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c1137
-rw-r--r--xlators/protocol/client/src/client-rpc-fops_v2.c1276
-rw-r--r--xlators/protocol/client/src/client.c1358
-rw-r--r--xlators/protocol/client/src/client.h222
-rw-r--r--xlators/protocol/server/src/Makefile.am4
-rw-r--r--xlators/protocol/server/src/authenticate.h8
-rw-r--r--xlators/protocol/server/src/server-common.c53
-rw-r--r--xlators/protocol/server/src/server-common.h11
-rw-r--r--xlators/protocol/server/src/server-handshake.c159
-rw-r--r--xlators/protocol/server/src/server-helpers.c4706
-rw-r--r--xlators/protocol/server/src/server-helpers.h39
-rw-r--r--xlators/protocol/server/src/server-mem-types.h8
-rw-r--r--xlators/protocol/server/src/server-messages.h181
-rw-r--r--xlators/protocol/server/src/server-resolve.c40
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c401
-rw-r--r--xlators/protocol/server/src/server-rpc-fops_v2.c1647
-rw-r--r--xlators/protocol/server/src/server.c523
-rw-r--r--xlators/protocol/server/src/server.h97
27 files changed, 4022 insertions, 11325 deletions
diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c
index f64259e3c11..bf12c455d7c 100644
--- a/xlators/protocol/auth/addr/src/addr.c
+++ b/xlators/protocol/auth/addr/src/addr.c
@@ -12,7 +12,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include "authenticate.h"
-#include "dict.h"
+#include <glusterfs/dict.h>
#include "rpc-transport.h"
#define ENTRY_DELIMITER ","
@@ -65,10 +65,18 @@ compare_addr_and_update(char *option_str, char *peer_addr, char *subvol,
goto out;
}
} else {
- match = fnmatch(addr_str, peer_addr, 0);
- if (negate ? match : !match) {
- *result = status;
- goto out;
+ if (strstr(addr_str, "/")) {
+ match = gf_is_ip_in_net(addr_str, peer_addr);
+ if (negate ? !match : match) {
+ *result = status;
+ goto out;
+ }
+ } else {
+ match = fnmatch(addr_str, peer_addr, 0);
+ if (negate ? match : !match) {
+ *result = status;
+ goto out;
+ }
}
}
diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c
index 352a1130e14..d83d9c14899 100644
--- a/xlators/protocol/client/src/client-callback.c
+++ b/xlators/protocol/client/src/client-callback.c
@@ -10,34 +10,31 @@
#include "client.h"
#include "rpc-clnt.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "client-messages.h"
-int
+static int
client_cbk_null(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, NULL);
return 0;
}
-int
+static int
client_cbk_fetchspec(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, NULL);
return 0;
}
-int
+static int
client_cbk_ino_flush(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, NULL);
return 0;
}
-int
+static int
client_cbk_recall_lease(struct rpc_clnt *rpc, void *mydata, void *data)
{
int ret = -1;
@@ -54,8 +51,6 @@ client_cbk_recall_lease(struct rpc_clnt *rpc, void *mydata, void *data)
},
};
- GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
GF_VALIDATE_OR_GOTO("client-callback", data, out);
iov = (struct iovec *)data;
@@ -63,8 +58,8 @@ client_cbk_recall_lease(struct rpc_clnt *rpc, void *mydata, void *data)
(xdrproc_t)xdr_gfs3_recall_lease_req);
if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_RECALL_LEASE_FAIL,
- "XDR decode of recall lease failed.");
+ gf_smsg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_RECALL_LEASE_FAIL,
+ NULL);
goto out;
}
@@ -90,7 +85,7 @@ out:
return ret;
}
-int
+static int
client_cbk_cache_invalidation(struct rpc_clnt *rpc, void *mydata, void *data)
{
int ret = -1;
@@ -107,7 +102,7 @@ client_cbk_cache_invalidation(struct rpc_clnt *rpc, void *mydata, void *data)
gf_msg_trace(THIS->name, 0, "Upcall callback is called");
- if (!rpc || !mydata || !data)
+ if (!data)
goto out;
iov = (struct iovec *)data;
@@ -115,8 +110,8 @@ client_cbk_cache_invalidation(struct rpc_clnt *rpc, void *mydata, void *data)
(xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_CACHE_INVALIDATION_FAIL,
- "XDR decode of cache_invalidation failed.");
+ gf_smsg(THIS->name, GF_LOG_WARNING, -ret,
+ PC_MSG_CACHE_INVALIDATION_FAIL, NULL);
goto out;
}
@@ -145,15 +140,13 @@ out:
return 0;
}
-int
+static int
client_cbk_child_up(struct rpc_clnt *rpc, void *mydata, void *data)
{
clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, rpc, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -165,15 +158,13 @@ out:
return 0;
}
-int
+static int
client_cbk_child_down(struct rpc_clnt *rpc, void *mydata, void *data)
{
clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ xlator_t *this = THIS;
- this = THIS;
GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, rpc, out);
conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
@@ -185,7 +176,7 @@ out:
return 0;
}
-int
+static int
client_cbk_inodelk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
int ret = -1;
@@ -204,8 +195,6 @@ client_cbk_inodelk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
},
};
- GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
GF_VALIDATE_OR_GOTO("client-callback", data, out);
iov = (struct iovec *)data;
@@ -213,8 +202,8 @@ client_cbk_inodelk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
(xdrproc_t)xdr_gfs4_inodelk_contention_req);
if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_INODELK_CONTENTION_FAIL,
- "XDR decode of inodelk contention failed.");
+ gf_smsg(THIS->name, GF_LOG_WARNING, -ret,
+ PC_MSG_INODELK_CONTENTION_FAIL, NULL);
goto out;
}
@@ -240,7 +229,7 @@ out:
return ret;
}
-int
+static int
client_cbk_entrylk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
int ret = -1;
@@ -257,8 +246,6 @@ client_cbk_entrylk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
},
};
- GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
GF_VALIDATE_OR_GOTO("client-callback", data, out);
iov = (struct iovec *)data;
@@ -266,8 +253,8 @@ client_cbk_entrylk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
(xdrproc_t)xdr_gfs4_entrylk_contention_req);
if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_ENTRYLK_CONTENTION_FAIL,
- "XDR decode of entrylk contention failed.");
+ gf_smsg(THIS->name, GF_LOG_WARNING, -ret,
+ PC_MSG_ENTRYLK_CONTENTION_FAIL, NULL);
goto out;
}
@@ -296,24 +283,24 @@ out:
return ret;
}
-rpcclnt_cb_actor_t gluster_cbk_actors[GF_CBK_MAXVALUE] = {
- [GF_CBK_NULL] = {"NULL", GF_CBK_NULL, client_cbk_null},
- [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec},
- [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush},
+static rpcclnt_cb_actor_t gluster_cbk_actors[GF_CBK_MAXVALUE] = {
+ [GF_CBK_NULL] = {"NULL", client_cbk_null, GF_CBK_NULL},
+ [GF_CBK_FETCHSPEC] = {"FETCHSPEC", client_cbk_fetchspec, GF_CBK_FETCHSPEC},
+ [GF_CBK_INO_FLUSH] = {"INO_FLUSH", client_cbk_ino_flush, GF_CBK_INO_FLUSH},
[GF_CBK_CACHE_INVALIDATION] = {"CACHE_INVALIDATION",
- GF_CBK_CACHE_INVALIDATION,
- client_cbk_cache_invalidation},
- [GF_CBK_CHILD_UP] = {"CHILD_UP", GF_CBK_CHILD_UP, client_cbk_child_up},
- [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", GF_CBK_CHILD_DOWN,
- client_cbk_child_down},
- [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", GF_CBK_RECALL_LEASE,
- client_cbk_recall_lease},
+ client_cbk_cache_invalidation,
+ GF_CBK_CACHE_INVALIDATION},
+ [GF_CBK_CHILD_UP] = {"CHILD_UP", client_cbk_child_up, GF_CBK_CHILD_UP},
+ [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", client_cbk_child_down,
+ GF_CBK_CHILD_DOWN},
+ [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", client_cbk_recall_lease,
+ GF_CBK_RECALL_LEASE},
[GF_CBK_INODELK_CONTENTION] = {"INODELK_CONTENTION",
- GF_CBK_INODELK_CONTENTION,
- client_cbk_inodelk_contention},
+ client_cbk_inodelk_contention,
+ GF_CBK_INODELK_CONTENTION},
[GF_CBK_ENTRYLK_CONTENTION] = {"ENTRYLK_CONTENTION",
- GF_CBK_ENTRYLK_CONTENTION,
- client_cbk_entrylk_contention},
+ client_cbk_entrylk_contention,
+ GF_CBK_ENTRYLK_CONTENTION},
};
struct rpcclnt_cb_program gluster_cbk_prog = {
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c
index 31615516fcf..c112820e407 100644
--- a/xlators/protocol/client/src/client-common.c
+++ b/xlators/protocol/client/src/client-common.c
@@ -8,8 +8,8 @@
cases as published by the Free Software Foundation.
*/
-#include "dict.h"
-#include "xlator.h"
+#include <glusterfs/dict.h>
+#include <glusterfs/xlator.h>
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs4-xdr.h"
@@ -449,7 +449,8 @@ client_pre_fsync(xlator_t *this, gfs3_fsync_req *req, fd_t *fd, int32_t flags,
int64_t remote_fd = -1;
int op_errno = 0;
- CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
req->fd = remote_fd;
req->data = flags;
@@ -714,8 +715,8 @@ client_pre_lk(xlator_t *this, gfs3_lk_req *req, int32_t cmd,
ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
if (ret) {
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto out;
}
@@ -827,8 +828,8 @@ client_pre_inodelk(xlator_t *this, gfs3_inodelk_req *req, loc_t *loc, int cmd,
else if (cmd == F_SETLKW || cmd == F_SETLKW64)
gf_cmd = GF_LK_SETLKW;
else {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
op_errno = EINVAL;
goto out;
}
@@ -877,8 +878,8 @@ client_pre_finodelk(xlator_t *this, gfs3_finodelk_req *req, fd_t *fd, int cmd,
else if (cmd == F_SETLKW || cmd == F_SETLKW64)
gf_cmd = GF_LK_SETLKW;
else {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto out;
}
@@ -2556,6 +2557,38 @@ out:
}
int
+client_pre_copy_file_range_v2(xlator_t *this, gfx_copy_file_range_req *req,
+ fd_t *fd_in, off64_t off_in, fd_t *fd_out,
+ off64_t off_out, size_t size, int32_t flags,
+ dict_t **xdata)
+{
+ int64_t remote_fd_in = -1;
+ int64_t remote_fd_out = -1;
+ int op_errno = ESTALE;
+
+ CLIENT_GET_REMOTE_FD(this, fd_in, FALLBACK_TO_ANON_FD, remote_fd_in,
+ op_errno, out);
+
+ CLIENT_GET_REMOTE_FD(this, fd_out, FALLBACK_TO_ANON_FD, remote_fd_out,
+ op_errno, out);
+ req->size = size;
+ req->off_in = off_in;
+ req->off_out = off_out;
+ req->fd_in = remote_fd_in;
+ req->fd_out = remote_fd_out;
+ req->flag = flags;
+
+ memcpy(req->gfid1, fd_in->inode->gfid, 16);
+ memcpy(req->gfid2, fd_out->inode->gfid, 16);
+
+ dict_to_xdr(*xdata, &req->xdata);
+
+ return 0;
+out:
+ return -op_errno;
+}
+
+int
client_pre_statfs_v2(xlator_t *this, gfx_statfs_req *req, loc_t *loc,
dict_t *xdata)
{
@@ -2609,7 +2642,8 @@ client_pre_fsync_v2(xlator_t *this, gfx_fsync_req *req, fd_t *fd, int32_t flags,
int64_t remote_fd = -1;
int op_errno = 0;
- CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
req->fd = remote_fd;
req->data = flags;
@@ -2863,8 +2897,8 @@ client_pre_lk_v2(xlator_t *this, gfx_lk_req *req, int32_t cmd,
ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
if (ret) {
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto out;
}
@@ -2973,8 +3007,8 @@ client_pre_inodelk_v2(xlator_t *this, gfx_inodelk_req *req, loc_t *loc, int cmd,
else if (cmd == F_SETLKW || cmd == F_SETLKW64)
gf_cmd = GF_LK_SETLKW;
else {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
op_errno = EINVAL;
goto out;
}
@@ -3023,8 +3057,8 @@ client_pre_finodelk_v2(xlator_t *this, gfx_finodelk_req *req, fd_t *fd, int cmd,
else if (cmd == F_SETLKW || cmd == F_SETLKW64)
gf_cmd = GF_LK_SETLKW;
else {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto out;
}
diff --git a/xlators/protocol/client/src/client-common.h b/xlators/protocol/client/src/client-common.h
index 21d416d9f27..a2043d8742a 100644
--- a/xlators/protocol/client/src/client-common.h
+++ b/xlators/protocol/client/src/client-common.h
@@ -11,8 +11,8 @@
#ifndef __CLIENT_COMMON_H__
#define __CLIENT_COMMON_H__
-#include "dict.h"
-#include "xlator.h"
+#include <glusterfs/dict.h>
+#include <glusterfs/xlator.h>
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs4-xdr.h"
@@ -621,4 +621,10 @@ client_post_rename_v2(xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf,
struct iatt *prenewparent, struct iatt *postnewparent,
dict_t **xdata);
+int
+client_pre_copy_file_range_v2(xlator_t *this, gfx_copy_file_range_req *req,
+ fd_t *fd_in, off64_t off_in, fd_t *fd_out,
+ off64_t off_out, size_t size, int32_t flags,
+ dict_t **xdata);
+
#endif /* __CLIENT_COMMON_H__ */
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index ed9d0a5d9d8..ea5ef5c1800 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -8,13 +8,13 @@
cases as published by the Free Software Foundation.
*/
-#include "fd-lk.h"
+#include <glusterfs/fd-lk.h>
#include "client.h"
-#include "xlator.h"
-#include "defaults.h"
-#include "glusterfs.h"
-#include "statedump.h"
-#include "compat-errno.h"
+#include <glusterfs/xlator.h>
+#include <glusterfs/defaults.h>
+#include <glusterfs/glusterfs.h>
+#include <glusterfs/statedump.h>
+#include <glusterfs/compat-errno.h>
#include "glusterfs3.h"
#include "portmap-xdr.h"
@@ -27,14 +27,6 @@ extern rpc_clnt_prog_t clnt3_3_fop_prog;
extern rpc_clnt_prog_t clnt4_0_fop_prog;
extern rpc_clnt_prog_t clnt_pmap_prog;
-typedef struct client_fd_lk_local {
- gf_atomic_t ref;
- gf_boolean_t error;
- gf_lock_t lock;
- clnt_fd_ctx_t *fdctx;
-} clnt_fd_lk_local_t;
-
-
int32_t
client3_getspec(call_frame_t *frame, xlator_t *this, void *data)
{
@@ -42,7 +34,7 @@ client3_getspec(call_frame_t *frame, xlator_t *this, void *data)
return 0;
}
-int
+static int
client_notify_parents_child_up(xlator_t *this)
{
clnt_conf_t *conf = NULL;
@@ -55,219 +47,18 @@ client_notify_parents_child_up(xlator_t *this)
if (conf->child_up) {
ret = client_notify_dispatch_uniq(this, GF_EVENT_CHILD_UP, NULL);
if (ret) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_FAILED,
- "notify of CHILD_UP failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_FAILED,
+ NULL);
goto out;
}
} else {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS,
- "Defering sending CHILD_UP message as the client "
- "translators are not yet ready to serve.");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS, NULL);
}
out:
return 0;
}
-int
-clnt_fd_lk_reacquire_failed(xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
-{
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
- GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
-
- pthread_spin_lock(&conf->fd_lock);
- {
- fdctx->remote_fd = -1;
- }
- pthread_spin_unlock(&conf->fd_lock);
-
- ret = 0;
-out:
- return ret;
-}
-
-int
-client_fd_lk_count(fd_lk_ctx_t *lk_ctx)
-{
- int count = 0;
- fd_lk_ctx_node_t *fd_lk = NULL;
-
- GF_VALIDATE_OR_GOTO("client", lk_ctx, err);
-
- LOCK(&lk_ctx->lock);
- {
- list_for_each_entry(fd_lk, &lk_ctx->lk_list, next) count++;
- }
- UNLOCK(&lk_ctx->lock);
-
- return count;
-err:
- return -1;
-}
-
-clnt_fd_lk_local_t *
-clnt_fd_lk_local_ref(xlator_t *this, clnt_fd_lk_local_t *local)
-{
- GF_VALIDATE_OR_GOTO(this->name, local, out);
-
- GF_ATOMIC_INC(local->ref);
-out:
- return local;
-}
-
-int
-clnt_fd_lk_local_unref(xlator_t *this, clnt_fd_lk_local_t *local)
-{
- int ref = -1;
-
- GF_VALIDATE_OR_GOTO(this->name, local, out);
-
- ref = GF_ATOMIC_DEC(local->ref);
-
- if (ref == 0) {
- LOCK_DESTROY(&local->lock);
- GF_FREE(local);
- }
-out:
- return ref;
-}
-
-clnt_fd_lk_local_t *
-clnt_fd_lk_local_create(clnt_fd_ctx_t *fdctx)
-{
- clnt_fd_lk_local_t *local = NULL;
-
- local = GF_CALLOC(1, sizeof(clnt_fd_lk_local_t),
- gf_client_mt_clnt_fd_lk_local_t);
- if (!local)
- goto out;
-
- GF_ATOMIC_INIT(local->ref, 1);
- local->error = _gf_false;
- local->fdctx = fdctx;
-
- LOCK_INIT(&local->lock);
-out:
- return local;
-}
-
-int
-clnt_release_reopen_fd_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
-{
- xlator_t *this = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
-
- frame = myframe;
- this = frame->this;
- fdctx = (clnt_fd_ctx_t *)frame->local;
- conf = (clnt_conf_t *)this->private;
-
- clnt_fd_lk_reacquire_failed(this, fdctx, conf);
-
- fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
-
- frame->local = NULL;
- STACK_DESTROY(frame->root);
-
- return 0;
-}
-
-int
-clnt_release_reopen_fd(xlator_t *this, clnt_fd_ctx_t *fdctx)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- call_frame_t *frame = NULL;
- gfs3_release_req req = {
- {
- 0,
- },
- };
-
- conf = (clnt_conf_t *)this->private;
-
- frame = create_frame(this, this->ctx->pool);
- if (!frame)
- goto out;
-
- frame->local = (void *)fdctx;
- req.fd = fdctx->remote_fd;
-
- ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RELEASE,
- clnt_release_reopen_fd_cbk, NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfs3_releasedir_req);
-out:
- if (ret) {
- clnt_fd_lk_reacquire_failed(this, fdctx, conf);
- fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
- }
- return 0;
-}
-
-int
-clnt_reacquire_lock_error(xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
-{
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
-
- clnt_release_reopen_fd(this, fdctx);
-
- ret = 0;
-out:
- return ret;
-}
-
-gf_boolean_t
-clnt_fd_lk_local_error_status(xlator_t *this, clnt_fd_lk_local_t *local)
-{
- gf_boolean_t error = _gf_false;
-
- LOCK(&local->lock);
- {
- error = local->error;
- }
- UNLOCK(&local->lock);
-
- return error;
-}
-
-int
-clnt_fd_lk_local_mark_error(xlator_t *this, clnt_fd_lk_local_t *local)
-{
- int32_t ret = -1;
- clnt_conf_t *conf = NULL;
- gf_boolean_t error = _gf_false;
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, local, out);
-
- conf = (clnt_conf_t *)this->private;
-
- LOCK(&local->lock);
- {
- error = local->error;
- local->error = _gf_true;
- }
- UNLOCK(&local->lock);
-
- if (!error)
- clnt_reacquire_lock_error(this, local->fdctx, conf);
- ret = 0;
-out:
- return ret;
-}
-
void
client_default_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
@@ -275,14 +66,12 @@ client_default_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
"This function should never be called");
}
-void
+static void
client_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = this->private;
gf_boolean_t destroy = _gf_false;
- conf = this->private;
-
pthread_spin_lock(&conf->fd_lock);
{
fdctx->remote_fd = rfd;
@@ -299,14 +88,12 @@ client_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
client_fdctx_destroy(this, fdctx);
}
-void
+static void
client_child_up_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = this->private;
uint64_t fd_count = 0;
- conf = this->private;
-
LOCK(&conf->rec_lock);
{
fd_count = --(conf->reopen_fd_count);
@@ -315,8 +102,7 @@ client_child_up_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
client_reopen_done(fdctx, rfd, this);
if (fd_count == 0) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
- "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY, NULL);
client_notify_parents_child_up(this);
}
}
@@ -329,21 +115,14 @@ client3_3_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
gfs3_open_rsp rsp = {
0,
};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
+ call_frame_t *frame = myframe;
+ xlator_t *this = frame->this;
+ clnt_local_t *local = frame->local;
+ clnt_fd_ctx_t *fdctx = local->fdctx;
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR,
- "received RPC status error, "
- "returning ENOTCONN");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -351,16 +130,16 @@ client3_3_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
if (rsp.op_ret < 0) {
- gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ gf_smsg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REOPEN_FAILED, "path=%s", local->loc.path);
} else {
gf_msg_debug(frame->this->name, 0,
"reopen on %s succeeded (remote-fd = %" PRId64 ")",
@@ -368,12 +147,9 @@ client3_3_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
if (rsp.op_ret == -1) {
- ret = -1;
goto out;
}
- ret = 0;
-
out:
fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
@@ -393,19 +169,13 @@ client3_3_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
gfs3_open_rsp rsp = {
0,
};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
+ call_frame_t *frame = myframe;
+ clnt_local_t *local = frame->local;
+ clnt_fd_ctx_t *fdctx = local->fdctx;
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR,
- "received RPC status error, "
- "returning ENOTCONN");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -413,25 +183,22 @@ client3_3_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
if (rsp.op_ret < 0) {
- gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ gf_smsg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REOPEN_FAILED, "path=%s", local->loc.path, NULL);
} else {
- gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
- "reopendir on %s succeeded "
- "(fd = %" PRId64 ")",
- local->loc.path, rsp.fd);
+ gf_smsg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "path=%s", local->loc.path, "fd=%" PRId64, rsp.fd, NULL);
}
if (-1 == rsp.op_ret) {
- ret = -1;
goto out;
}
@@ -462,7 +229,6 @@ protocol_client_reopendir(clnt_fd_ctx_t *fdctx, xlator_t *this)
local = mem_get0(this->local_pool);
if (!local) {
- ret = -1;
goto out;
}
local->fdctx = fdctx;
@@ -474,7 +240,6 @@ protocol_client_reopendir(clnt_fd_ctx_t *fdctx, xlator_t *this)
frame = create_frame(this, this->ctx->pool);
if (!frame) {
- ret = -1;
goto out;
}
@@ -486,11 +251,10 @@ protocol_client_reopendir(clnt_fd_ctx_t *fdctx, xlator_t *this)
frame->local = local;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
- client3_3_reopendir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_opendir_req);
+ client3_3_reopendir_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_opendir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, NULL);
}
return 0;
@@ -521,13 +285,11 @@ protocol_client_reopenfile(clnt_fd_ctx_t *fdctx, xlator_t *this)
frame = create_frame(this, this->ctx->pool);
if (!frame) {
- ret = -1;
goto out;
}
local = mem_get0(this->local_pool);
if (!local) {
- ret = -1;
goto out;
}
@@ -547,11 +309,10 @@ protocol_client_reopenfile(clnt_fd_ctx_t *fdctx, xlator_t *this)
local->loc.path);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
- client3_3_reopen_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_open_req);
+ client3_3_reopen_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_open_req);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, NULL);
}
return 0;
@@ -588,21 +349,14 @@ client4_0_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
gfx_open_rsp rsp = {
0,
};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
+ call_frame_t *frame = myframe;
+ xlator_t *this = frame->this;
+ clnt_local_t *local = frame->local;
+ clnt_fd_ctx_t *fdctx = local->fdctx;
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR,
- "received RPC status error, "
- "returning ENOTCONN");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -610,16 +364,16 @@ client4_0_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
if (rsp.op_ret < 0) {
- gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ gf_smsg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REOPEN_FAILED, "path=%s", local->loc.path, NULL);
} else {
gf_msg_debug(frame->this->name, 0,
"reopen on %s succeeded (remote-fd = %" PRId64 ")",
@@ -627,12 +381,9 @@ client4_0_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
if (rsp.op_ret == -1) {
- ret = -1;
goto out;
}
- ret = 0;
-
out:
fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
@@ -652,19 +403,13 @@ client4_0_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
gfx_open_rsp rsp = {
0,
};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
+ call_frame_t *frame = myframe;
+ clnt_local_t *local = frame->local;
+ clnt_fd_ctx_t *fdctx = local->fdctx;
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR,
- "received RPC status error, "
- "returning ENOTCONN");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -672,25 +417,22 @@ client4_0_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
if (rsp.op_ret < 0) {
- gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ gf_smsg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_FAILED, "dir-path=%s", local->loc.path, NULL);
} else {
- gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
- "reopendir on %s succeeded "
- "(fd = %" PRId64 ")",
- local->loc.path, rsp.fd);
+ gf_smsg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "path=%s", local->loc.path, "fd=%" PRId64, rsp.fd, NULL);
}
if (-1 == rsp.op_ret) {
- ret = -1;
goto out;
}
@@ -713,13 +455,10 @@ protocol_client_reopendir_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
0,
},
};
- clnt_local_t *local = NULL;
call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
+ clnt_conf_t *conf = this->private;
+ clnt_local_t *local = mem_get0(this->local_pool);
- local = mem_get0(this->local_pool);
if (!local) {
ret = -1;
goto out;
@@ -745,11 +484,10 @@ protocol_client_reopendir_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
frame->local = local;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
- client4_0_reopendir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_opendir_req);
+ client4_0_reopendir_cbk, NULL,
+ (xdrproc_t)xdr_gfx_opendir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, NULL);
}
return 0;
@@ -773,12 +511,9 @@ protocol_client_reopenfile_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
},
};
clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = this->private;
+ call_frame_t *frame = create_frame(this, this->ctx->pool);
- conf = this->private;
-
- frame = create_frame(this, this->ctx->pool);
if (!frame) {
ret = -1;
goto out;
@@ -806,11 +541,10 @@ protocol_client_reopenfile_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
local->loc.path);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
- client4_0_reopen_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_open_req);
+ client4_0_reopen_cbk, NULL,
+ (xdrproc_t)xdr_gfx_open_req);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, NULL);
}
return 0;
@@ -849,14 +583,12 @@ __is_fd_reopen_in_progress(clnt_fd_ctx_t *fdctx)
void
client_attempt_reopen(fd_t *fd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- gf_boolean_t reopen = _gf_false;
-
if (!fd || !this)
goto out;
- conf = this->private;
+ clnt_conf_t *conf = this->private;
+ clnt_fd_ctx_t *fdctx = NULL;
+ gf_boolean_t reopen = _gf_false;
pthread_spin_lock(&conf->fd_lock);
{
@@ -891,7 +623,7 @@ out:
return;
}
-int
+static int
client_post_handshake(call_frame_t *frame, xlator_t *this)
{
clnt_conf_t *conf = NULL;
@@ -911,7 +643,8 @@ client_post_handshake(call_frame_t *frame, xlator_t *this)
{
list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos)
{
- if (fdctx->remote_fd != -1)
+ if (fdctx->remote_fd != -1 ||
+ (!list_empty(&fdctx->lock_list) && conf->strict_locks))
continue;
fdctx->reopen_done = client_child_up_reopen_done;
@@ -925,10 +658,8 @@ client_post_handshake(call_frame_t *frame, xlator_t *this)
/* Delay notifying CHILD_UP to parents
until all locks are recovered */
if (count > 0) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_DELAY,
- "%d fds open - Delaying "
- "child_up until they are re-opened",
- count);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_DELAY,
+ "count=%d", count, NULL);
client_save_number_fds(conf, count);
list_for_each_entry_safe(fdctx, tmp, &reopen_head, sfd_pos)
@@ -954,11 +685,12 @@ int
client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ call_frame_t *frame = myframe;
+ xlator_t *this = frame->this;
+ clnt_conf_t *conf = this->private;
dict_t *reply = NULL;
char *process_uuid = NULL;
+ char *volume_id = NULL;
char *remote_error = NULL;
char *remote_subvol = NULL;
gf_setvolume_rsp rsp = {
@@ -970,32 +702,29 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
gf_boolean_t auth_fail = _gf_false;
glusterfs_ctx_t *ctx = NULL;
- frame = myframe;
- this = frame->this;
- conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out);
ctx = this->ctx;
GF_VALIDATE_OR_GOTO(this->name, ctx, out);
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
op_ret = -1;
goto out;
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
op_ret = -1;
goto out;
}
op_ret = rsp.op_ret;
op_errno = gf_error_to_errno(rsp.op_errno);
if (-1 == rsp.op_ret) {
- gf_msg(frame->this->name, GF_LOG_WARNING, op_errno, PC_MSG_VOL_SET_FAIL,
- "failed to set the volume");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_VOL_SET_FAIL, NULL);
}
reply = dict_new();
@@ -1005,35 +734,30 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
if (rsp.dict.dict_len) {
ret = dict_unserialize(rsp.dict.dict_val, rsp.dict.dict_len, &reply);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_DICT_UNSERIALIZE_FAIL,
- "failed to "
- "unserialize buffer to dict");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, 0,
+ PC_MSG_DICT_UNSERIALIZE_FAIL, NULL);
goto out;
}
}
- ret = dict_get_str(reply, "ERROR", &remote_error);
+ ret = dict_get_str_sizen(reply, "ERROR", &remote_error);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
- "failed to get ERROR "
- "string from reply dict");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "ERROR string", NULL);
}
- ret = dict_get_str(reply, "process-uuid", &process_uuid);
+ ret = dict_get_str_sizen(reply, "process-uuid", &process_uuid);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
- "failed to get "
- "'process-uuid' from reply dict");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "process-uuid", NULL);
}
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, op_errno, PC_MSG_SETVOLUME_FAIL,
- "SETVOLUME on remote-host failed: %s", remote_error);
+ gf_smsg(this->name, GF_LOG_ERROR, op_errno, PC_MSG_SETVOLUME_FAIL,
+ "remote-error=%s", remote_error, NULL);
errno = op_errno;
- if (remote_error &&
- (strcmp("Authentication failed", remote_error) == 0)) {
+ if (remote_error && (op_errno == EACCES)) {
auth_fail = _gf_true;
op_ret = 0;
}
@@ -1050,19 +774,45 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
if (op_errno == ESTALE) {
ret = client_notify_dispatch(this, GF_EVENT_VOLFILE_MODIFIED, NULL);
if (ret)
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VOLFILE_NOTIFY_FAILED,
- "notify of VOLFILE_MODIFIED failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_VOLFILE_NOTIFY_FAILED, NULL);
}
goto out;
}
- ret = dict_get_str(this->options, "remote-subvolume", &remote_subvol);
+ ret = dict_get_str_sizen(this->options, "remote-subvolume", &remote_subvol);
if (ret || !remote_subvol) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'remote-subvolume' in the options");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FIND_KEY_FAILED,
+ "remote-subvolume", NULL);
goto out;
}
+ ret = dict_get_str_sizen(reply, "volume-id", &volume_id);
+ if (ret < 0) {
+ /* this can happen if the server is of old version, so treat it as
+ just debug message */
+ gf_msg_debug(this->name, EINVAL,
+ "failed to get 'volume-id' from reply dict");
+ } else if (ctx->master && strncmp("snapd", remote_subvol, 5)) {
+ /* TODO: if it is a fuse mount or a snapshot enabled client, don't
+ bother */
+ /* If any value is set, the first element will be non-0.
+ It would be '0', but not '\0' :-) */
+ if (ctx->volume_id[0]) {
+ if (strcmp(ctx->volume_id, volume_id)) {
+ /* Ideally it shouldn't even come here, as server itself
+ should fail the handshake in that case */
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_VOL_ID_CHANGED,
+ "vol-id=%s", volume_id, "ctx->vol-id=%s",
+ ctx->volume_id, NULL);
+ op_ret = -1;
+ goto out;
+ }
+ } else {
+ strncpy(ctx->volume_id, volume_id, GF_UUID_BUF_SIZE);
+ }
+ }
+
uint32_t child_up_int;
ret = dict_get_uint32(reply, "child_up", &child_up_int);
if (ret) {
@@ -1071,8 +821,8 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
* connect to this client is running an older version. Hence *
* setting the child_up to _gf_true in this case. *
*/
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'child_up' in the options");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FIND_KEY_FAILED,
+ "child_up", NULL);
conf->child_up = _gf_true;
} else {
conf->child_up = (child_up_int != 0);
@@ -1102,9 +852,9 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
conf->client_id = glusterfs_leaf_position(this);
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
- "Connected to %s, attached to remote volume '%s'.",
- conf->rpc->conn.name, remote_subvol);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
+ "conn-name=%s", conf->rpc->conn.name, "remote_subvol=%s",
+ remote_subvol, NULL);
op_ret = 0;
conf->connected = 1;
@@ -1112,13 +862,11 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
client_post_handshake(frame, frame->this);
out:
if (auth_fail) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
- "sending AUTH_FAILED event");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED, NULL);
ret = client_notify_dispatch(this, GF_EVENT_AUTH_FAILED, NULL);
if (ret)
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED_NOTIFY_FAILED,
- "notify of "
- "AUTH_FAILED failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_AUTH_FAILED_NOTIFY_FAILED, NULL);
conf->connected = 0;
ret = -1;
}
@@ -1127,14 +875,12 @@ out:
* background, for now, don't hang here,
* tell the parents that i am all ok..
*/
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_CONNECTING_EVENT,
- "sending "
- "CHILD_CONNECTING event");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_CONNECTING_EVENT,
+ NULL);
ret = client_notify_dispatch(this, GF_EVENT_CHILD_CONNECTING, NULL);
if (ret)
- gf_msg(this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
- "notify of CHILD_CONNECTING failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED, NULL);
/*
* The reconnection *won't* happen in the background (see
* previous comment) unless we kill the current connection.
@@ -1164,34 +910,30 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
};
call_frame_t *fr = NULL;
char *process_uuid_xl = NULL;
- clnt_conf_t *conf = NULL;
- dict_t *options = NULL;
+ char *remote_subvol = NULL;
+ clnt_conf_t *conf = this->private;
+ dict_t *options = this->options;
char counter_str[32] = {0};
char hostname[256] = {
0,
};
- options = this->options;
- conf = this->private;
-
if (conf->fops) {
- ret = dict_set_int32(options, "fops-version", conf->fops->prognum);
+ ret = dict_set_int32_sizen(options, "fops-version",
+ conf->fops->prognum);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set "
- "version-fops(%d) in handshake msg",
- conf->fops->prognum);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "version-fops=%d", conf->fops->prognum, NULL);
goto fail;
}
}
if (conf->mgmt) {
- ret = dict_set_int32(options, "mgmt-version", conf->mgmt->prognum);
+ ret = dict_set_int32_sizen(options, "mgmt-version",
+ conf->mgmt->prognum);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set "
- "version-mgmt(%d) in handshake msg",
- conf->mgmt->prognum);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "version-mgmt=%d", conf->mgmt->prognum, NULL);
goto fail;
}
}
@@ -1207,8 +949,8 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
conf->setvol_count++;
if (gethostname(hostname, 256) == -1) {
- gf_msg(this->name, GF_LOG_ERROR, errno, LG_MSG_GETHOSTNAME_FAILED,
- "gethostname: failed");
+ gf_smsg(this->name, GF_LOG_ERROR, errno, PC_MSG_GETHOSTNAME_FAILED,
+ NULL);
goto fail;
}
@@ -1217,54 +959,75 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
this->ctx->process_uuid, this->graph->id, getpid(),
hostname, this->name, counter_str);
if (-1 == ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PROCESS_UUID_SET_FAIL,
- "asprintf failed while "
- "setting process_uuid");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_PROCESS_UUID_SET_FAIL,
+ NULL);
goto fail;
}
- ret = dict_set_dynstr(options, "process-uuid", process_uuid_xl);
+ ret = dict_set_dynstr_sizen(options, "process-uuid", process_uuid_xl);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-uuid(%s) in handshake msg",
- process_uuid_xl);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "process-uuid=%s", process_uuid_xl, NULL);
goto fail;
}
- ret = dict_set_str(options, "process-name",
- this->ctx->cmd_args.process_name);
- if (ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-name in handshake msg");
+ if (this->ctx->cmd_args.process_name) {
+ ret = dict_set_str_sizen(options, "process-name",
+ this->ctx->cmd_args.process_name);
+ if (ret < 0) {
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
+ "process-name", NULL);
+ }
}
- ret = dict_set_str(options, "client-version", PACKAGE_VERSION);
+ ret = dict_set_str_sizen(options, "client-version", PACKAGE_VERSION);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set client-version(%s) in handshake msg",
- PACKAGE_VERSION);
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "client-version=%s", PACKAGE_VERSION, NULL);
+ }
+
+ ret = dict_get_str_sizen(this->options, "remote-subvolume", &remote_subvol);
+ if (ret || !remote_subvol) {
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FIND_KEY_FAILED,
+ "remote-subvolume", NULL);
+ goto fail;
+ }
+
+ /* volume-id to be sent only for regular volume, not snap volume */
+ if (strncmp("snapd", remote_subvol, 5)) {
+ /* If any value is set, the first element will be non-0.
+ It would be '0', but not '\0' :-) */
+ if (!this->ctx->volume_id[0]) {
+ strncpy(this->ctx->volume_id, this->graph->volume_id,
+ GF_UUID_BUF_SIZE);
+ }
+ if (this->ctx->volume_id[0]) {
+ ret = dict_set_str(options, "volume-id", this->ctx->volume_id);
+ if (ret < 0) {
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
+ "volume-id", NULL);
+ }
+ }
}
if (this->ctx->cmd_args.volfile_server) {
if (this->ctx->cmd_args.volfile_id) {
- ret = dict_set_str(options, "volfile-key",
- this->ctx->cmd_args.volfile_id);
+ ret = dict_set_str_sizen(options, "volfile-key",
+ this->ctx->cmd_args.volfile_id);
if (ret)
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to "
- "set 'volfile-key'");
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PC_MSG_VOLFILE_KEY_SET_FAILED, NULL);
}
ret = dict_set_uint32(options, "volfile-checksum",
this->graph->volfile_checksum);
if (ret)
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set "
- "'volfile-checksum'");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_VOLFILE_CHECKSUM_FAILED,
+ NULL);
}
if (this->ctx->cmd_args.subdir_mount) {
- ret = dict_set_str(options, "subdir-mount",
- this->ctx->cmd_args.subdir_mount);
+ ret = dict_set_str_sizen(options, "subdir-mount",
+ this->ctx->cmd_args.subdir_mount);
if (ret) {
gf_log(THIS->name, GF_LOG_ERROR, "Failed to set subdir_mount");
/* It makes sense to fail, as per the CLI, we
@@ -1278,31 +1041,21 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
*/
ret = dict_set_uint32(options, "clnt-lk-version", 1);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set clnt-lk-version(1) in handshake msg");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "clnt-lk-version(1)", NULL);
}
- ret = dict_set_int32(options, "opversion", GD_OP_VERSION_MAX);
+ ret = dict_set_int32_sizen(options, "opversion", GD_OP_VERSION_MAX);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "Failed to set client opversion in handshake message");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "client opversion", NULL);
}
- ret = dict_serialized_length(options);
- if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
- "failed to get serialized length of dict");
+ ret = dict_allocate_and_serialize(options, (char **)&req.dict.dict_val,
+ &req.dict.dict_len);
+ if (ret != 0) {
ret = -1;
- goto fail;
- }
- req.dict.dict_len = ret;
- req.dict.dict_val = GF_CALLOC(1, req.dict.dict_len,
- gf_client_mt_clnt_req_buf_t);
- ret = dict_serialize(options, req.dict.dict_val);
- if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SERIALIZE_FAIL,
- "failed to serialize "
- "dictionary");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SERIALIZE_FAIL, NULL);
goto fail;
}
@@ -1312,7 +1065,6 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
ret = client_submit_request(this, &req, fr, conf->handshake,
GF_HNDSK_SETVOLUME, client_setvolume_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
(xdrproc_t)xdr_gf_setvolume_req);
fail:
@@ -1321,7 +1073,7 @@ fail:
return ret;
}
-int
+static int
select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
{
gf_prog_detail *trav = NULL;
@@ -1329,8 +1081,7 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
int ret = -1;
if (!this || !prog) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND, NULL);
goto out;
}
@@ -1340,11 +1091,15 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
while (trav) {
/* Select 'programs' */
if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
- (clnt3_3_fop_prog.progver == trav->progver) && !conf->fops) {
+ (clnt3_3_fop_prog.progver == trav->progver)) {
conf->fops = &clnt3_3_fop_prog;
if (conf->rpc)
conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
ret = 0;
+ /* In normal flow, we don't want to use old protocol type.
+ but if it is for testing, lets use it */
+ if (conf->old_protocol)
+ goto done;
}
if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
@@ -1353,8 +1108,10 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
if (conf->rpc)
conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
ret = 0;
- /* this is latest program, lets use it */
- goto out;
+ /* this is latest program, lets use this program only */
+ /* if we are testing for old-protocol, lets not break this */
+ if (!conf->old_protocol)
+ goto done;
}
if (ret) {
@@ -1364,11 +1121,11 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
trav = trav->next;
}
+done:
if (!ret)
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VERSION_INFO,
- "Using Program %s,"
- " Num (%d), Version (%d)",
- conf->fops->progname, conf->fops->prognum, conf->fops->progver);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_VERSION_INFO,
+ "Program-name=%s", conf->fops->progname, "Num=%d",
+ conf->fops->prognum, "Version=%d", conf->fops->progver, NULL);
out:
return ret;
@@ -1381,8 +1138,7 @@ server_has_portmap(xlator_t *this, gf_prog_detail *prog)
int ret = -1;
if (!this || !prog) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND, NULL);
goto out;
}
@@ -1419,36 +1175,30 @@ client_query_portmap_cbk(struct rpc_req *req, struct iovec *iov, int count,
frame = myframe;
if (!frame || !frame->this || !frame->this->private) {
- gf_msg(THIS->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "frame not found with rpc "
- "request");
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL, PC_MSG_FRAME_NOT_FOUND,
+ NULL);
goto out;
}
this = frame->this;
conf = frame->this->private;
if (-1 == req->rpc_status) {
- gf_msg(this->name, GF_LOG_WARNING, ENOTCONN, PC_MSG_RPC_STATUS_ERROR,
- "received RPC status error, "
- "try again later");
+ gf_smsg(this->name, GF_LOG_WARNING, ENOTCONN, PC_MSG_RPC_STATUS_ERROR,
+ NULL);
goto out;
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
goto out;
}
if (-1 == rsp.op_ret) {
ret = -1;
if (!conf->portmap_err_logged) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PORT_NUM_ERROR,
- "failed to get the "
- "port number for remote subvolume. Please run "
- "'gluster volume status' on server to see if "
- "brick process is running.");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_PORT_NUM_ERROR, NULL);
} else {
gf_msg_debug(this->name, 0,
"failed to get the port number for "
@@ -1498,16 +1248,16 @@ client_query_portmap(xlator_t *this, struct rpc_clnt *rpc)
options = this->options;
- ret = dict_get_str(options, "remote-subvolume", &remote_subvol);
+ ret = dict_get_str_sizen(options, "remote-subvolume", &remote_subvol);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
- "remote-subvolume not set in volfile");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_REMOTE_SUBVOL_SET_FAIL,
+ NULL);
goto fail;
}
req.brick = remote_subvol;
- if (!dict_get_str(options, "transport-type", &xprt)) {
+ if (!dict_get_str_sizen(options, "transport-type", &xprt)) {
if (!strcmp(xprt, "rdma")) {
snprintf(brick_name, sizeof(brick_name), "%s.rdma", remote_subvol);
req.brick = brick_name;
@@ -1522,14 +1272,13 @@ client_query_portmap(xlator_t *this, struct rpc_clnt *rpc)
ret = client_submit_request(this, &req, fr, &clnt_pmap_prog,
GF_PMAP_PORTBYBRICK, client_query_portmap_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_pmap_port_by_brick_req);
+ NULL, (xdrproc_t)xdr_pmap_port_by_brick_req);
fail:
return ret;
}
-int
+static int
client_dump_version_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
@@ -1546,21 +1295,20 @@ client_dump_version_cbk(struct rpc_req *req, struct iovec *iov, int count,
conf = frame->this->private;
if (-1 == req->rpc_status) {
- gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, NULL);
goto out;
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
if (ret < 0) {
- gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, NULL);
goto out;
}
if (-1 == rsp.op_ret) {
- gf_msg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VERSION_ERROR,
- "failed to get the 'versions' "
- "from server");
+ gf_smsg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VERSION_ERROR,
+ NULL);
goto out;
}
@@ -1573,9 +1321,7 @@ client_dump_version_cbk(struct rpc_req *req, struct iovec *iov, int count,
/* Reply in "Name:Program-Number:Program-Version,..." format */
ret = select_server_supported_programs(frame->this, rsp.prog);
if (ret) {
- gf_msg(frame->this->name, GF_LOG_ERROR, 0, PC_MSG_VERSION_ERROR,
- "server doesn't support the "
- "version");
+ gf_smsg(frame->this->name, GF_LOG_ERROR, 0, PC_MSG_VERSION_ERROR, NULL);
goto out;
}
@@ -1613,8 +1359,8 @@ client_handshake(xlator_t *this, struct rpc_clnt *rpc)
conf = this->private;
if (!conf->handshake) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "handshake program not found");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_HANDSHAKE_PGM_NOT_FOUND,
+ NULL);
goto out;
}
@@ -1624,8 +1370,8 @@ client_handshake(xlator_t *this, struct rpc_clnt *rpc)
req.gfs_id = 0xbabe;
ret = client_submit_request(this, &req, frame, conf->dump, GF_DUMP_DUMP,
- client_dump_version_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gf_dump_req);
+ client_dump_version_cbk, NULL,
+ (xdrproc_t)xdr_gf_dump_req);
out:
return ret;
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index e81f166ba46..189dfddd021 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -9,11 +9,11 @@
*/
#include "client.h"
-#include "fd.h"
+#include <glusterfs/fd.h>
#include "client-messages.h"
#include "client-common.h"
-#include "compat-errno.h"
-#include "common-utils.h"
+#include <glusterfs/compat-errno.h>
+#include <glusterfs/common-utils.h>
int
client_fd_lk_list_empty(fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
@@ -91,23 +91,23 @@ this_fd_set_ctx(fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
ret = fd_ctx_get(file, this, &oldaddr);
if (ret >= 0) {
if (loc)
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
- "%s (%s): trying duplicate remote fd set. ", loc->path,
- uuid_utoa(loc->inode->gfid));
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "path=%s", loc->path, "gfid=%s",
+ uuid_utoa(loc->inode->gfid), NULL);
else
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
- "%p: trying duplicate remote fd set. ", file);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "file=%p", file, NULL);
}
ret = fd_ctx_set(file, this, (uint64_t)(unsigned long)ctx);
if (ret < 0) {
if (loc)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
- "%s (%s): failed to set remote fd", loc->path,
- uuid_utoa(loc->inode->gfid));
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "path=%s", loc->path, "gfid=%s",
+ uuid_utoa(loc->inode->gfid), NULL);
else
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
- "%p: failed to set remote fd", file);
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "file=%p", file, NULL);
}
out:
return;
@@ -129,7 +129,6 @@ client_local_wipe(clnt_local_t *local)
}
GF_FREE(local->name);
- local->compound_args = NULL;
mem_put(local);
}
@@ -176,7 +175,6 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
gf_dirent_t *entries)
{
struct gfs3_dirplist *trav = NULL;
- char *buf = NULL;
gf_dirent_t *entry = NULL;
inode_table_t *itable = NULL;
int entry_len = 0;
@@ -208,22 +206,17 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
strcpy(entry->d_name, trav->name);
if (trav->dict.dict_val) {
- /* Dictionary is sent along with response */
- buf = memdup(trav->dict.dict_val, trav->dict.dict_len);
- if (!buf)
- goto out;
-
entry->dict = dict_new();
+ if (!entry->dict)
+ goto out;
- ret = dict_unserialize(buf, trav->dict.dict_len, &entry->dict);
+ ret = dict_unserialize(trav->dict.dict_val, trav->dict.dict_len,
+ &entry->dict);
if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_UNSERIALIZE_FAIL,
- "failed to unserialize xattr dict");
+ gf_smsg(THIS->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_DICT_UNSERIALIZE_FAIL, "xattr", NULL);
goto out;
}
- GF_FREE(buf);
- buf = NULL;
}
entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
@@ -233,12 +226,13 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
list_add_tail(&entry->list, &entries->list);
trav = trav->nextentry;
+ entry = NULL;
}
ret = 0;
out:
- if (buf)
- GF_FREE(buf);
+ if (entry)
+ gf_dirent_entry_free(entry);
return ret;
}
@@ -410,6 +404,7 @@ client_get_remote_fd(xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
{
clnt_fd_ctx_t *fdctx = NULL;
clnt_conf_t *conf = NULL;
+ gf_boolean_t locks_held = _gf_false;
GF_VALIDATE_OR_GOTO(this->name, fd, out);
GF_VALIDATE_OR_GOTO(this->name, remote_fd, out);
@@ -419,17 +414,25 @@ client_get_remote_fd(xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
{
fdctx = this_fd_get_ctx(fd, this);
if (!fdctx) {
- *remote_fd = GF_ANON_FD_NO;
+ if (fd->anonymous) {
+ *remote_fd = GF_ANON_FD_NO;
+ } else {
+ *remote_fd = -1;
+ gf_msg_debug(this->name, EBADF, "not a valid fd for gfid: %s",
+ uuid_utoa(fd->inode->gfid));
+ }
} else {
if (__is_fd_reopen_in_progress(fdctx))
*remote_fd = -1;
else
*remote_fd = fdctx->remote_fd;
+
+ locks_held = !list_empty(&fdctx->lock_list);
}
}
pthread_spin_unlock(&conf->fd_lock);
- if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1))
+ if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1) && (!locks_held))
*remote_fd = GF_ANON_FD_NO;
return 0;
@@ -485,1140 +488,6 @@ out:
return ret;
}
-int
-client_process_response(call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfs3_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk, int index)
-{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {
- {0},
- };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD(&entries.list);
-
- switch (args_cbk->enum_list[index]) {
- case GF_FOP_STAT: {
- gfs3_stat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_stat_rsp;
-
- client_post_stat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
-
- CLIENT_POST_FOP_TYPE(stat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
- }
- case GF_FOP_READLINK: {
- gfs3_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readlink_rsp;
-
- client_post_readlink(this, tmp_rsp, &this_args_cbk->stat, &xdata);
- CLIENT_POST_FOP_TYPE(readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat, xdata);
- break;
- }
- case GF_FOP_MKNOD: {
- gfs3_mknod_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mknod_rsp;
-
- client_post_mknod(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(mknod, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_MKDIR: {
- gfs3_mkdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
-
- client_post_mkdir(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(mkdir, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_UNLINK: {
- gfs3_unlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_unlink_rsp;
-
- client_post_unlink(this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(unlink, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_RMDIR: {
- gfs3_rmdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
-
- client_post_rmdir(this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(rmdir, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfs3_symlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_symlink_rsp;
-
- client_post_symlink(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(
- symlink, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_RENAME: {
- gfs3_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rename_rsp;
-
- client_post_rename(
- this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT_POST_FOP_TYPE(
- rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
- break;
- }
- case GF_FOP_LINK: {
- gfs3_link_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_link_rsp;
-
- client_post_link(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(
- link, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfs3_truncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_truncate_rsp;
-
- client_post_truncate(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE(truncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN: {
- gfs3_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_open_rsp;
-
- client_post_open(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE(open, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_READ: {
- gfs3_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_read_rsp;
-
- client_post_readv(this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat, vector,
- &req->rsp[1], &this_args_cbk->count, &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
-
- args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno(tmp_rsp->op_errno), vector,
- this_args_cbk->count, &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
-
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen(local->fd, this);
-
- break;
- }
- case GF_FOP_WRITE: {
- gfs3_write_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_write_rsp;
-
- client_post_writev(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- args_writev_cbk_store(this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno(tmp_rsp->op_errno),
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
-
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen(local->fd, this);
- break;
- }
- case GF_FOP_STATFS: {
- gfs3_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_statfs_rsp;
-
- client_post_statfs(this, tmp_rsp, &this_args_cbk->statvfs, &xdata);
-
- CLIENT_POST_FOP_TYPE(statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_flush_rsp;
-
- client_post_flush(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner(local->fd, &local->owner);
- gf_msg_trace(this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa(&local->owner), ret);
- }
- break;
- }
- case GF_FOP_FSYNC: {
- gfs3_fsync_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsync_rsp;
-
- client_post_fsync(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(fsync, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_SETXATTR: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
-
- client_post_setxattr(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
-
- client_post_getxattr(this, tmp_rsp, &xattr, &xdata);
-
- CLIENT_POST_FOP_TYPE(getxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
-
- client_post_removexattr(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(removexattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfs3_opendir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_opendir_rsp;
-
- client_post_opendir(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE(opendir, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
-
- client_post_fsyncdir(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(fsyncdir, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_ACCESS: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_access_rsp;
-
- client_post_access(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(access, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_CREATE: {
- gfs3_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_create_rsp;
-
- client_post_create(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT_POST_FOP_TYPE(create, this_rsp, this_args_cbk, local->fd,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfs3_ftruncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
-
- client_post_ftruncate(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE(ftruncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_FSTAT: {
- gfs3_fstat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fstat_rsp;
-
- client_post_fstat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
-
- CLIENT_POST_FOP_TYPE(fstat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
- }
- case GF_FOP_LK: {
- gfs3_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lk_rsp;
-
- client_post_lk(this, tmp_rsp, &this_args_cbk->lock, &xdata);
-
- CLIENT_POST_FOP_TYPE(lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfs3_lookup_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lookup_rsp;
-
- client_post_lookup(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE(lookup, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat, xdata,
- &this_args_cbk->postparent);
- break;
- }
- case GF_FOP_READDIR: {
- gfs3_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdir_rsp;
-
- client_post_readdir(this, tmp_rsp, &entries, &xdata);
-
- CLIENT_POST_FOP_TYPE(readdir, this_rsp, this_args_cbk, &entries,
- xdata);
- break;
- }
- case GF_FOP_INODELK: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
-
- client_post_inodelk(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(inodelk, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_FINODELK: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
-
- client_post_finodelk(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(finodelk, this_rsp, this_args_cbk, xdata);
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen(local->fd, this);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
-
- client_post_entrylk(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(entrylk, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
-
- client_post_fentrylk(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(fentrylk, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_XATTROP: {
- gfs3_xattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
-
- client_post_xattrop(this, tmp_rsp, &xattr, &xdata);
-
- CLIENT_POST_FOP_TYPE(xattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
-
- client_post_fxattrop(this, tmp_rsp, &xattr, &xdata);
-
- CLIENT_POST_FOP_TYPE(fxattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- if (rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen(local->fd, this);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
-
- client_post_fgetxattr(this, tmp_rsp, &xattr, &xdata);
-
- CLIENT_POST_FOP_TYPE(fgetxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
- }
- case GF_FOP_FSETXATTR: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetxattr_rsp;
-
- client_post_fsetxattr(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(fsetxattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfs3_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
-
- client_post_rchecksum(this, tmp_rsp, &xdata);
-
- break;
- CLIENT_POST_FOP_TYPE(
- rchecksum, this_rsp, this_args_cbk, tmp_rsp->weak_checksum,
- (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
- break;
- }
- case GF_FOP_SETATTR: {
- gfs3_setattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setattr_rsp;
-
- client_post_setattr(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(setattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfs3_fsetattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
-
- client_post_fsetattr(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(fsetattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_READDIRP: {
- gfs3_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
-
- client_post_readdirp(this, tmp_rsp, local->fd, &entries, &xdata);
-
- CLIENT_POST_FOP_TYPE(readdirp, this_rsp, this_args_cbk, &entries,
- xdata);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
-
- client_post_fremovexattr(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP(fremovexattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfs3_fallocate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
-
- client_post_fallocate(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(fallocate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_DISCARD: {
- gfs3_discard_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_discard_rsp;
-
- client_post_discard(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(discard, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfs3_zerofill_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
-
- client_post_zerofill(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE(zerofill, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_IPC: {
- gfs3_ipc_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ipc_rsp;
-
- client_post_ipc(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE(ipc, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_SEEK: {
- gfs3_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_seek_rsp;
-
- client_post_seek(this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE(seek, this_rsp, this_args_cbk, tmp_rsp->offset,
- xdata);
- break;
- }
- case GF_FOP_LEASE: {
- gfs3_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lease_rsp;
-
- client_post_lease(this, tmp_rsp, &this_args_cbk->lease, &xdata);
-
- CLIENT_POST_FOP_TYPE(lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
- }
- default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref(xdata);
- if (xattr)
- dict_unref(xattr);
- gf_dirent_free(&entries);
- return 0;
-}
-
-int
-client_handle_fop_requirements(
- xlator_t *this, call_frame_t *frame, gfs3_compound_req *req,
- clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
- struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args, int fop_enum, int index)
-{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req *this_req = &req->compound_req_array
- .compound_req_array_val[index];
-
- this_req->fop_enum = fop_enum;
-
- switch (fop_enum) {
- case GF_FOP_STAT:
- CLIENT_PRE_FOP(stat, this,
- &this_req->compound_req_u.compound_stat_req,
- op_errno, out, &args->loc, args->xdata);
- break;
- case GF_FOP_READLINK:
- CLIENT_PRE_FOP(readlink, this,
- &this_req->compound_req_u.compound_readlink_req,
- op_errno, out, &args->loc, args->size, args->xdata);
- break;
- case GF_FOP_MKNOD:
- CLIENT_PRE_FOP(mknod, this,
- &this_req->compound_req_u.compound_mknod_req,
- op_errno, out, &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_MKDIR:
- CLIENT_PRE_FOP(mkdir, this,
- &this_req->compound_req_u.compound_mkdir_req,
- op_errno, out, &args->loc, args->mode, args->umask,
- args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_UNLINK:
- CLIENT_PRE_FOP(unlink, this,
- &this_req->compound_req_u.compound_unlink_req,
- op_errno, out, &args->loc, args->xflag, args->xdata);
- break;
- case GF_FOP_RMDIR:
- CLIENT_PRE_FOP(rmdir, this,
- &this_req->compound_req_u.compound_rmdir_req,
- op_errno, out, &args->loc, args->flags, args->xdata);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_PRE_FOP(symlink, this,
- &this_req->compound_req_u.compound_symlink_req,
- op_errno, out, &args->loc, args->linkname,
- args->umask, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_RENAME:
- CLIENT_PRE_FOP(rename, this,
- &this_req->compound_req_u.compound_rename_req,
- op_errno, out, &args->loc, &args->loc2, args->xdata);
- break;
- case GF_FOP_LINK:
- CLIENT_PRE_FOP(link, this,
- &this_req->compound_req_u.compound_link_req,
- op_errno, out, &args->loc, &args->loc2, args->xdata);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_PRE_FOP(
- truncate, this, &this_req->compound_req_u.compound_truncate_req,
- op_errno, out, &args->loc, args->offset, args->xdata);
- break;
- case GF_FOP_OPEN:
- CLIENT_PRE_FOP(
- open, this, &this_req->compound_req_u.compound_open_req,
- op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- break;
- case GF_FOP_READ:
- op_errno = client_pre_readv(
- this, &this_req->compound_req_u.compound_read_req, args->fd,
- args->size, args->offset, args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
-
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
- iobref_add(*rsp_iobref, rsp_iobuf);
- iobuf_unref(rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
- }
- *rsp_count += 1;
-
- break;
- case GF_FOP_WRITE:
- op_errno = client_pre_writev(
- this, &this_req->compound_req_u.compound_write_req, args->fd,
- iov_length(args->vector, args->count), args->offset,
- args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy(&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
-
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else if (iobref_merge(*req_iobref, args->iobref))
- goto out;
- break;
- case GF_FOP_STATFS:
- CLIENT_PRE_FOP(statfs, this,
- &this_req->compound_req_u.compound_statfs_req,
- op_errno, out, &args->loc, args->xdata);
- break;
- case GF_FOP_FLUSH:
- CLIENT_PRE_FOP(flush, this,
- &this_req->compound_req_u.compound_flush_req,
- op_errno, out, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->owner = frame->root->lk_owner;
- break;
- case GF_FOP_FSYNC:
- CLIENT_PRE_FOP(
- fsync, this, &this_req->compound_req_u.compound_fsync_req,
- op_errno, out, args->fd, args->datasync, args->xdata);
- break;
- case GF_FOP_SETXATTR:
- CLIENT_PRE_FOP(setxattr, this,
- &this_req->compound_req_u.compound_setxattr_req,
- op_errno, out, &args->loc, args->xattr, args->flags,
- args->xdata);
- break;
- case GF_FOP_GETXATTR:
- CLIENT_PRE_FOP(getxattr, this,
- &this_req->compound_req_u.compound_getxattr_req,
- op_errno, out, &args->loc, args->name, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_PRE_FOP(removexattr, this,
- &this_req->compound_req_u.compound_removexattr_req,
- op_errno, out, &args->loc, args->name, args->xdata);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_PRE_FOP(opendir, this,
- &this_req->compound_req_u.compound_opendir_req,
- op_errno, out, &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_PRE_FOP(
- fsyncdir, this, &this_req->compound_req_u.compound_fsyncdir_req,
- op_errno, out, args->fd, args->datasync, args->xdata);
- break;
- case GF_FOP_ACCESS:
- CLIENT_PRE_FOP(access, this,
- &this_req->compound_req_u.compound_access_req,
- op_errno, out, &args->loc, args->mask, args->xdata);
- break;
- case GF_FOP_CREATE:
- CLIENT_PRE_FOP(create, this,
- &this_req->compound_req_u.compound_create_req,
- op_errno, out, &args->loc, args->fd, args->mode,
- args->flags, args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
-
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_PRE_FOP(ftruncate, this,
- &this_req->compound_req_u.compound_ftruncate_req,
- op_errno, out, args->fd, args->offset, args->xdata);
- break;
- case GF_FOP_FSTAT:
- CLIENT_PRE_FOP(fstat, this,
- &this_req->compound_req_u.compound_fstat_req,
- op_errno, out, args->fd, args->xdata);
- break;
- case GF_FOP_LK:
- CLIENT_PRE_FOP(lk, this, &this_req->compound_req_u.compound_lk_req,
- op_errno, out, args->cmd, &args->lock, args->fd,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->owner = frame->root->lk_owner;
- break;
- case GF_FOP_LOOKUP:
- CLIENT_PRE_FOP(lookup, this,
- &this_req->compound_req_u.compound_lookup_req,
- op_errno, out, &args->loc, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_READDIR:
- CLIENT_PRE_FOP(
- readdir, this, &this_req->compound_req_u.compound_readdir_req,
- op_errno, out, args->fd, args->size, args->offset, args->xdata);
- break;
- case GF_FOP_INODELK:
- CLIENT_PRE_FOP(inodelk, this,
- &this_req->compound_req_u.compound_inodelk_req,
- op_errno, out, &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
- break;
- case GF_FOP_FINODELK:
- CLIENT_PRE_FOP(finodelk, this,
- &this_req->compound_req_u.compound_finodelk_req,
- op_errno, out, args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_PRE_FOP(
- entrylk, this, &this_req->compound_req_u.compound_entrylk_req,
- op_errno, out, &args->loc, args->entrylkcmd, args->entrylktype,
- args->volume, args->name, args->xdata);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_PRE_FOP(
- fentrylk, this, &this_req->compound_req_u.compound_fentrylk_req,
- op_errno, out, args->fd, args->entrylkcmd, args->entrylktype,
- args->volume, args->name, args->xdata);
- break;
- case GF_FOP_XATTROP:
- CLIENT_PRE_FOP(xattrop, this,
- &this_req->compound_req_u.compound_xattrop_req,
- op_errno, out, &args->loc, args->xattr, args->optype,
- args->xdata);
- break;
- case GF_FOP_FXATTROP:
- CLIENT_PRE_FOP(fxattrop, this,
- &this_req->compound_req_u.compound_fxattrop_req,
- op_errno, out, args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- break;
- case GF_FOP_FGETXATTR:
- CLIENT_PRE_FOP(fgetxattr, this,
- &this_req->compound_req_u.compound_fgetxattr_req,
- op_errno, out, args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FSETXATTR:
- CLIENT_PRE_FOP(fsetxattr, this,
- &this_req->compound_req_u.compound_fsetxattr_req,
- op_errno, out, args->fd, args->flags, args->xattr,
- args->xdata);
- break;
- case GF_FOP_RCHECKSUM:
- CLIENT_PRE_FOP(rchecksum, this,
- &this_req->compound_req_u.compound_rchecksum_req,
- op_errno, out, args->fd, args->size, args->offset,
- args->xdata);
- break;
- case GF_FOP_SETATTR:
- CLIENT_PRE_FOP(setattr, this,
- &this_req->compound_req_u.compound_setattr_req,
- op_errno, out, &args->loc, args->valid, &args->stat,
- args->xdata);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_PRE_FOP(
- fsetattr, this, &this_req->compound_req_u.compound_fsetattr_req,
- op_errno, out, args->fd, args->valid, &args->stat, args->xdata);
- break;
- case GF_FOP_READDIRP:
- CLIENT_PRE_FOP(
- readdirp, this, &this_req->compound_req_u.compound_readdirp_req,
- op_errno, out, args->fd, args->size, args->offset, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_PRE_FOP(fremovexattr, this,
- &this_req->compound_req_u.compound_fremovexattr_req,
- op_errno, out, args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_PRE_FOP(fallocate, this,
- &this_req->compound_req_u.compound_fallocate_req,
- op_errno, out, args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
- case GF_FOP_DISCARD:
- CLIENT_PRE_FOP(
- discard, this, &this_req->compound_req_u.compound_discard_req,
- op_errno, out, args->fd, args->offset, args->size, args->xdata);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_PRE_FOP(
- zerofill, this, &this_req->compound_req_u.compound_zerofill_req,
- op_errno, out, args->fd, args->offset, args->size, args->xdata);
- break;
- case GF_FOP_IPC:
- CLIENT_PRE_FOP(ipc, this,
- &this_req->compound_req_u.compound_ipc_req, op_errno,
- out, args->cmd, args->xdata);
- break;
- case GF_FOP_SEEK:
- CLIENT_PRE_FOP(
- seek, this, &this_req->compound_req_u.compound_seek_req,
- op_errno, out, args->fd, args->offset, args->what, args->xdata);
- break;
- case GF_FOP_LEASE:
- CLIENT_PRE_FOP(
- lease, this, &this_req->compound_req_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease, args->xdata);
- break;
- default:
- return ENOTSUP;
- }
- return 0;
-out:
- return op_errno;
-}
-
-void
-compound_request_cleanup(gfs3_compound_req *req)
-{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsync);
- break;
- case GF_FOP_SETXATTR: {
- gfs3_setxattr_req *args = &CPD_REQ_FIELD(curr_req, setxattr);
- GF_FREE(args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP: {
- gfs3_xattrop_req *args = &CPD_REQ_FIELD(curr_req, xattrop);
- GF_FREE(args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_req *args = &CPD_REQ_FIELD(curr_req, fxattrop);
- GF_FREE(args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR: {
- gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req, fsetxattr);
- GF_FREE(args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP: {
- gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req, readdirp);
- GF_FREE(args->dict.dict_val);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT_COMPOUND_FOP_CLEANUP(curr_req, seek);
- break;
- default:
- break;
- }
- }
-
- GF_FREE(req->compound_req_array.compound_req_array_val);
- return;
-}
-
void
clnt_getactivelk_rsp_cleanup(gfs3_getactivelk_rsp *rsp)
{
@@ -1668,7 +537,7 @@ clnt_unserialize_rsp_locklist(xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
while (trav) {
temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
if (temp == NULL) {
- gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_NO_MEM, NULL);
goto out;
}
@@ -1708,7 +577,7 @@ clnt_unserialize_rsp_locklist_v2(xlator_t *this,
while (trav) {
temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
if (temp == NULL) {
- gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_NO_MEM, NULL);
goto out;
}
@@ -1792,8 +661,8 @@ serialize_req_locklist(lock_migration_info_t *locklist,
break;
default:
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PC_MSG_UNKNOWN_LOCK_TYPE,
+ "type=%" PRId32, tmp->flock.l_type, NULL);
break;
}
@@ -1803,8 +672,8 @@ serialize_req_locklist(lock_migration_info_t *locklist,
trav->client_uid = gf_strdup(tmp->client_uid);
if (!trav->client_uid) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PC_MSG_CLIENT_UID_ALLOC_FAILED,
+ NULL);
ret = -1;
goto out;
}
@@ -1855,8 +724,8 @@ serialize_req_locklist_v2(lock_migration_info_t *locklist,
break;
default:
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PC_MSG_UNKNOWN_LOCK_TYPE,
+ "type=%" PRId32, tmp->flock.l_type, NULL);
break;
}
@@ -1866,8 +735,8 @@ serialize_req_locklist_v2(lock_migration_info_t *locklist,
trav->client_uid = gf_strdup(tmp->client_uid);
if (!trav->client_uid) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PC_MSG_CLIENT_UID_ALLOC_FAILED,
+ NULL);
ret = -1;
goto out;
}
@@ -1888,1130 +757,6 @@ out:
return ret;
}
-void
-client_compound_rsp_cleanup(gfs3_compound_rsp *rsp, int len)
-{
- int i = 0;
- compound_rsp *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_FOP_RSP_CLEANUP(rsp, stat, i);
- break;
- case GF_FOP_MKNOD:
- CLIENT_FOP_RSP_CLEANUP(rsp, mknod, i);
- break;
- case GF_FOP_MKDIR:
- CLIENT_FOP_RSP_CLEANUP(rsp, mkdir, i);
- break;
- case GF_FOP_UNLINK:
- CLIENT_FOP_RSP_CLEANUP(rsp, unlink, i);
- break;
- case GF_FOP_RMDIR:
- CLIENT_FOP_RSP_CLEANUP(rsp, rmdir, i);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_FOP_RSP_CLEANUP(rsp, symlink, i);
- break;
- case GF_FOP_RENAME:
- CLIENT_FOP_RSP_CLEANUP(rsp, rename, i);
- break;
- case GF_FOP_LINK:
- CLIENT_FOP_RSP_CLEANUP(rsp, link, i);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_FOP_RSP_CLEANUP(rsp, truncate, i);
- break;
- case GF_FOP_OPEN:
- CLIENT_FOP_RSP_CLEANUP(rsp, open, i);
- break;
- case GF_FOP_READ:
- CLIENT_FOP_RSP_CLEANUP(rsp, read, i);
- break;
- case GF_FOP_WRITE:
- CLIENT_FOP_RSP_CLEANUP(rsp, write, i);
- break;
- case GF_FOP_STATFS:
- CLIENT_FOP_RSP_CLEANUP(rsp, statfs, i);
- break;
- case GF_FOP_FSYNC:
- CLIENT_FOP_RSP_CLEANUP(rsp, fsync, i);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_FOP_RSP_CLEANUP(rsp, opendir, i);
- break;
- case GF_FOP_CREATE:
- CLIENT_FOP_RSP_CLEANUP(rsp, create, i);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_FOP_RSP_CLEANUP(rsp, ftruncate, i);
- break;
- case GF_FOP_FSTAT:
- CLIENT_FOP_RSP_CLEANUP(rsp, fstat, i);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_FOP_RSP_CLEANUP(rsp, lookup, i);
- break;
- case GF_FOP_SETATTR:
- CLIENT_FOP_RSP_CLEANUP(rsp, setattr, i);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_FOP_RSP_CLEANUP(rsp, fsetattr, i);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_FOP_RSP_CLEANUP(rsp, fallocate, i);
- break;
- case GF_FOP_DISCARD:
- CLIENT_FOP_RSP_CLEANUP(rsp, discard, i);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_FOP_RSP_CLEANUP(rsp, zerofill, i);
- break;
- case GF_FOP_IPC:
- CLIENT_FOP_RSP_CLEANUP(rsp, ipc, i);
- break;
- case GF_FOP_SEEK:
- CLIENT_FOP_RSP_CLEANUP(rsp, seek, i);
- break;
- case GF_FOP_LEASE:
- CLIENT_FOP_RSP_CLEANUP(rsp, lease, i);
- break;
- /* fops that use gf_common_rsp */
- case GF_FOP_FLUSH:
- CLIENT_COMMON_RSP_CLEANUP(rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- CLIENT_COMMON_RSP_CLEANUP(rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP(rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- CLIENT_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMMON_RSP_CLEANUP(rsp, access, i);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMMON_RSP_CLEANUP(rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMMON_RSP_CLEANUP(rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP(rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_LK: {
- CLIENT_FOP_RSP_CLEANUP(rsp, lk, i);
- gfs3_lk_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, lk);
- free(tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK: {
- CLIENT_FOP_RSP_CLEANUP(rsp, readlink, i);
- gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readlink);
- free(tmp_rsp->path);
- break;
- }
- case GF_FOP_XATTROP: {
- CLIENT_FOP_RSP_CLEANUP(rsp, xattrop, i);
- gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, xattrop);
- free(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FXATTROP: {
- CLIENT_FOP_RSP_CLEANUP(rsp, fxattrop, i);
- gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, fxattrop);
- free(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_READDIR: {
- CLIENT_FOP_RSP_CLEANUP(rsp, readdir, i);
- gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdir);
- clnt_readdir_rsp_cleanup(tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP: {
- CLIENT_FOP_RSP_CLEANUP(rsp, readdirp, i);
- gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdirp);
- clnt_readdirp_rsp_cleanup(tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR: {
- CLIENT_FOP_RSP_CLEANUP(rsp, getxattr, i);
- gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, getxattr);
- free(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FGETXATTR: {
- CLIENT_FOP_RSP_CLEANUP(rsp, fgetxattr, i);
- gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fgetxattr);
- free(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- CLIENT_FOP_RSP_CLEANUP(rsp, rchecksum, i);
- gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp, rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free(rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
- }
- }
- return;
-}
-
-/* compound v2 */
-int
-client_handle_fop_requirements_v2(
- xlator_t *this, call_frame_t *frame, gfx_compound_req *req,
- clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
- struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args, int fop_enum, int index)
-{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req_v2 *this_req = &req->compound_req_array
- .compound_req_array_val[index];
-
- this_req->fop_enum = fop_enum;
-
- switch (fop_enum) {
- case GF_FOP_STAT:
- CLIENT4_PRE_FOP(stat, this,
- &this_req->compound_req_v2_u.compound_stat_req,
- op_errno, out, &args->loc, args->xdata);
- break;
- case GF_FOP_READLINK:
- CLIENT4_PRE_FOP(readlink, this,
- &this_req->compound_req_v2_u.compound_readlink_req,
- op_errno, out, &args->loc, args->size, args->xdata);
- break;
- case GF_FOP_MKNOD:
- CLIENT4_PRE_FOP(mknod, this,
- &this_req->compound_req_v2_u.compound_mknod_req,
- op_errno, out, &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_MKDIR:
- CLIENT4_PRE_FOP(mkdir, this,
- &this_req->compound_req_v2_u.compound_mkdir_req,
- op_errno, out, &args->loc, args->mode, args->umask,
- args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_UNLINK:
- CLIENT4_PRE_FOP(
- unlink, this, &this_req->compound_req_v2_u.compound_unlink_req,
- op_errno, out, &args->loc, args->xflag, args->xdata);
- break;
- case GF_FOP_RMDIR:
- CLIENT4_PRE_FOP(
- rmdir, this, &this_req->compound_req_v2_u.compound_rmdir_req,
- op_errno, out, &args->loc, args->flags, args->xdata);
- break;
- case GF_FOP_SYMLINK:
- CLIENT4_PRE_FOP(symlink, this,
- &this_req->compound_req_v2_u.compound_symlink_req,
- op_errno, out, &args->loc, args->linkname,
- args->umask, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_RENAME:
- CLIENT4_PRE_FOP(
- rename, this, &this_req->compound_req_v2_u.compound_rename_req,
- op_errno, out, &args->loc, &args->loc2, args->xdata);
- break;
- case GF_FOP_LINK:
- CLIENT4_PRE_FOP(
- link, this, &this_req->compound_req_v2_u.compound_link_req,
- op_errno, out, &args->loc, &args->loc2, args->xdata);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT4_PRE_FOP(truncate, this,
- &this_req->compound_req_v2_u.compound_truncate_req,
- op_errno, out, &args->loc, args->offset,
- args->xdata);
- break;
- case GF_FOP_OPEN:
- CLIENT4_PRE_FOP(
- open, this, &this_req->compound_req_v2_u.compound_open_req,
- op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- break;
- case GF_FOP_READ:
- op_errno = client_pre_readv_v2(
- this, &this_req->compound_req_v2_u.compound_read_req, args->fd,
- args->size, args->offset, args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
-
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
- iobref_add(*rsp_iobref, rsp_iobuf);
- iobuf_unref(rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
- }
- *rsp_count += 1;
-
- break;
- case GF_FOP_WRITE:
- op_errno = client_pre_writev_v2(
- this, &this_req->compound_req_v2_u.compound_write_req, args->fd,
- iov_length(args->vector, args->count), args->offset,
- args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy(&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
-
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else if (iobref_merge(*req_iobref, args->iobref))
- goto out;
- break;
- case GF_FOP_STATFS:
- CLIENT4_PRE_FOP(statfs, this,
- &this_req->compound_req_v2_u.compound_statfs_req,
- op_errno, out, &args->loc, args->xdata);
- break;
- case GF_FOP_FLUSH:
- CLIENT4_PRE_FOP(flush, this,
- &this_req->compound_req_v2_u.compound_flush_req,
- op_errno, out, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->owner = frame->root->lk_owner;
- break;
- case GF_FOP_FSYNC:
- CLIENT4_PRE_FOP(
- fsync, this, &this_req->compound_req_v2_u.compound_fsync_req,
- op_errno, out, args->fd, args->datasync, args->xdata);
- break;
- case GF_FOP_SETXATTR:
- CLIENT4_PRE_FOP(setxattr, this,
- &this_req->compound_req_v2_u.compound_setxattr_req,
- op_errno, out, &args->loc, args->xattr, args->flags,
- args->xdata);
- break;
- case GF_FOP_GETXATTR:
- CLIENT4_PRE_FOP(getxattr, this,
- &this_req->compound_req_v2_u.compound_getxattr_req,
- op_errno, out, &args->loc, args->name, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT4_PRE_FOP(
- removexattr, this,
- &this_req->compound_req_v2_u.compound_removexattr_req, op_errno,
- out, &args->loc, args->name, args->xdata);
- break;
- case GF_FOP_OPENDIR:
- CLIENT4_PRE_FOP(opendir, this,
- &this_req->compound_req_v2_u.compound_opendir_req,
- op_errno, out, &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT4_PRE_FOP(fsyncdir, this,
- &this_req->compound_req_v2_u.compound_fsyncdir_req,
- op_errno, out, args->fd, args->datasync,
- args->xdata);
- break;
- case GF_FOP_ACCESS:
- CLIENT4_PRE_FOP(access, this,
- &this_req->compound_req_v2_u.compound_access_req,
- op_errno, out, &args->loc, args->mask, args->xdata);
- break;
- case GF_FOP_CREATE:
- CLIENT4_PRE_FOP(create, this,
- &this_req->compound_req_v2_u.compound_create_req,
- op_errno, out, &args->loc, args->fd, args->mode,
- args->flags, args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
-
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT4_PRE_FOP(ftruncate, this,
- &this_req->compound_req_v2_u.compound_ftruncate_req,
- op_errno, out, args->fd, args->offset, args->xdata);
- break;
- case GF_FOP_FSTAT:
- CLIENT4_PRE_FOP(fstat, this,
- &this_req->compound_req_v2_u.compound_fstat_req,
- op_errno, out, args->fd, args->xdata);
- break;
- case GF_FOP_LK:
- CLIENT4_PRE_FOP(
- lk, this, &this_req->compound_req_v2_u.compound_lk_req,
- op_errno, out, args->cmd, &args->lock, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->owner = frame->root->lk_owner;
- break;
- case GF_FOP_LOOKUP:
- CLIENT4_PRE_FOP(lookup, this,
- &this_req->compound_req_v2_u.compound_lookup_req,
- op_errno, out, &args->loc, args->xdata);
- loc_copy(&local->loc, &args->loc);
- loc_path(&local->loc, NULL);
- break;
- case GF_FOP_READDIR:
- CLIENT4_PRE_FOP(readdir, this,
- &this_req->compound_req_v2_u.compound_readdir_req,
- op_errno, out, args->fd, args->size, args->offset,
- args->xdata);
- break;
- case GF_FOP_INODELK:
- CLIENT4_PRE_FOP(inodelk, this,
- &this_req->compound_req_v2_u.compound_inodelk_req,
- op_errno, out, &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
- break;
- case GF_FOP_FINODELK:
- CLIENT4_PRE_FOP(finodelk, this,
- &this_req->compound_req_v2_u.compound_finodelk_req,
- op_errno, out, args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT4_PRE_FOP(entrylk, this,
- &this_req->compound_req_v2_u.compound_entrylk_req,
- op_errno, out, &args->loc, args->entrylkcmd,
- args->entrylktype, args->volume, args->name,
- args->xdata);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT4_PRE_FOP(fentrylk, this,
- &this_req->compound_req_v2_u.compound_fentrylk_req,
- op_errno, out, args->fd, args->entrylkcmd,
- args->entrylktype, args->volume, args->name,
- args->xdata);
- break;
- case GF_FOP_XATTROP:
- CLIENT4_PRE_FOP(xattrop, this,
- &this_req->compound_req_v2_u.compound_xattrop_req,
- op_errno, out, &args->loc, args->xattr,
- args->optype, args->xdata);
- break;
- case GF_FOP_FXATTROP:
- CLIENT4_PRE_FOP(fxattrop, this,
- &this_req->compound_req_v2_u.compound_fxattrop_req,
- op_errno, out, args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- local->attempt_reopen = client_is_reopen_needed(args->fd, this,
- remote_fd);
- break;
- case GF_FOP_FGETXATTR:
- CLIENT4_PRE_FOP(fgetxattr, this,
- &this_req->compound_req_v2_u.compound_fgetxattr_req,
- op_errno, out, args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FSETXATTR:
- CLIENT4_PRE_FOP(fsetxattr, this,
- &this_req->compound_req_v2_u.compound_fsetxattr_req,
- op_errno, out, args->fd, args->flags, args->xattr,
- args->xdata);
- break;
- case GF_FOP_RCHECKSUM:
- CLIENT4_PRE_FOP(rchecksum, this,
- &this_req->compound_req_v2_u.compound_rchecksum_req,
- op_errno, out, args->fd, args->size, args->offset,
- args->xdata);
- break;
- case GF_FOP_SETATTR:
- CLIENT4_PRE_FOP(setattr, this,
- &this_req->compound_req_v2_u.compound_setattr_req,
- op_errno, out, &args->loc, args->valid, &args->stat,
- args->xdata);
- break;
- case GF_FOP_FSETATTR:
- CLIENT4_PRE_FOP(fsetattr, this,
- &this_req->compound_req_v2_u.compound_fsetattr_req,
- op_errno, out, args->fd, args->valid, &args->stat,
- args->xdata);
- break;
- case GF_FOP_READDIRP:
- CLIENT4_PRE_FOP(readdirp, this,
- &this_req->compound_req_v2_u.compound_readdirp_req,
- op_errno, out, args->fd, args->size, args->offset,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref(args->fd);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT4_PRE_FOP(
- fremovexattr, this,
- &this_req->compound_req_v2_u.compound_fremovexattr_req,
- op_errno, out, args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT4_PRE_FOP(fallocate, this,
- &this_req->compound_req_v2_u.compound_fallocate_req,
- op_errno, out, args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
- case GF_FOP_DISCARD:
- CLIENT4_PRE_FOP(discard, this,
- &this_req->compound_req_v2_u.compound_discard_req,
- op_errno, out, args->fd, args->offset, args->size,
- args->xdata);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT4_PRE_FOP(zerofill, this,
- &this_req->compound_req_v2_u.compound_zerofill_req,
- op_errno, out, args->fd, args->offset, args->size,
- args->xdata);
- break;
- case GF_FOP_IPC:
- CLIENT4_PRE_FOP(ipc, this,
- &this_req->compound_req_v2_u.compound_ipc_req,
- op_errno, out, args->cmd, args->xdata);
- break;
- case GF_FOP_SEEK:
- CLIENT4_PRE_FOP(
- seek, this, &this_req->compound_req_v2_u.compound_seek_req,
- op_errno, out, args->fd, args->offset, args->what, args->xdata);
- break;
- case GF_FOP_LEASE:
- CLIENT4_PRE_FOP(
- lease, this, &this_req->compound_req_v2_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease, args->xdata);
- break;
- default:
- return ENOTSUP;
- }
- return 0;
-out:
- return op_errno;
-}
-
-void
-compound_request_cleanup_v2(gfx_compound_req *req)
-{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req_v2 *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsync);
- break;
- case GF_FOP_SETXATTR: {
- gfx_setxattr_req *args = &CPD4_REQ_FIELD(curr_req, setxattr);
- GF_FREE(args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP: {
- gfx_xattrop_req *args = &CPD4_REQ_FIELD(curr_req, xattrop);
- GF_FREE(args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfx_fxattrop_req *args = &CPD4_REQ_FIELD(curr_req, fxattrop);
- GF_FREE(args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR: {
- gfx_fsetxattr_req *args = &CPD4_REQ_FIELD(curr_req, fsetxattr);
- GF_FREE(args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdirp);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, seek);
- break;
- default:
- break;
- }
- }
-
- GF_FREE(req->compound_req_array.compound_req_array_val);
- return;
-}
-
-void
-client_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, int len)
-{
- int i = 0;
- compound_rsp_v2 *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- /* fops that need extra cleanup */
- case GF_FOP_LK: {
- gfx_lk_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, lk);
- free(tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK: {
- gfx_readlink_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readlink);
- free(tmp_rsp->path);
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdir);
- clnt_readdir_rsp_cleanup_v2(tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdirp);
- clnt_readdirp_rsp_cleanup_v2(tmp_rsp);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfx_rchecksum_rsp *rck = &CPD4_RSP_FIELD(this_rsp, rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free(rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
- }
- }
- return;
-}
-
-int
-client_process_response_v2(call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfx_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk, int index)
-{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {
- {0},
- };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp_v2 *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD(&entries.list);
-
- switch (args_cbk->enum_list[index]) {
- case GF_FOP_STAT:
- case GF_FOP_FSTAT: {
- gfx_common_iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
-
- client_post_common_iatt(this, tmp_rsp, &this_args_cbk->stat,
- &xdata);
-
- CLIENT4_POST_FOP_TYPE(stat, common_iatt, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
- }
- case GF_FOP_READLINK: {
- gfx_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
-
- gfx_stat_to_iattx(&tmp_rsp->buf, &this_args_cbk->stat);
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE(readlink, readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat, xdata);
- break;
- }
- case GF_FOP_MKDIR:
- case GF_FOP_MKNOD:
- case GF_FOP_SYMLINK:
- case GF_FOP_LINK: {
- gfx_common_3iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
-
- client_post_common_3iatt(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE(mknod, common_3iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_UNLINK:
- case GF_FOP_RMDIR: {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
-
- client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE(unlink, common_2iatt, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_RENAME: {
- gfx_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
-
- client_post_rename_v2(
- this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT4_POST_FOP_TYPE(
- rename, rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
- break;
- }
- case GF_FOP_WRITE:
- case GF_FOP_TRUNCATE:
- case GF_FOP_FTRUNCATE:
- case GF_FOP_FSYNC:
- case GF_FOP_ZEROFILL:
- case GF_FOP_DISCARD:
- case GF_FOP_FALLOCATE:
- case GF_FOP_FSETATTR:
- case GF_FOP_SETATTR: {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
-
- client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT4_POST_FOP_TYPE(truncate, common_2iatt, this_rsp,
- this_args_cbk, &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN: {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE(open, open, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_READ: {
- gfx_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
-
- client_post_readv_v2(this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat, vector,
- &req->rsp[1], &this_args_cbk->count, &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
-
- args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno(tmp_rsp->op_errno), vector,
- this_args_cbk->count, &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
-
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen(local->fd, this);
-
- break;
- }
- case GF_FOP_STATFS: {
- gfx_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
-
- gf_statfs_to_statfs(&tmp_rsp->statfs, &this_args_cbk->statvfs);
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE(statfs, statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH: {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner(local->fd, &local->owner);
- gf_msg_trace(this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa(&local->owner), ret);
- }
- break;
- }
- case GF_FOP_FSYNCDIR:
- case GF_FOP_ACCESS:
- case GF_FOP_REMOVEXATTR:
- case GF_FOP_FREMOVEXATTR:
- case GF_FOP_FSETXATTR:
- case GF_FOP_SETXATTR:
- case GF_FOP_INODELK:
- case GF_FOP_FINODELK:
- case GF_FOP_ENTRYLK:
- case GF_FOP_FENTRYLK:
- case GF_FOP_IPC: {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_setxattr_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_GETXATTR:
- case GF_FOP_FGETXATTR:
- case GF_FOP_XATTROP:
- case GF_FOP_FXATTROP: {
- gfx_common_dict_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
-
- client_post_common_dict(this, tmp_rsp, &xattr, &xdata);
-
- CLIENT4_POST_FOP_TYPE(getxattr, common_dict, this_rsp,
- this_args_cbk, xattr, xdata);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_opendir_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE(opendir, open, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_CREATE: {
- gfx_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
-
- client_post_create_v2(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT4_POST_FOP_TYPE(
- create, create, this_rsp, this_args_cbk, local->fd,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_LK: {
- gfx_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
-
- client_post_lk_v2(this, tmp_rsp, &this_args_cbk->lock, &xdata);
-
- CLIENT4_POST_FOP_TYPE(lk, lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
-
- client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE(lookup, common_2iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat, xdata,
- &this_args_cbk->postparent);
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
-
- client_post_readdir_v2(this, tmp_rsp, &entries, &xdata);
-
- CLIENT4_POST_FOP_TYPE(readdir, readdir, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfx_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE(
- rchecksum, rchecksum, this_rsp, this_args_cbk,
- tmp_rsp->weak_checksum,
- (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
-
- client_post_readdirp_v2(this, tmp_rsp, local->fd, &entries, &xdata);
-
- CLIENT4_POST_FOP_TYPE(readdirp, readdirp, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
- }
- case GF_FOP_SEEK: {
- gfx_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
-
- xdr_to_dict(&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE(seek, seek, this_rsp, this_args_cbk,
- tmp_rsp->offset, xdata);
- break;
- }
- case GF_FOP_LEASE: {
- gfx_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
-
- client_post_lease_v2(this, tmp_rsp, &this_args_cbk->lease, &xdata);
-
- CLIENT4_POST_FOP_TYPE(lease, lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
- }
- default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref(xdata);
- if (xattr)
- dict_unref(xattr);
- gf_dirent_free(&entries);
- return 0;
-}
-
extern int
client3_3_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe);
@@ -3043,8 +788,7 @@ send_release4_0_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
gf_msg_trace(this->name, 0, "sending releasedir on fd");
(void)client_submit_request(
this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
- client4_0_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_releasedir_req);
+ client4_0_releasedir_cbk, NULL, (xdrproc_t)xdr_gfx_releasedir_req);
} else {
gfx_release_req req = {
{
@@ -3055,8 +799,8 @@ send_release4_0_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
req.fd = fdctx->remote_fd;
gf_msg_trace(this->name, 0, "sending release on fd");
(void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
- client4_0_release_cbk, NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfx_release_req);
+ client4_0_release_cbk, NULL,
+ (xdrproc_t)xdr_gfx_release_req);
}
return 0;
@@ -3079,8 +823,7 @@ send_release3_3_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
gf_msg_trace(this->name, 0, "sending releasedir on fd");
(void)client_submit_request(
this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
- client3_3_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
+ client3_3_releasedir_cbk, NULL, (xdrproc_t)xdr_gfs3_releasedir_req);
} else {
gfs3_release_req req = {
{
@@ -3091,8 +834,8 @@ send_release3_3_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
req.fd = fdctx->remote_fd;
gf_msg_trace(this->name, 0, "sending release on fd");
(void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
- client3_3_release_cbk, NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfs3_release_req);
+ client3_3_release_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_release_req);
}
return 0;
diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c
index 48f32116de9..795839734c5 100644
--- a/xlators/protocol/client/src/client-lk.c
+++ b/xlators/protocol/client/src/client-lk.c
@@ -8,10 +8,10 @@
cases as published by the Free Software Foundation.
*/
-#include "common-utils.h"
-#include "xlator.h"
+#include <glusterfs/common-utils.h>
+#include <glusterfs/xlator.h>
#include "client.h"
-#include "lkowner.h"
+#include <glusterfs/lkowner.h>
#include "client-messages.h"
static void
@@ -24,14 +24,12 @@ __dump_client_lock(client_posix_lock_t *lock)
this = THIS;
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
- "{fd=%p}"
- "{%s lk-owner:%s %" PRId64 " - %" PRId64
- "}"
- "{start=%" PRId64 " end=%" PRId64 "}",
- lock->fd, lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
- lkowner_utoa(&lock->owner), lock->user_flock.l_start,
- lock->user_flock.l_len, lock->fl_start, lock->fl_end);
+ gf_smsg(
+ this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO, "fd=%p", lock->fd,
+ "fl_type=%s", lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
+ "lk-owner=%s", lkowner_utoa(&lock->owner), "l_start=%" PRId64,
+ lock->user_flock.l_start, "l_len=%" PRId64, lock->user_flock.l_len,
+ "start=%" PRId64, lock->fl_start, "end=%" PRId64, lock->fl_end, NULL);
}
static int
@@ -203,9 +201,7 @@ subtract_locks(client_posix_lock_t *big, client_posix_lock_t *small)
memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
} else {
/* LOG-TODO : decide what more info is required here*/
- gf_msg("client-protocol", GF_LOG_CRITICAL, 0, PC_MSG_LOCK_ERROR,
- "Unexpected case in subtract_locks. Please send "
- "a bug report to gluster-devel@gluster.org");
+ gf_smsg("client-protocol", GF_LOG_CRITICAL, 0, PC_MSG_LOCK_ERROR, NULL);
}
return v;
@@ -343,15 +339,15 @@ delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner)
if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock);
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
- "fdctx not valid");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
+ NULL);
ret = -1;
goto out;
}
list_for_each_entry_safe(lock, tmp, &fdctx->lock_list, list)
{
- if (!is_same_lkowner(&lock->owner, owner)) {
+ if (is_same_lkowner(&lock->owner, owner)) {
list_del_init(&lock->list);
list_add_tail(&lock->list, &delete_list);
count++;
@@ -360,10 +356,12 @@ delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner)
pthread_spin_unlock(&conf->fd_lock);
- list_for_each_entry_safe(lock, tmp, &delete_list, list)
- {
- list_del_init(&lock->list);
- destroy_client_lock(lock);
+ if (!list_empty(&delete_list)) {
+ list_for_each_entry_safe(lock, tmp, &delete_list, list)
+ {
+ list_del_init(&lock->list);
+ destroy_client_lock(lock);
+ }
}
/* FIXME: Need to actually print the locks instead of count */
@@ -459,8 +457,7 @@ client_add_lock_for_recovery(fd_t *fd, struct gf_flock *flock,
if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock);
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
- "failed to get fd context. sending EBADFD");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL, NULL);
ret = -EBADFD;
goto out;
}
@@ -496,8 +493,8 @@ client_dump_locks(char *name, inode_t *inode, dict_t *dict)
ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
if (ret) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "could not set dict with %s", CLIENT_DUMP_LOCKS);
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAIL, "lock=%s",
+ CLIENT_DUMP_LOCKS, NULL);
goto out;
}
diff --git a/xlators/protocol/client/src/client-mem-types.h b/xlators/protocol/client/src/client-mem-types.h
index bf01a90abb9..f61fa0c1828 100644
--- a/xlators/protocol/client/src/client-mem-types.h
+++ b/xlators/protocol/client/src/client-mem-types.h
@@ -11,7 +11,7 @@
#ifndef __CLIENT_MEM_TYPES_H__
#define __CLIENT_MEM_TYPES_H__
-#include "mem-types.h"
+#include <glusterfs/mem-types.h>
enum gf_client_mem_types_ {
gf_client_mt_clnt_conf_t = gf_common_mt_end + 1,
@@ -19,7 +19,6 @@ enum gf_client_mem_types_ {
gf_client_mt_clnt_fdctx_t,
gf_client_mt_clnt_lock_t,
gf_client_mt_clnt_fd_lk_local_t,
- gf_client_mt_clnt_args_t,
gf_client_mt_compound_req_t,
gf_client_mt_clnt_lock_request_t,
gf_client_mt_end,
diff --git a/xlators/protocol/client/src/client-messages.h b/xlators/protocol/client/src/client-messages.h
index 879d53741d1..25a851d80b9 100644
--- a/xlators/protocol/client/src/client-messages.h
+++ b/xlators/protocol/client/src/client-messages.h
@@ -11,7 +11,7 @@
#ifndef _PC_MESSAGES_H__
#define _PC_MESSAGES_H__
-#include "glfs-message-id.h"
+#include <glusterfs/glfs-message-id.h>
/* To add new message IDs, append new identifiers at the end of the list.
*
@@ -48,6 +48,127 @@ GLFS_MSGID(
PC_MSG_VERSION_ERROR, PC_MSG_DIR_OP_SUCCESS, PC_MSG_BAD_FD,
PC_MSG_CLIENT_LOCK_INFO, PC_MSG_CACHE_INVALIDATION_FAIL,
PC_MSG_CHILD_STATUS, PC_MSG_GFID_NULL, PC_MSG_RECALL_LEASE_FAIL,
- PC_MSG_INODELK_CONTENTION_FAIL, PC_MSG_ENTRYLK_CONTENTION_FAIL);
+ PC_MSG_INODELK_CONTENTION_FAIL, PC_MSG_ENTRYLK_CONTENTION_FAIL,
+ PC_MSG_BIGGER_SIZE, PC_MSG_CLIENT_DUMP_LOCKS_FAILED, PC_MSG_UNKNOWN_CMD,
+ PC_MSG_REOPEN_FAILED, PC_MSG_FIND_KEY_FAILED, PC_MSG_VOL_ID_CHANGED,
+ PC_MSG_GETHOSTNAME_FAILED, PC_MSG_VOLFILE_KEY_SET_FAILED,
+ PC_MSG_VOLFILE_CHECKSUM_FAILED, PC_MSG_FRAME_NOT_FOUND,
+ PC_MSG_REMOTE_SUBVOL_SET_FAIL, PC_MSG_HANDSHAKE_PGM_NOT_FOUND,
+ PC_MSG_MERGE_IOBREF_FAILED, PC_MSG_ADD_IOBUF_FAILED,
+ PC_MSG_RELEASE_DIR_OP_FAILED, PC_MSG_REMOTE_HOST_SET_FAILED,
+ PC_MSG_REMOTE_PORT_SET_FAILED, PC_MSG_REMOTE_HOST_NOT_SET,
+ PC_MSG_NOREMOTE_HOST, PC_MSG_REMOTE_SUBVOL_NOT_GIVEN,
+ PC_MSG_FATAL_CLIENT_PROTOCOL, PC_MSG_VOL_DANGLING,
+ PC_MSG_CREATE_MEM_POOL_FAILED, PC_MSG_PVT_XLATOR_NULL, PC_MSG_XLATOR_NULL,
+ PC_MSG_LEASE_FOP_FAILED, PC_MSG_DICT_SET_FAIL, PC_MSG_NO_MEM,
+ PC_MSG_UNKNOWN_LOCK_TYPE, PC_MSG_CLIENT_UID_ALLOC_FAILED);
+
+#define PC_MSG_REMOTE_OP_FAILED_STR "remote operation failed."
+#define PC_MSG_XDR_DECODING_FAILED_STR "XDR decoding failed"
+#define PC_MSG_FOP_SEND_FAILED_STR "failed to send the fop"
+#define PC_MSG_BIGGER_SIZE_STR "read-size is bigger than iobuf isze"
+#define PC_MSG_CLIENT_DUMP_LOCKS_FAILED_STR "client dump locks failed"
+#define PC_MSG_UNKNOWN_CMD_STR "Unknown cmd"
+#define PC_MSG_CHILD_UP_NOTIFY_FAILED_STR "notify of CHILD_UP failed"
+#define PC_MSG_CHILD_STATUS_STR \
+ "Defering sending CHILD_UP message as the client translators are not yet " \
+ "ready to serve"
+#define PC_MSG_CHILD_UP_NOTIFY_STR "last fd open'd - notifying CHILD_UP"
+#define PC_MSG_RPC_STATUS_ERROR_STR \
+ "received RPC status error, returning ENOTCONN"
+#define PC_MSG_REOPEN_FAILED_STR "reopen failed"
+#define PC_MSG_DIR_OP_SUCCESS_STR "reopen dir succeeded"
+#define PC_MSG_DIR_OP_FAILED_STR "failed to send the re-opendir request"
+#define PC_MSG_CHILD_UP_NOTIFY_DELAY_STR \
+ "fds open - Delaying child_up until they are re-opened"
+#define PC_MSG_VOL_SET_FAIL_STR "failed to set the volume"
+#define PC_MSG_DICT_UNSERIALIZE_FAIL_STR "failed to unserialize buffer to dict"
+#define PC_MSG_DICT_GET_FAILED_STR "failed to get from reply dict"
+#define PC_MSG_SETVOLUME_FAIL_STR "SETVOLUME on remote-host failed"
+#define PC_MSG_VOLFILE_NOTIFY_FAILED_STR "notify of VOLFILE_MODIFIED failed"
+#define PC_MSG_FIND_KEY_FAILED_STR "failed to find key in the options"
+#define PC_MSG_VOL_ID_CHANGED_STR \
+ "volume-id changed, can't connect to server. Needs remount"
+#define PC_MSG_REMOTE_VOL_CONNECTED_STR "Connected, attached to remote volume"
+#define PC_MSG_AUTH_FAILED_STR "sending AUTH_FAILED event"
+#define PC_MSG_AUTH_FAILED_NOTIFY_FAILED_STR "notify of AUTH_FAILED failed"
+#define PC_MSG_CHILD_CONNECTING_EVENT_STR "sending CHILD_CONNECTING event"
+#define PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED_STR \
+ "notify of CHILD_CONNECTING failed"
+#define PC_MSG_DICT_SET_FAILED_STR "failed to set in handshake msg"
+#define PC_MSG_GETHOSTNAME_FAILED_STR "gethostname: failed"
+#define PC_MSG_PROCESS_UUID_SET_FAIL_STR \
+ "asprintf failed while setting process_uuid"
+#define PC_MSG_VOLFILE_KEY_SET_FAILED_STR "failed to set volfile-key"
+#define PC_MSG_VOLFILE_CHECKSUM_FAILED_STR "failed to set volfile-checksum"
+#define PC_MSG_DICT_SERIALIZE_FAIL_STR "failed to serialize dictionary"
+#define PC_MSG_PGM_NOT_FOUND_STR "xlator not found OR RPC program not found"
+#define PC_MSG_VERSION_INFO_STR "Using Program"
+#define PC_MSG_FRAME_NOT_FOUND_STR "frame not found with rpc request"
+#define PC_MSG_PORT_NUM_ERROR_STR \
+ "failed to get the port number for remote subvolume. Please run gluster " \
+ "volume status on server to see if brick process is running"
+#define PC_MSG_REMOTE_SUBVOL_SET_FAIL_STR "remote-subvolume not set in volfile"
+#define PC_MSG_VERSION_ERROR_STR "failed to get the version from server"
+#define PC_MSG_NO_VERSION_SUPPORT_STR "server doesn't support the version"
+#define PC_MSG_HANDSHAKE_PGM_NOT_FOUND_STR "handshake program not found"
+#define PC_MSG_MERGE_IOBREF_FAILED_STR \
+ "cannot merge iobref passed from caller into new_iobref"
+#define PC_MSG_ADD_IOBUF_FAILED_STR "cannot add iobuf into iobref"
+#define PC_MSG_RELEASE_DIR_OP_FAILED_STR "release dir op failed"
+#define PC_MSG_FILE_OP_FAILED_STR "release fop failed"
+#define PC_MSG_REMOTE_HOST_SET_FAILED_STR "failed to set remote-host"
+#define PC_MSG_REMOTE_PORT_SET_FAILED_STR "failed to set remote-port"
+#define PC_MSG_RPC_INIT_STR "client rpc init command"
+#define PC_MSG_RPC_DESTROY_STR "client rpc destroy command"
+#define PC_MSG_HANDSHAKE_RETURN_STR "handshake msg returned"
+#define PC_MSG_CLIENT_DISCONNECTED_STR \
+ "disconnected from client, process will keep trying to connect glusterd " \
+ "until brick's port is available"
+#define PC_MSG_CHILD_DOWN_NOTIFY_FAILED_STR "CHILD_DOWN notify failed"
+#define PC_MSG_PARENT_UP_STR \
+ "parent translators are ready, attempting connect on transport"
+#define PC_MSG_PARENT_DOWN_STR \
+ "current graph is no longer active, destroying rpc_client"
+#define PC_MSG_REMOTE_HOST_NOT_SET_STR \
+ "Remote host is not set. Assuming the volfile server as remote host"
+#define PC_MSG_NOREMOTE_HOST_STR "No remote host to connect"
+#define PC_MSG_REMOTE_SUBVOL_NOT_GIVEN_STR "option 'remote-subvolume' not given"
+#define PC_MSG_NO_MEMORY_STR "Memory accounting init failed"
+#define PC_MSG_RPC_INVALID_CALL_STR \
+ "RPC destroy called on already destroyed connection"
+#define PC_MSG_RPC_INITED_ALREADY_STR "client rpc already init'ed"
+#define PC_MSG_RPC_INIT_FAILED_STR "failed to initialize RPC"
+#define PC_MSG_RPC_NOTIFY_FAILED_STR "failed to register notify"
+#define PC_MSG_RPC_CBK_FAILED_STR "failed to reister callback program"
+#define PC_MSG_FATAL_CLIENT_PROTOCOL_STR \
+ "FATAL: client protocol, translator cannot have any subvolumes"
+#define PC_MSG_VOL_DANGLING_STR "Volume is dangling"
+#define PC_MSG_CREATE_MEM_POOL_FAILED_STR \
+ "failed to create local_t's memory pool"
+#define PC_MSG_XLATOR_NULL_STR "xlator is NULL"
+#define PC_MSG_PVT_XLATOR_NULL_STR "private structure of the xlator is NULL"
+#define PC_MSG_LEASE_FOP_FAILED_STR "Lease fop failed"
+#define PC_MSG_LOCK_ERROR_STR \
+ "Unexpected case in subtract_locks. Please send a bug report to " \
+ "gluster-devel@gluster.org"
+#define PC_MSG_FD_CTX_INVALID_STR "fdctx not valid"
+#define PC_MSG_FD_GET_FAIL_STR "failed to get fd context. sending EBADFD"
+#define PC_MSG_DICT_SET_FAIL_STR "could not set dict"
+#define PC_MSG_CLIENT_LOCK_INFO_STR "client lock info"
+#define PC_MSG_BAD_FD_STR "remote_fd is -1. EBADFD"
+#define PC_MSG_FUNCTION_CALL_ERROR_STR "this function should not be called"
+#define PC_MSG_RECALL_LEASE_FAIL_STR "XDR decode of recall lease failed"
+#define PC_MSG_CACHE_INVALIDATION_FAIL_STR \
+ "XDR decode of cache_invalidation failed"
+#define PC_MSG_INODELK_CONTENTION_FAIL_STR \
+ "XDR decode of inodelk contention failed"
+#define PC_MSG_ENTRYLK_CONTENTION_FAIL_STR \
+ "XDR decode of entrylk contention failed"
+#define PC_MSG_FD_DUPLICATE_TRY_STR "trying duplicate remote fd set"
+#define PC_MSG_FD_SET_FAIL_STR "failed to set remote-fd"
+#define PC_MSG_NO_MEM_STR "No memory"
+#define PC_MSG_UNKNOWN_LOCK_TYPE_STR "Unknown lock type"
+#define PC_MSG_CLIENT_UID_ALLOC_FAILED_STR "client-uid could not be allocated"
#endif /* !_PC_MESSAGES_H__ */
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 9e5a5b44c69..f402121c15b 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -12,18 +12,27 @@
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "client-messages.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "client-common.h"
-#include "compound-fop-utils.h"
int32_t
client3_getspec(call_frame_t *frame, xlator_t *this, void *data);
rpc_clnt_prog_t clnt3_3_fop_prog;
-/* CBK */
+int
+client_is_setlk(int32_t cmd)
+{
+ if ((cmd == F_SETLK) || (cmd == F_SETLK64) || (cmd == F_SETLKW) ||
+ (cmd == F_SETLKW64)) {
+ return 1;
+ }
+ return 0;
+}
+
+/* CBK */
int
client3_3_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
@@ -61,8 +70,8 @@ client3_3_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -77,10 +86,9 @@ out:
/* no need to print the gfid, because it will be null,
* since symlink operation failed.
*/
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: (%s to %s)", local->loc.path,
- local->loc2.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "loc1=%s", local->loc.path,
+ "loc2=%s", local->loc2.path, NULL);
}
}
@@ -134,8 +142,8 @@ client3_3_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -147,10 +155,10 @@ client3_3_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1 &&
GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s", local->loc.path);
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret,
@@ -202,8 +210,8 @@ client3_3_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -215,10 +223,10 @@ client3_3_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1 &&
GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s", local->loc.path);
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "Path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret,
@@ -332,8 +340,8 @@ client3_3_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -352,11 +360,11 @@ client3_3_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_open(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s (%s)", local->loc.path,
- loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "Path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
}
CLIENT_STACK_UNWIND(open, frame, rsp.op_ret,
@@ -396,8 +404,8 @@ client3_3_stat_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -412,8 +420,8 @@ out:
gf_msg_debug(this->name, 0, "remote operation failed: %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -454,8 +462,8 @@ client3_3_readlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -471,10 +479,8 @@ out:
" %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -523,8 +529,8 @@ client3_3_unlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -540,10 +546,8 @@ out:
" %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -588,8 +592,8 @@ client3_3_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -600,8 +604,8 @@ client3_3_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
CLIENT_STACK_UNWIND(rmdir, frame, rsp.op_ret,
@@ -645,8 +649,8 @@ client3_3_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -656,8 +660,8 @@ client3_3_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(truncate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -697,8 +701,8 @@ client3_3_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -708,8 +712,8 @@ client3_3_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(statfs, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &statfs, xdata);
@@ -754,8 +758,8 @@ client3_3_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_write_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -766,8 +770,8 @@ client3_3_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
goto out;
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret >= 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -809,14 +813,15 @@ client3_3_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
- if (rsp.op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ if ((rsp.op_ret >= 0 || (rsp.op_errno == ENOTCONN)) &&
+ !fd_is_anonymous(local->fd)) {
/* Delete all saved locks of the owner issuing flush */
ret = delete_granted_locks_owner(local->fd, &local->owner);
gf_msg_trace(this->name, 0, "deleting locks of owner (%s) returned %d",
@@ -827,10 +832,9 @@ client3_3_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(flush, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -873,8 +877,8 @@ client3_3_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fsync_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -886,8 +890,8 @@ client3_3_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsync, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -926,8 +930,8 @@ client3_3_setxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -946,10 +950,8 @@ out:
" %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -991,8 +993,8 @@ client3_3_getxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -1016,12 +1018,10 @@ out:
loc_gfid_utoa(&local->loc),
(local->name) ? local->name : "(null)");
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed. Path: %s (%s). Key: %s",
- local->loc.path, loc_gfid_utoa(&local->loc),
- (local->name) ? local->name : "(null)");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, "Path=%s", local->loc.path,
+ "gfid=%s", loc_gfid_utoa(&local->loc), "Key=%s",
+ (local->name) ? local->name : "(null)", NULL);
}
}
@@ -1066,8 +1066,8 @@ client3_3_fgetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -1086,10 +1086,8 @@ out:
gf_msg_debug(this->name, 0, "remote operation failed: %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -1133,8 +1131,8 @@ client3_3_removexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1153,8 +1151,8 @@ out:
else
loglevel = GF_LOG_WARNING;
- gf_msg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(removexattr, frame, rsp.op_ret,
@@ -1192,8 +1190,8 @@ client3_3_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1202,8 +1200,8 @@ client3_3_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_fremovexattr(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fremovexattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1239,8 +1237,8 @@ client3_3_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1250,8 +1248,8 @@ client3_3_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsyncdir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1287,8 +1285,8 @@ client3_3_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1298,8 +1296,8 @@ client3_3_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(access, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1341,8 +1339,8 @@ client3_3_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1352,8 +1350,8 @@ client3_3_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(ftruncate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1393,8 +1391,8 @@ client3_3_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1404,8 +1402,8 @@ client3_3_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fstat, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &stat, xdata);
@@ -1441,8 +1439,8 @@ client3_3_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1451,10 +1449,9 @@ client3_3_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_inodelk(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(inodelk, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1491,8 +1488,8 @@ client3_3_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1501,10 +1498,9 @@ client3_3_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_finodelk(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret == 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -1543,8 +1539,8 @@ client3_3_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1553,10 +1549,9 @@ client3_3_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_entrylk(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(entrylk, frame, rsp.op_ret,
@@ -1593,8 +1588,8 @@ client3_3_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1604,8 +1599,8 @@ client3_3_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fentrylk, frame, rsp.op_ret,
@@ -1646,8 +1641,8 @@ client3_3_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -1661,11 +1656,10 @@ client3_3_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. "
- "Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "Path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
}
CLIENT_STACK_UNWIND(xattrop, frame, rsp.op_ret, gf_error_to_errno(op_errno),
@@ -1714,8 +1708,8 @@ client3_3_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
if (ret < 0) {
rsp.op_ret = -1;
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
goto out;
}
op_errno = rsp.op_errno;
@@ -1728,8 +1722,8 @@ client3_3_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret == 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -1774,8 +1768,8 @@ client3_3_fsetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1792,10 +1786,8 @@ out:
" %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -1838,8 +1830,8 @@ client3_3_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1848,8 +1840,8 @@ client3_3_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_fsetattr(this, &rsp, &prestat, &poststat, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsetattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1892,8 +1884,8 @@ client3_3_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1908,8 +1900,8 @@ client3_3_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fallocate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1952,8 +1944,8 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_discard_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1963,8 +1955,8 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(discard, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -2007,8 +1999,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_zerofill_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2017,8 +2009,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_zerofill(this, &rsp, &prestat, &poststat, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(zerofill, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -2055,8 +2047,8 @@ client3_3_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_ipc_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2065,8 +2057,8 @@ client3_3_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_ipc(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(ipc, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
xdata);
@@ -2102,8 +2094,8 @@ client3_3_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_seek_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2113,8 +2105,8 @@ client3_3_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(seek, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), rsp.offset, xdata);
@@ -2157,8 +2149,8 @@ client3_3_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2168,8 +2160,8 @@ client3_3_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(setattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -2222,8 +2214,8 @@ client3_3_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2245,9 +2237,8 @@ client3_3_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed. Path: %s",
- local->loc.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "Path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(create, frame, rsp.op_ret,
@@ -2286,8 +2277,8 @@ client3_3_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2297,8 +2288,8 @@ client3_3_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(rchecksum, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), rsp.weak_checksum,
@@ -2339,8 +2330,8 @@ client3_3_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
frame = myframe;
if (-1 == req->rpc_status) {
- gf_msg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED,
- "Lease fop failed");
+ gf_smsg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_LEASE_FOP_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -2348,8 +2339,8 @@ client3_3_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lease_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2359,8 +2350,8 @@ client3_3_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(lease, frame, rsp.op_ret,
@@ -2388,10 +2379,12 @@ client3_3_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
int ret = 0;
xlator_t *this = NULL;
dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
this = THIS;
frame = myframe;
+ local = frame->local;
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
@@ -2401,8 +2394,8 @@ client3_3_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2412,12 +2405,24 @@ client3_3_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_lk(this, &rsp, &lock, &xdata);
if (ret < 0)
goto out;
+
+ /* Save the lock to the client lock cache to be able
+ to recover in the case of server reboot.*/
+
+ if (client_is_setlk(local->cmd)) {
+ ret = client_add_lock_for_recovery(local->fd, &lock, &local->owner,
+ local->cmd);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ }
+ }
}
out:
if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(lk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
@@ -2462,8 +2467,8 @@ client3_3_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2473,9 +2478,8 @@ client3_3_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: remote_fd = %d", local->cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote_fd=%d", local->cmd, NULL);
}
CLIENT_STACK_UNWIND(readdir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &entries, xdata);
@@ -2523,8 +2527,8 @@ client3_3_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2533,8 +2537,8 @@ client3_3_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_readdirp(this, &rsp, local->fd, &entries, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(readdirp, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &entries, xdata);
@@ -2591,8 +2595,8 @@ client3_3_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2603,8 +2607,8 @@ client3_3_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(rename, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &stbuf, &preoldparent,
@@ -2656,8 +2660,8 @@ client3_3_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2667,10 +2671,9 @@ client3_3_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: (%s -> %s)", local->loc.path,
- local->loc2.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "loc1=%s", local->loc.path,
+ "loc2=%s", local->loc2.path, NULL);
}
}
@@ -2715,8 +2718,8 @@ client3_3_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2735,12 +2738,11 @@ client3_3_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_opendir(this, &rsp, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed."
- " Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "Path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
}
CLIENT_STACK_UNWIND(opendir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), fd, xdata);
@@ -2788,8 +2790,8 @@ client3_3_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -2832,11 +2834,9 @@ out:
/* any error other than ENOENT */
if (!(local->loc.name && rsp.op_errno == ENOENT) &&
!(rsp.op_errno == ESTALE))
- gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed. Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED, "Path=%s", local->loc.path,
+ "gfid=%s", loc_gfid_utoa(&local->loc), NULL);
else
gf_msg_trace(this->name, 0,
"not found on remote "
@@ -2876,8 +2876,6 @@ client3_3_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
this = THIS;
- memset(vector, 0, sizeof(vector));
-
frame = myframe;
local = frame->local;
@@ -2889,19 +2887,21 @@ client3_3_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
+ memset(vector, 0, sizeof(vector));
+
ret = client_post_readv(this, &rsp, &iobref, req->rsp_iobref, &stat, vector,
&req->rsp[1], &rspcount, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret >= 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -2964,8 +2964,8 @@ client3_3_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_getactivelk_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2982,8 +2982,8 @@ client3_3_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(getactivelk, frame, rsp.op_ret,
@@ -3023,8 +3023,8 @@ client3_3_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_setactivelk_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -3035,8 +3035,8 @@ client3_3_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(setactivelk, frame, rsp.op_ret,
@@ -3050,84 +3050,6 @@ out:
return 0;
}
-int
-client3_3_compound_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
-{
- gfs3_compound_rsp rsp = {
- 0,
- };
- compound_args_cbk_t *args_cbk = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
- int i = 0;
- int length = 0;
- int ret = -1;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_compound_rsp);
- if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- length = local->length;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), rsp.op_ret,
- rsp.op_errno, out);
-
- args_cbk = compound_args_cbk_alloc(length, xdata);
- if (!args_cbk) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOMEM;
- goto out;
- }
-
- /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
- for (i = 0; i < args_cbk->fop_length; i++) {
- ret = client_process_response(frame, this, req, &rsp, args_cbk, i);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
- }
- rsp.op_ret = 0;
-out:
- if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
- CLIENT_STACK_UNWIND(compound, frame, rsp.op_ret,
- gf_error_to_errno(rsp.op_errno), args_cbk, xdata);
-
- free(rsp.xdata.xdata_val);
- client_compound_rsp_cleanup(&rsp, length);
- free(rsp.compound_rsp_array.compound_rsp_array_val);
-
- if (xdata)
- dict_unref(xdata);
-
- compound_args_cbk_cleanup(args_cbk);
- return 0;
-}
-
int32_t
client3_3_releasedir(call_frame_t *frame, xlator_t *this, void *data)
{
@@ -3234,12 +3156,11 @@ client3_3_lookup(call_frame_t *frame, xlator_t *this, void *data)
struct iobref *rsp_iobref = NULL;
struct iobuf *rsp_iobuf = NULL;
struct iovec *rsphdr = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
- memset(vector, 0, sizeof(vector));
-
conf = this->private;
args = data;
local = mem_get0(this->local_pool);
@@ -3256,7 +3177,7 @@ client3_3_lookup(call_frame_t *frame, xlator_t *this, void *data)
loc_path(&local->loc, NULL);
if (args->xdata) {
- content = dict_get(args->xdata, GF_CONTENT_KEY);
+ content = dict_get_sizen(args->xdata, GF_CONTENT_KEY);
if (content != NULL) {
rsp_iobref = iobref_new();
if (rsp_iobref == NULL) {
@@ -3272,6 +3193,7 @@ client3_3_lookup(call_frame_t *frame, xlator_t *this, void *data)
}
iobref_add(rsp_iobref, rsp_iobuf);
+ memset(vector, 0, sizeof(vector));
rsphdr = &vector[0];
rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
@@ -3288,14 +3210,17 @@ client3_3_lookup(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LOOKUP,
- client3_3_lookup_cbk, NULL, rsphdr, count, NULL,
- 0, local->iobref,
+ client3_3_lookup_cbk, &cp,
(xdrproc_t)xdr_gfs3_lookup_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3338,11 +3263,10 @@ client3_3_stat(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STAT,
- client3_3_stat_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_stat_req);
+ client3_3_stat_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_stat_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3381,11 +3305,10 @@ client3_3_truncate(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_TRUNCATE,
- client3_3_truncate_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_truncate_req);
+ client3_3_truncate_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_truncate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3425,11 +3348,9 @@ client3_3_ftruncate(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FTRUNCATE, client3_3_ftruncate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_ftruncate_req);
+ NULL, (xdrproc_t)xdr_gfs3_ftruncate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3468,11 +3389,10 @@ client3_3_access(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ACCESS,
- client3_3_access_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_access_req);
+ client3_3_access_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_access_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3505,6 +3425,7 @@ client3_3_readlink(call_frame_t *frame, xlator_t *this, void *data)
struct iovec vector[MAX_IOVEC] = {
{0},
};
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -3547,13 +3468,15 @@ client3_3_readlink(call_frame_t *frame, xlator_t *this, void *data)
rsp_iobuf = NULL;
rsp_iobref = NULL;
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READLINK,
- client3_3_readlink_cbk, NULL, rsphdr, count,
- NULL, 0, local->iobref,
+ client3_3_readlink_cbk, &cp,
(xdrproc_t)xdr_gfs3_readlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3595,11 +3518,10 @@ client3_3_unlink(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_UNLINK,
- client3_3_unlink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_unlink_req);
+ client3_3_unlink_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_unlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3638,11 +3560,10 @@ client3_3_rmdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RMDIR,
- client3_3_rmdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_rmdir_req);
+ client3_3_rmdir_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_rmdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3697,11 +3618,10 @@ client3_3_symlink(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SYMLINK,
- client3_3_symlink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_symlink_req);
+ client3_3_symlink_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_symlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3743,11 +3663,10 @@ client3_3_rename(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RENAME,
- client3_3_rename_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_rename_req);
+ client3_3_rename_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_rename_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3802,11 +3721,10 @@ client3_3_link(call_frame_t *frame, xlator_t *this, void *data)
loc_path(&local->loc2, NULL);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LINK,
- client3_3_link_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_link_req);
+ client3_3_link_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_link_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3857,11 +3775,10 @@ client3_3_mknod(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKNOD,
- client3_3_mknod_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_mknod_req);
+ client3_3_mknod_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_mknod_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3895,7 +3812,7 @@ client3_3_mkdir(call_frame_t *frame, xlator_t *this, void *data)
args = data;
conf = this->private;
- if (!args->xdata || !dict_get(args->xdata, "gfid-req")) {
+ if (!args->xdata || !dict_get_sizen(args->xdata, "gfid-req")) {
op_errno = EPERM;
gf_msg_callingfn(this->name, GF_LOG_WARNING, op_errno, PC_MSG_GFID_NULL,
"mkdir: %s is received "
@@ -3924,11 +3841,10 @@ client3_3_mkdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKDIR,
- client3_3_mkdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_mkdir_req);
+ client3_3_mkdir_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_mkdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -3982,11 +3898,10 @@ client3_3_create(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_CREATE,
- client3_3_create_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_create_req);
+ client3_3_create_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_create_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4043,11 +3958,10 @@ client3_3_open(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
- client3_3_open_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_open_req);
+ client3_3_open_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_open_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4079,6 +3993,7 @@ client3_3_readv(call_frame_t *frame, xlator_t *this, void *data)
};
struct iobuf *rsp_iobuf = NULL;
struct iobref *rsp_iobref = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4120,9 +4035,9 @@ client3_3_readv(call_frame_t *frame, xlator_t *this, void *data)
rsp_iobuf = NULL;
if (args->size > rsp_vec.iov_len) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size (%lu)",
- (unsigned long)args->size, (unsigned long)rsp_vec.iov_len);
+ gf_smsg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_BIGGER_SIZE,
+ "read-size=%lu", (unsigned long)args->size, "iobuf size=%lu",
+ (unsigned long)rsp_vec.iov_len, NULL);
op_errno = EINVAL;
goto unwind;
}
@@ -4130,13 +4045,16 @@ client3_3_readv(call_frame_t *frame, xlator_t *this, void *data)
local->iobref = rsp_iobref;
rsp_iobref = NULL;
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsp_payload = &rsp_vec;
+ cp.rsp_payload_cnt = 1;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READ,
- client3_3_readv_cbk, NULL, NULL, 0, &rsp_vec, 1,
- local->iobref, (xdrproc_t)xdr_gfs3_read_req);
+ client3_3_readv_cbk, &cp,
+ (xdrproc_t)xdr_gfs3_read_req);
if (ret) {
// unwind is done in the cbk
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4167,6 +4085,7 @@ client3_3_writev(call_frame_t *frame, xlator_t *this, void *data)
};
int op_errno = ESTALE;
int ret = 0;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4187,9 +4106,13 @@ client3_3_writev(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.iobref = args->iobref;
+ cp.payload = args->vector;
+ cp.payload_cnt = args->count;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_WRITE,
- client3_3_writev_cbk, args->iobref,
- args->vector, args->count, NULL, 0, NULL,
+ client3_3_writev_cbk, &cp,
(xdrproc_t)xdr_gfs3_write_req);
if (ret) {
/*
@@ -4197,8 +4120,7 @@ client3_3_writev(call_frame_t *frame, xlator_t *this, void *data)
* do the unwind for us (see rpc_clnt_submit), so don't unwind
* here in such cases.
*/
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4245,14 +4167,21 @@ client3_3_flush(call_frame_t *frame, xlator_t *this, void *data)
ret = client_pre_flush(this, &req, args->fd, args->xdata);
if (ret) {
op_errno = -ret;
+ if (op_errno == EBADF) {
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+
goto unwind;
}
+
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FLUSH,
- client3_3_flush_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_flush_req);
+ client3_3_flush_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_flush_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4291,11 +4220,10 @@ client3_3_fsync(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNC,
- client3_3_fsync_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsync_req);
+ client3_3_fsync_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_fsync_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4336,11 +4264,10 @@ client3_3_fstat(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSTAT,
- client3_3_fstat_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fstat_req);
+ client3_3_fstat_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_fstat_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4391,11 +4318,10 @@ client3_3_opendir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
- client3_3_opendir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_opendir_req);
+ client3_3_opendir_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_opendir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4435,11 +4361,10 @@ client3_3_fsyncdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR,
- client3_3_fsyncdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsyncdir_req);
+ client3_3_fsyncdir_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_fsyncdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4479,11 +4404,10 @@ client3_3_statfs(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STATFS,
- client3_3_statfs_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_statfs_req);
+ client3_3_statfs_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_statfs_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4523,11 +4447,10 @@ client3_3_setxattr(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETXATTR,
- client3_3_setxattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_setxattr_req);
+ client3_3_setxattr_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_setxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.dict_val);
@@ -4570,11 +4493,9 @@ client3_3_fsetxattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FSETXATTR, client3_3_fsetxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fsetxattr_req);
+ NULL, (xdrproc_t)xdr_gfs3_fsetxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.dict_val);
@@ -4611,6 +4532,7 @@ client3_3_fgetxattr(call_frame_t *frame, xlator_t *this, void *data)
struct iovec vector[MAX_IOVEC] = {
{0},
};
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4654,13 +4576,16 @@ client3_3_fgetxattr(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_FGETXATTR, client3_3_fgetxattr_cbk,
- NULL, rsphdr, count, NULL, 0, local->iobref,
+ GFS3_OP_FGETXATTR, client3_3_fgetxattr_cbk, &cp,
(xdrproc_t)xdr_gfs3_fgetxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4699,11 +4624,13 @@ client3_3_getxattr(call_frame_t *frame, xlator_t *this, void *data)
struct iovec vector[MAX_IOVEC] = {
{0},
};
+ client_payload_t cp;
if (!frame || !this || !data) {
op_errno = 0;
goto unwind;
}
+
args = data;
local = mem_get0(this->local_pool);
@@ -4756,9 +4683,8 @@ client3_3_getxattr(call_frame_t *frame, xlator_t *this, void *data)
ret = client_dump_locks((char *)args->name, args->loc->inode, dict);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Client dump "
- "locks failed");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_CLIENT_DUMP_LOCKS_FAILED, NULL);
op_errno = ENOMEM;
goto unwind;
}
@@ -4775,13 +4701,16 @@ client3_3_getxattr(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETXATTR,
- client3_3_getxattr_cbk, NULL, rsphdr, count,
- NULL, 0, local->iobref,
+ client3_3_getxattr_cbk, &cp,
(xdrproc_t)xdr_gfs3_getxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -4822,6 +4751,7 @@ client3_3_xattrop(call_frame_t *frame, xlator_t *this, void *data)
struct iovec vector[MAX_IOVEC] = {
{0},
};
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4871,13 +4801,16 @@ client3_3_xattrop(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_XATTROP,
- client3_3_xattrop_cbk, NULL, rsphdr, count,
- NULL, 0, local->iobref,
+ client3_3_xattrop_cbk, &cp,
(xdrproc_t)xdr_gfs3_xattrop_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.dict_val);
@@ -4918,6 +4851,7 @@ client3_3_fxattrop(call_frame_t *frame, xlator_t *this, void *data)
struct iovec vector[MAX_IOVEC] = {
{0},
};
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4962,13 +4896,15 @@ client3_3_fxattrop(call_frame_t *frame, xlator_t *this, void *data)
rsp_iobuf = NULL;
rsp_iobref = NULL;
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FXATTROP,
- client3_3_fxattrop_cbk, NULL, rsphdr, count,
- NULL, 0, local->iobref,
+ client3_3_fxattrop_cbk, &cp,
(xdrproc_t)xdr_gfs3_fxattrop_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.dict_val);
@@ -5016,11 +4952,9 @@ client3_3_removexattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_REMOVEXATTR, client3_3_removexattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_removexattr_req);
+ NULL, (xdrproc_t)xdr_gfs3_removexattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5059,13 +4993,11 @@ client3_3_fremovexattr(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_FREMOVEXATTR,
- client3_3_fremovexattr_cbk, NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfs3_fremovexattr_req);
+ ret = client_submit_request(
+ this, &req, frame, conf->fops, GFS3_OP_FREMOVEXATTR,
+ client3_3_fremovexattr_cbk, NULL, (xdrproc_t)xdr_gfs3_fremovexattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5104,11 +5036,10 @@ client3_3_lease(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LEASE,
- client3_3_lease_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_lease_req);
+ client3_3_lease_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_lease_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5151,8 +5082,8 @@ client3_3_lk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_cmd_to_gf_cmd(args->cmd, &gf_cmd);
if (ret) {
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto unwind;
}
@@ -5164,14 +5095,21 @@ client3_3_lk(call_frame_t *frame, xlator_t *this, void *data)
args->xdata);
if (ret) {
op_errno = -ret;
+
+ if ((op_errno == EBADF) && (args->flock->l_type == F_UNLCK) &&
+ client_is_setlk(local->cmd)) {
+ client_add_lock_for_recovery(local->fd, args->flock, &local->owner,
+ local->cmd);
+ }
+
goto unwind;
}
+
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LK,
- client3_3_lk_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ client3_3_lk_cbk, NULL,
(xdrproc_t)xdr_gfs3_lk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5210,11 +5148,10 @@ client3_3_inodelk(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_INODELK,
- client3_3_inodelk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_inodelk_req);
+ client3_3_inodelk_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_inodelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5260,11 +5197,10 @@ client3_3_finodelk(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FINODELK,
- client3_3_finodelk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_finodelk_req);
+ client3_3_finodelk_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_finodelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5305,11 +5241,10 @@ client3_3_entrylk(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ENTRYLK,
- client3_3_entrylk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_entrylk_req);
+ client3_3_entrylk_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_entrylk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5349,11 +5284,10 @@ client3_3_fentrylk(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FENTRYLK,
- client3_3_fentrylk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fentrylk_req);
+ client3_3_fentrylk_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_fentrylk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5391,11 +5325,9 @@ client3_3_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_RCHECKSUM, client3_3_rchecksum_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_rchecksum_req);
+ NULL, (xdrproc_t)xdr_gfs3_rchecksum_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5433,6 +5365,7 @@ client3_3_readdir(call_frame_t *frame, xlator_t *this, void *data)
{0},
};
int readdir_rsp_size = 0;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -5486,14 +5419,16 @@ client3_3_readdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = rsp_iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIR,
- client3_3_readdir_cbk, NULL, rsphdr, count,
- NULL, 0, rsp_iobref,
+ client3_3_readdir_cbk, &cp,
(xdrproc_t)xdr_gfs3_readdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5534,6 +5469,7 @@ client3_3_readdirp(call_frame_t *frame, xlator_t *this, void *data)
{0},
};
clnt_local_t *local = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -5587,13 +5523,15 @@ client3_3_readdirp(call_frame_t *frame, xlator_t *this, void *data)
local->fd = fd_ref(args->fd);
+ memset(&cp, 0, sizeof(client_payload_t));
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = rsp_iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIRP,
- client3_3_readdirp_cbk, NULL, rsphdr, count,
- NULL, 0, rsp_iobref,
+ client3_3_readdirp_cbk, &cp,
(xdrproc_t)xdr_gfs3_readdirp_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.dict_val);
@@ -5637,11 +5575,10 @@ client3_3_setattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETATTR,
- client3_3_setattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_setattr_req);
+ client3_3_setattr_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_setattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5679,11 +5616,10 @@ client3_3_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR,
- client3_3_fsetattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_fsetattr_req);
+ client3_3_fsetattr_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_fsetattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5722,11 +5658,9 @@ client3_3_fallocate(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FALLOCATE, client3_3_fallocate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_fallocate_req);
+ NULL, (xdrproc_t)xdr_gfs3_fallocate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -5764,11 +5698,10 @@ client3_3_discard(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_DISCARD,
- client3_3_discard_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_discard_req);
+ client3_3_discard_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_discard_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.xdata_val);
@@ -5807,11 +5740,10 @@ client3_3_zerofill(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ZEROFILL,
- client3_3_zerofill_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_zerofill_req);
+ client3_3_zerofill_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_zerofill_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.xdata_val);
@@ -5850,11 +5782,10 @@ client3_3_ipc(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_IPC,
- client3_3_ipc_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ client3_3_ipc_cbk, NULL,
(xdrproc_t)xdr_gfs3_ipc_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.xdata_val);
@@ -5895,11 +5826,10 @@ client3_3_seek(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SEEK,
- client3_3_seek_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_seek_req);
+ client3_3_seek_cbk, NULL,
+ (xdrproc_t)xdr_gfs3_seek_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.xdata_val);
@@ -5911,143 +5841,6 @@ unwind:
return 0;
}
-/* Brief explanation of gfs3_compound_req structure :
- * 1) It consists of version of compounding.
- * 2) A compound-fop enum, new enum for compound fops
- * 3) A 'compound_req_arrray' structure that has
- * a) array len - based on the number of fops compounded
- * b) compound_req_array_val - pointer to an array of compound_req's
- * 4) compound_req - structure that contains:
- * a) fop enum of type glusterfs_fop_t
- * b) union of structures of xdr requests of all fops.
- */
-
-int32_t
-client3_3_compound(call_frame_t *frame, xlator_t *this, void *data)
-{
- clnt_conf_t *conf = NULL;
- compound_args_t *c_args = data;
- gfs3_compound_req req = {
- 0,
- };
- clnt_local_t *local = NULL;
- int op_errno = ENOMEM;
- int ret = 0;
- int i = 0;
- int rsp_count = 0;
- struct iovec rsp_vector[MAX_IOVEC] = {
- {0},
- };
- struct iovec req_vector[MAX_IOVEC] = {
- {0},
- };
- struct iovec vector[MAX_IOVEC] = {
- {0},
- };
- struct iovec *rsphdr = NULL;
- struct iobref *req_iobref = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobref *rsphdr_iobref = NULL;
- struct iobuf *rsphdr_iobuf = NULL;
- int rsphdr_count = 0;
- int req_count = 0;
- dict_t *xdata = c_args->xdata;
-
- GF_ASSERT(frame);
-
- if (!this)
- goto unwind;
-
- memset(req_vector, 0, sizeof(req_vector));
- memset(rsp_vector, 0, sizeof(rsp_vector));
-
- conf = this->private;
-
- local = mem_get0(this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->length = c_args->fop_length;
- local->compound_args = c_args;
-
- rsphdr_iobref = iobref_new();
- if (rsphdr_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsphdr_iobuf = iobuf_get(this->ctx->iobuf_pool);
- if (rsphdr_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr(rsphdr_iobuf);
- rsphdr->iov_len = iobuf_pagesize(rsphdr_iobuf);
- rsphdr_count = 1;
- iobref_add(rsphdr_iobref, rsphdr_iobuf);
- iobuf_unref(rsphdr_iobuf);
- rsphdr_iobuf = NULL;
-
- req.compound_fop_enum = c_args->fop_enum;
- req.compound_req_array.compound_req_array_len = c_args->fop_length;
- req.compound_version = 0;
- if (xdata) {
- GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req.xdata.xdata_val),
- req.xdata.xdata_len, op_errno, unwind);
- }
-
- req.compound_req_array.compound_req_array_val = GF_CALLOC(
- local->length, sizeof(compound_req), gf_client_mt_compound_req_t);
-
- if (!req.compound_req_array.compound_req_array_val) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- for (i = 0; i < local->length; i++) {
- ret = client_handle_fop_requirements(
- this, frame, &req, local, &req_iobref, &rsp_iobref, req_vector,
- rsp_vector, &req_count, &rsp_count, &c_args->req_list[i],
- c_args->enum_list[i], i);
- if (ret) {
- op_errno = ret;
- goto unwind;
- }
- }
-
- local->iobref = rsp_iobref;
- rsp_iobref = NULL;
-
- ret = client_submit_compound_request(
- this, &req, frame, conf->fops, GFS3_OP_COMPOUND, client3_3_compound_cbk,
- req_vector, req_count, req_iobref, rsphdr, rsphdr_count, rsp_vector,
- rsp_count, local->iobref, (xdrproc_t)xdr_gfs3_compound_req);
-
- GF_FREE(req.xdata.xdata_val);
-
- iobref_unref(rsphdr_iobref);
-
- compound_request_cleanup(&req);
- return 0;
-unwind:
- CLIENT_STACK_UNWIND(compound, frame, -1, op_errno, NULL, NULL);
-
- if (rsp_iobref)
- iobref_unref(rsp_iobref);
-
- if (rsphdr_iobref)
- iobref_unref(rsphdr_iobref);
-
- GF_FREE(req.xdata.xdata_val);
-
- compound_request_cleanup(&req);
- return 0;
-}
-
static int32_t
client3_3_getactivelk(call_frame_t *frame, xlator_t *this, void *data)
{
@@ -6083,11 +5876,9 @@ client3_3_getactivelk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_GETACTIVELK, client3_3_getactivelk_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_getactivelk_req);
+ NULL, (xdrproc_t)xdr_gfs3_getactivelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.xdata_val);
@@ -6141,11 +5932,9 @@ client3_3_setactivelk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_SETACTIVELK, client3_3_setactivelk_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_setactivelk_req);
+ NULL, (xdrproc_t)xdr_gfs3_setactivelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
clnt_setactivelk_req_cleanup(&req);
@@ -6220,7 +6009,7 @@ rpc_clnt_procedure_t clnt3_3_fop_actors[GF_FOP_MAXVALUE] = {
[GF_FOP_LEASE] = {"LEASE", client3_3_lease},
[GF_FOP_GETACTIVELK] = {"GETACTIVELK", client3_3_getactivelk},
[GF_FOP_SETACTIVELK] = {"SETACTIVELK", client3_3_setactivelk},
- [GF_FOP_COMPOUND] = {"COMPOUND", client3_3_compound},
+ [GF_FOP_COMPOUND] = {"COMPOUND", NULL},
};
/* Used From RPC-CLNT library to log proper name of procedure based on number */
diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c
index 55a9fd04a6a..0d80d4e8efb 100644
--- a/xlators/protocol/client/src/client-rpc-fops_v2.c
+++ b/xlators/protocol/client/src/client-rpc-fops_v2.c
@@ -12,11 +12,10 @@
#include "rpc-common-xdr.h"
#include "glusterfs4-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "client-messages.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "client-common.h"
-#include "compound-fop-utils.h"
extern int32_t
client3_getspec(call_frame_t *frame, xlator_t *this, void *data);
@@ -60,8 +59,8 @@ client4_0_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -76,10 +75,9 @@ out:
/* no need to print the gfid, because it will be null,
* since symlink operation failed.
*/
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: (%s to %s)", local->loc.path,
- local->loc2.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "source=%s", local->loc.path,
+ "target=%s", local->loc2.path, NULL);
}
}
@@ -131,8 +129,8 @@ client4_0_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -144,10 +142,10 @@ client4_0_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1 &&
GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s", local->loc.path);
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret,
@@ -197,8 +195,8 @@ client4_0_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -210,10 +208,10 @@ client4_0_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1 &&
GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s", local->loc.path);
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret,
@@ -254,8 +252,8 @@ client4_0_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -274,11 +272,11 @@ client4_0_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s (%s)", local->loc.path,
- loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
}
CLIENT_STACK_UNWIND(open, frame, rsp.op_ret,
@@ -316,8 +314,8 @@ client4_0_stat_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -332,8 +330,8 @@ out:
gf_msg_debug(this->name, 0, "remote operation failed: %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -372,8 +370,8 @@ client4_0_readlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readlink_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -389,10 +387,8 @@ out:
" %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -439,8 +435,8 @@ client4_0_unlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -456,10 +452,8 @@ out:
" %s",
strerror(gf_error_to_errno(rsp.op_errno)));
} else {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -502,8 +496,8 @@ client4_0_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -514,8 +508,8 @@ client4_0_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
CLIENT_STACK_UNWIND(rmdir, frame, rsp.op_ret,
@@ -557,8 +551,8 @@ client4_0_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -568,8 +562,8 @@ client4_0_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(truncate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -607,8 +601,8 @@ client4_0_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_statfs_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -620,8 +614,8 @@ client4_0_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(statfs, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &statfs, xdata);
@@ -664,8 +658,8 @@ client4_0_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -676,8 +670,8 @@ client4_0_writev_cbk(struct rpc_req *req, struct iovec *iov, int count,
goto out;
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret >= 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -716,14 +710,15 @@ client4_0_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
- if (rsp.op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ if ((rsp.op_ret >= 0 || (rsp.op_errno == ENOTCONN)) &&
+ !fd_is_anonymous(local->fd)) {
/* Delete all saved locks of the owner issuing flush */
ret = delete_granted_locks_owner(local->fd, &local->owner);
gf_msg_trace(this->name, 0, "deleting locks of owner (%s) returned %d",
@@ -734,10 +729,9 @@ client4_0_flush_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(flush, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -778,8 +772,8 @@ client4_0_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -791,8 +785,8 @@ client4_0_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsync, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -828,8 +822,8 @@ client4_0_setxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -845,10 +839,8 @@ out:
" %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -888,8 +880,8 @@ client4_0_getxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -913,12 +905,10 @@ out:
loc_gfid_utoa(&local->loc),
(local->name) ? local->name : "(null)");
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed. Path: %s (%s). Key: %s",
- local->loc.path, loc_gfid_utoa(&local->loc),
- (local->name) ? local->name : "(null)");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path,
+ "gfid=%s", loc_gfid_utoa(&local->loc), "key=%s",
+ (local->name) ? local->name : "(null)", NULL);
}
} else {
/* This is required as many places, `if (ret)` is checked
@@ -964,8 +954,8 @@ client4_0_fgetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -984,10 +974,8 @@ out:
gf_msg_debug(this->name, 0, "remote operation failed: %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
} else {
/* This is required as many places, `if (ret)` is checked
@@ -1033,8 +1021,8 @@ client4_0_removexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1053,8 +1041,8 @@ out:
else
loglevel = GF_LOG_WARNING;
- gf_msg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, loglevel, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(removexattr, frame, rsp.op_ret,
@@ -1090,8 +1078,8 @@ client4_0_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1100,8 +1088,8 @@ client4_0_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fremovexattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1135,8 +1123,8 @@ client4_0_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1146,8 +1134,8 @@ client4_0_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsyncdir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1181,8 +1169,8 @@ client4_0_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1192,8 +1180,8 @@ client4_0_access_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(access, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1233,8 +1221,8 @@ client4_0_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1244,8 +1232,8 @@ client4_0_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(ftruncate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1283,8 +1271,8 @@ client4_0_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1294,8 +1282,8 @@ client4_0_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fstat, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &stat, xdata);
@@ -1329,8 +1317,8 @@ client4_0_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1339,10 +1327,9 @@ client4_0_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(inodelk, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), xdata);
@@ -1377,8 +1364,8 @@ client4_0_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1387,10 +1374,9 @@ client4_0_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret == 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -1427,8 +1413,8 @@ client4_0_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1437,10 +1423,9 @@ client4_0_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(entrylk, frame, rsp.op_ret,
@@ -1475,8 +1460,8 @@ client4_0_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1486,8 +1471,8 @@ client4_0_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fentrylk, frame, rsp.op_ret,
@@ -1526,8 +1511,8 @@ client4_0_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -1541,11 +1526,10 @@ client4_0_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. "
- "Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "Path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
} else {
/* This is required as many places, `if (ret)` is checked
for syncop_xattrop() */
@@ -1596,8 +1580,8 @@ client4_0_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
if (ret < 0) {
rsp.op_ret = -1;
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
goto out;
}
op_errno = rsp.op_errno;
@@ -1610,8 +1594,8 @@ client4_0_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else {
/* This is required as many places, `if (ret)` is checked
for syncop_fxattrop() */
@@ -1658,8 +1642,8 @@ client4_0_fsetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1676,10 +1660,8 @@ out:
" %s",
strerror(op_errno));
} else {
- gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed");
+ gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
}
@@ -1720,8 +1702,8 @@ client4_0_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1733,8 +1715,8 @@ client4_0_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fallocate, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1775,8 +1757,8 @@ client4_0_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1786,8 +1768,8 @@ client4_0_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(discard, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1827,8 +1809,8 @@ client4_0_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1837,8 +1819,8 @@ client4_0_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(zerofill, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -1873,8 +1855,8 @@ client4_0_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1883,8 +1865,8 @@ client4_0_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(ipc, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
xdata);
@@ -1918,8 +1900,8 @@ client4_0_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_seek_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1928,8 +1910,8 @@ client4_0_seek_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(seek, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), rsp.offset, xdata);
@@ -1970,8 +1952,8 @@ client4_0_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -1981,8 +1963,8 @@ client4_0_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(setattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -2024,8 +2006,8 @@ client4_0_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2035,8 +2017,8 @@ client4_0_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(fsetattr, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &prestat, &poststat,
@@ -2087,18 +2069,19 @@ client4_0_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_create_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
+ ret = client_post_create_v2(this, &rsp, &stbuf, &preparent, &postparent,
+ local, &xdata);
+ if (ret < 0)
+ goto out;
+
if (-1 != rsp.op_ret) {
- ret = client_post_create_v2(this, &rsp, &stbuf, &preparent, &postparent,
- local, &xdata);
- if (ret < 0)
- goto out;
ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
local->flags, rsp.fd, 0);
if (ret) {
@@ -2110,9 +2093,8 @@ client4_0_create_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed. Path: %s",
- local->loc.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path, NULL);
}
CLIENT_STACK_UNWIND(create, frame, rsp.op_ret,
@@ -2145,8 +2127,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
frame = myframe;
if (-1 == req->rpc_status) {
- gf_msg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED,
- "Lease fop failed");
+ gf_smsg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
goto out;
@@ -2154,8 +2136,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lease_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2165,8 +2147,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(lease, frame, rsp.op_ret,
@@ -2192,10 +2174,12 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
int ret = 0;
xlator_t *this = NULL;
dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
this = THIS;
frame = myframe;
+ local = frame->local;
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
@@ -2205,8 +2189,8 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lk_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2216,12 +2200,24 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_lk_v2(this, &rsp, &lock, &xdata);
if (ret < 0)
goto out;
+
+ /* Save the lock to the client lock cache to be able
+ to recover in the case of server reboot.*/
+
+ if (client_is_setlk(local->cmd)) {
+ ret = client_add_lock_for_recovery(local->fd, &lock, &local->owner,
+ local->cmd);
+ if (ret < 0) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ }
+ }
}
out:
if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(lk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
@@ -2264,8 +2260,8 @@ client4_0_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdir_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2275,9 +2271,8 @@ client4_0_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: remote_fd = %d", local->cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote_fd=%d", local->cmd, NULL);
}
CLIENT_STACK_UNWIND(readdir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &entries, xdata);
@@ -2323,8 +2318,8 @@ client4_0_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdirp_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2333,8 +2328,8 @@ client4_0_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = client_post_readdirp_v2(this, &rsp, local->fd, &entries, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(readdirp, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &entries, xdata);
@@ -2390,8 +2385,8 @@ client4_0_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rename_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2401,8 +2396,8 @@ client4_0_rename_cbk(struct rpc_req *req, struct iovec *iov, int count,
&prenewparent, &postnewparent, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(rename, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), &stbuf, &preoldparent,
@@ -2452,8 +2447,8 @@ client4_0_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2464,10 +2459,9 @@ client4_0_link_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed: (%s -> %s)", local->loc.path,
- local->loc2.path);
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "source=%s", local->loc.path,
+ "target=%s", local->loc2.path, NULL);
}
}
@@ -2512,8 +2506,8 @@ client4_0_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
but separated by fop number only */
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2532,12 +2526,11 @@ client4_0_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name,
- fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
- gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed."
- " Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name,
+ fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "path=%s", local->loc.path, "gfid=%s",
+ loc_gfid_utoa(&local->loc), NULL);
}
CLIENT_STACK_UNWIND(opendir, frame, rsp.op_ret,
gf_error_to_errno(rsp.op_errno), fd, xdata);
@@ -2583,8 +2576,8 @@ client4_0_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
op_errno = EINVAL;
goto out;
@@ -2613,7 +2606,7 @@ client4_0_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count,
rsp.op_ret = -1;
op_errno = ESTALE;
if (xdata)
- ret = dict_set_int32(xdata, "gfid-changed", 1);
+ ret = dict_set_int32_sizen(xdata, "gfid-changed", 1);
goto out;
}
@@ -2627,11 +2620,9 @@ out:
/* any error other than ENOENT */
if (!(local->loc.name && rsp.op_errno == ENOENT) &&
!(rsp.op_errno == ESTALE))
- gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation "
- "failed. Path: %s (%s)",
- local->loc.path, loc_gfid_utoa(&local->loc));
+ gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path,
+ "gfid=%s", loc_gfid_utoa(&local->loc), NULL);
else
gf_msg_trace(this->name, 0,
"not found on remote "
@@ -2669,8 +2660,6 @@ client4_0_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
this = THIS;
- memset(vector, 0, sizeof(vector));
-
frame = myframe;
local = frame->local;
@@ -2682,19 +2671,21 @@ client4_0_readv_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_read_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
}
+ memset(vector, 0, sizeof(vector));
+
ret = client_post_readv_v2(this, &rsp, &iobref, req->rsp_iobref, &stat,
vector, &req->rsp[1], &rspcount, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
} else if (rsp.op_ret >= 0) {
if (local->attempt_reopen)
client_attempt_reopen(local->fd, this);
@@ -2755,8 +2746,8 @@ client4_0_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_getactivelk_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2772,8 +2763,8 @@ client4_0_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(getactivelk, frame, rsp.op_ret,
@@ -2810,8 +2801,8 @@ client4_0_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -2820,8 +2811,8 @@ client4_0_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(setactivelk, frame, rsp.op_ret,
@@ -2833,6 +2824,72 @@ out:
return 0;
}
+int
+client4_0_copy_file_range_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
+{
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt prestat = {
+ 0,
+ };
+ struct iatt poststat = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+ clnt_local_t *local = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+ if (ret < 0) {
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_common_3iatt(this, &rsp, &stbuf, &prestat, &poststat,
+ &xdata);
+ if (ret < 0)
+ goto out;
+out:
+ if (rsp.op_ret == -1) {
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
+ } else if (rsp.op_ret >= 0) {
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ if (local->attempt_reopen_out)
+ client_attempt_reopen(local->fd_out, this);
+ }
+ CLIENT_STACK_UNWIND(copy_file_range, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &stbuf, &prestat,
+ &poststat, xdata);
+
+ if (xdata)
+ dict_unref(xdata);
+
+ return 0;
+}
+
int32_t
client4_0_releasedir(call_frame_t *frame, xlator_t *this, void *data)
{
@@ -2939,12 +2996,11 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data)
struct iobref *rsp_iobref = NULL;
struct iobuf *rsp_iobuf = NULL;
struct iovec *rsphdr = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
- memset(vector, 0, sizeof(vector));
-
conf = this->private;
args = data;
local = mem_get0(this->local_pool);
@@ -2961,7 +3017,7 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data)
loc_path(&local->loc, NULL);
if (args->xdata) {
- content = dict_get(args->xdata, GF_CONTENT_KEY);
+ content = dict_get_sizen(args->xdata, GF_CONTENT_KEY);
if (content != NULL) {
rsp_iobref = iobref_new();
if (rsp_iobref == NULL) {
@@ -2977,6 +3033,7 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data)
}
iobref_add(rsp_iobref, rsp_iobuf);
+ memset(vector, 0, sizeof(vector));
rsphdr = &vector[0];
rsphdr->iov_base = iobuf_ptr(rsp_iobuf);
rsphdr->iov_len = iobuf_pagesize(rsp_iobuf);
@@ -2993,14 +3050,18 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
+
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LOOKUP,
- client4_0_lookup_cbk, NULL, rsphdr, count, NULL,
- 0, local->iobref,
+ client4_0_lookup_cbk, &cp,
(xdrproc_t)xdr_gfx_lookup_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3043,11 +3104,10 @@ client4_0_stat(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STAT,
- client4_0_stat_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_stat_req);
+ client4_0_stat_cbk, NULL,
+ (xdrproc_t)xdr_gfx_stat_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3087,11 +3147,10 @@ client4_0_truncate(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_TRUNCATE,
- client4_0_truncate_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_truncate_req);
+ client4_0_truncate_cbk, NULL,
+ (xdrproc_t)xdr_gfx_truncate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3132,11 +3191,9 @@ client4_0_ftruncate(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FTRUNCATE, client4_0_ftruncate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_ftruncate_req);
+ NULL, (xdrproc_t)xdr_gfx_ftruncate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3175,11 +3232,10 @@ client4_0_access(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ACCESS,
- client4_0_access_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_access_req);
+ client4_0_access_cbk, NULL,
+ (xdrproc_t)xdr_gfx_access_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3229,11 +3285,10 @@ client4_0_readlink(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READLINK,
- client4_0_readlink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_readlink_req);
+ client4_0_readlink_cbk, NULL,
+ (xdrproc_t)xdr_gfx_readlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3272,11 +3327,10 @@ client4_0_unlink(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_UNLINK,
- client4_0_unlink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_unlink_req);
+ client4_0_unlink_cbk, NULL,
+ (xdrproc_t)xdr_gfx_unlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3315,11 +3369,10 @@ client4_0_rmdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RMDIR,
- client4_0_rmdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_rmdir_req);
+ client4_0_rmdir_cbk, NULL,
+ (xdrproc_t)xdr_gfx_rmdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3374,11 +3427,10 @@ client4_0_symlink(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SYMLINK,
- client4_0_symlink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_symlink_req);
+ client4_0_symlink_cbk, NULL,
+ (xdrproc_t)xdr_gfx_symlink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3420,11 +3472,10 @@ client4_0_rename(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RENAME,
- client4_0_rename_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_rename_req);
+ client4_0_rename_cbk, NULL,
+ (xdrproc_t)xdr_gfx_rename_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3480,11 +3531,10 @@ client4_0_link(call_frame_t *frame, xlator_t *this, void *data)
loc_path(&local->loc2, NULL);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LINK,
- client4_0_link_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_link_req);
+ client4_0_link_cbk, NULL,
+ (xdrproc_t)xdr_gfx_link_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3535,11 +3585,10 @@ client4_0_mknod(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKNOD,
- client4_0_mknod_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_mknod_req);
+ client4_0_mknod_cbk, NULL,
+ (xdrproc_t)xdr_gfx_mknod_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3573,7 +3622,7 @@ client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data)
args = data;
conf = this->private;
- if (!args->xdata || !dict_get(args->xdata, "gfid-req")) {
+ if (!args->xdata || !dict_get_sizen(args->xdata, "gfid-req")) {
op_errno = EPERM;
gf_msg_callingfn(this->name, GF_LOG_WARNING, op_errno, PC_MSG_GFID_NULL,
"mkdir: %s is received "
@@ -3602,11 +3651,10 @@ client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKDIR,
- client4_0_mkdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_mkdir_req);
+ client4_0_mkdir_cbk, NULL,
+ (xdrproc_t)xdr_gfx_mkdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3660,11 +3708,10 @@ client4_0_create(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_CREATE,
- client4_0_create_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_create_req);
+ client4_0_create_cbk, NULL,
+ (xdrproc_t)xdr_gfx_create_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3721,11 +3768,10 @@ client4_0_open(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
- client4_0_open_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_open_req);
+ client4_0_open_cbk, NULL,
+ (xdrproc_t)xdr_gfx_open_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3757,6 +3803,7 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data)
};
struct iobuf *rsp_iobuf = NULL;
struct iobref *rsp_iobref = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -3799,19 +3846,23 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data)
rsp_iobuf = NULL;
if (args->size > rsp_vec.iov_len) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size (%lu)",
- (unsigned long)args->size, (unsigned long)rsp_vec.iov_len);
+ gf_smsg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_BIGGER_SIZE,
+ "read-size=%lu", (unsigned long)args->size, "iobuf-size=%lu",
+ (unsigned long)rsp_vec.iov_len, NULL);
op_errno = EINVAL;
goto unwind;
}
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.rsp_payload = &rsp_vec;
+ cp.rsp_payload_cnt = 1;
+ cp.rsp_iobref = local->iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READ,
- client4_0_readv_cbk, NULL, NULL, 0, &rsp_vec, 1,
- local->iobref, (xdrproc_t)xdr_gfx_read_req);
+ client4_0_readv_cbk, &cp,
+ (xdrproc_t)xdr_gfx_read_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3839,6 +3890,7 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data)
};
int op_errno = ESTALE;
int ret = 0;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -3860,9 +3912,13 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.iobref = args->iobref;
+ cp.payload = args->vector;
+ cp.payload_cnt = args->count;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_WRITE,
- client4_0_writev_cbk, args->iobref,
- args->vector, args->count, NULL, 0, NULL,
+ client4_0_writev_cbk, &cp,
(xdrproc_t)xdr_gfx_write_req);
if (ret) {
/*
@@ -3870,8 +3926,7 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data)
* do the unwind for us (see rpc_clnt_submit), so don't unwind
* here in such cases.
*/
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3918,14 +3973,20 @@ client4_0_flush(call_frame_t *frame, xlator_t *this, void *data)
ret = client_pre_flush_v2(this, &req, args->fd, args->xdata);
if (ret) {
op_errno = -ret;
+ if (op_errno == EBADF) {
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FLUSH,
- client4_0_flush_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_flush_req);
+ client4_0_flush_cbk, NULL,
+ (xdrproc_t)xdr_gfx_flush_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -3964,11 +4025,10 @@ client4_0_fsync(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNC,
- client4_0_fsync_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fsync_req);
+ client4_0_fsync_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fsync_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4009,11 +4069,10 @@ client4_0_fstat(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSTAT,
- client4_0_fstat_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fstat_req);
+ client4_0_fstat_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fstat_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4064,11 +4123,10 @@ client4_0_opendir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
- client4_0_opendir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_opendir_req);
+ client4_0_opendir_cbk, NULL,
+ (xdrproc_t)xdr_gfx_opendir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4109,11 +4167,10 @@ client4_0_fsyncdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR,
- client4_0_fsyncdir_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fsyncdir_req);
+ client4_0_fsyncdir_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fsyncdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4153,11 +4210,10 @@ client4_0_statfs(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STATFS,
- client4_0_statfs_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_statfs_req);
+ client4_0_statfs_cbk, NULL,
+ (xdrproc_t)xdr_gfx_statfs_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4197,11 +4253,10 @@ client4_0_setxattr(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETXATTR,
- client4_0_setxattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_setxattr_req);
+ client4_0_setxattr_cbk, NULL,
+ (xdrproc_t)xdr_gfx_setxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.pairs.pairs_val);
@@ -4244,11 +4299,9 @@ client4_0_fsetxattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FSETXATTR, client4_0_fsetxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fsetxattr_req);
+ NULL, (xdrproc_t)xdr_gfx_fsetxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.pairs.pairs_val);
@@ -4298,11 +4351,9 @@ client4_0_fgetxattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FGETXATTR, client4_0_fgetxattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fgetxattr_req);
+ NULL, (xdrproc_t)xdr_gfx_fgetxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4365,9 +4416,8 @@ client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data)
ret = client_dump_locks((char *)args->name, args->loc->inode, dict);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Client dump "
- "locks failed");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_CLIENT_DUMP_LOCKS_FAILED, NULL);
op_errno = ENOMEM;
goto unwind;
}
@@ -4386,11 +4436,10 @@ client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETXATTR,
- client4_0_getxattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_getxattr_req);
+ client4_0_getxattr_cbk, NULL,
+ (xdrproc_t)xdr_gfx_getxattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4448,11 +4497,10 @@ client4_0_xattrop(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_XATTROP,
- client4_0_xattrop_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_xattrop_req);
+ client4_0_xattrop_cbk, NULL,
+ (xdrproc_t)xdr_gfx_xattrop_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.pairs.pairs_val);
@@ -4500,11 +4548,10 @@ client4_0_fxattrop(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FXATTROP,
- client4_0_fxattrop_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fxattrop_req);
+ client4_0_fxattrop_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fxattrop_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.dict.pairs.pairs_val);
@@ -4547,11 +4594,9 @@ client4_0_removexattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_REMOVEXATTR, client4_0_removexattr_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_removexattr_req);
+ NULL, (xdrproc_t)xdr_gfx_removexattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4590,13 +4635,11 @@ client4_0_fremovexattr(call_frame_t *frame, xlator_t *this, void *data)
op_errno = -ret;
goto unwind;
}
- ret = client_submit_request(this, &req, frame, conf->fops,
- GFS3_OP_FREMOVEXATTR,
- client4_0_fremovexattr_cbk, NULL, NULL, 0, NULL,
- 0, NULL, (xdrproc_t)xdr_gfx_fremovexattr_req);
+ ret = client_submit_request(
+ this, &req, frame, conf->fops, GFS3_OP_FREMOVEXATTR,
+ client4_0_fremovexattr_cbk, NULL, (xdrproc_t)xdr_gfx_fremovexattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4635,11 +4678,10 @@ client4_0_lease(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LEASE,
- client4_0_lease_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_lease_req);
+ client4_0_lease_cbk, NULL,
+ (xdrproc_t)xdr_gfx_lease_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4682,8 +4724,8 @@ client4_0_lk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_cmd_to_gf_cmd(args->cmd, &gf_cmd);
if (ret) {
op_errno = EINVAL;
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Unknown cmd (%d)!", gf_cmd);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD,
+ "gf_cmd=%d", gf_cmd, NULL);
goto unwind;
}
@@ -4695,14 +4737,21 @@ client4_0_lk(call_frame_t *frame, xlator_t *this, void *data)
args->xdata);
if (ret) {
op_errno = -ret;
+
+ if ((op_errno == EBADF) && (args->flock->l_type == F_UNLCK) &&
+ client_is_setlk(local->cmd)) {
+ client_add_lock_for_recovery(local->fd, args->flock, &local->owner,
+ local->cmd);
+ }
+
goto unwind;
}
+
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LK,
- client4_0_lk_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ client4_0_lk_cbk, NULL,
(xdrproc_t)xdr_gfx_lk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4741,11 +4790,10 @@ client4_0_inodelk(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_INODELK,
- client4_0_inodelk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_inodelk_req);
+ client4_0_inodelk_cbk, NULL,
+ (xdrproc_t)xdr_gfx_inodelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4791,11 +4839,10 @@ client4_0_finodelk(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FINODELK,
- client4_0_finodelk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_finodelk_req);
+ client4_0_finodelk_cbk, NULL,
+ (xdrproc_t)xdr_gfx_finodelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4836,11 +4883,10 @@ client4_0_entrylk(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ENTRYLK,
- client4_0_entrylk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_entrylk_req);
+ client4_0_entrylk_cbk, NULL,
+ (xdrproc_t)xdr_gfx_entrylk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4880,11 +4926,10 @@ client4_0_fentrylk(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FENTRYLK,
- client4_0_fentrylk_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fentrylk_req);
+ client4_0_fentrylk_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fentrylk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -4922,6 +4967,7 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data)
{0},
};
int readdir_rsp_size = 0;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -4975,14 +5021,17 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = rsp_iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIR,
- client4_0_readdir_cbk, NULL, rsphdr, count,
- NULL, 0, rsp_iobref,
+ client4_0_readdir_cbk, &cp,
(xdrproc_t)xdr_gfx_readdir_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5023,6 +5072,7 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data)
{0},
};
clnt_local_t *local = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -5076,13 +5126,16 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data)
local->fd = fd_ref(args->fd);
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.rsphdr = rsphdr;
+ cp.rsphdr_cnt = count;
+ cp.rsp_iobref = rsp_iobref;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIRP,
- client4_0_readdirp_cbk, NULL, rsphdr, count,
- NULL, 0, rsp_iobref,
+ client4_0_readdirp_cbk, &cp,
(xdrproc_t)xdr_gfx_readdirp_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5126,11 +5179,10 @@ client4_0_setattr(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETATTR,
- client4_0_setattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_setattr_req);
+ client4_0_setattr_cbk, NULL,
+ (xdrproc_t)xdr_gfx_setattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5169,11 +5221,9 @@ client4_0_fallocate(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_FALLOCATE, client4_0_fallocate_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_fallocate_req);
+ NULL, (xdrproc_t)xdr_gfx_fallocate_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5211,11 +5261,10 @@ client4_0_discard(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_DISCARD,
- client4_0_discard_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_discard_req);
+ client4_0_discard_cbk, NULL,
+ (xdrproc_t)xdr_gfx_discard_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5254,11 +5303,10 @@ client4_0_zerofill(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ZEROFILL,
- client4_0_zerofill_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_zerofill_req);
+ client4_0_zerofill_cbk, NULL,
+ (xdrproc_t)xdr_gfx_zerofill_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5297,11 +5345,10 @@ client4_0_ipc(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_IPC,
- client4_0_ipc_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ client4_0_ipc_cbk, NULL,
(xdrproc_t)xdr_gfx_ipc_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5342,11 +5389,10 @@ client4_0_seek(call_frame_t *frame, xlator_t *this, void *data)
}
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SEEK,
- client4_0_seek_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_seek_req);
+ client4_0_seek_cbk, NULL,
+ (xdrproc_t)xdr_gfx_seek_req);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5392,11 +5438,9 @@ client4_0_getactivelk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_GETACTIVELK, client4_0_getactivelk_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_getactivelk_req);
+ NULL, (xdrproc_t)xdr_gfx_getactivelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5448,11 +5492,9 @@ client4_0_setactivelk(call_frame_t *frame, xlator_t *this, void *data)
ret = client_submit_request(this, &req, frame, conf->fops,
GFS3_OP_SETACTIVELK, client4_0_setactivelk_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_setactivelk_req);
+ NULL, (xdrproc_t)xdr_gfx_setactivelk_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
clnt_setactivelk_req_cleanup_v2(&req);
@@ -5496,8 +5538,8 @@ client4_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rchecksum_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -5506,8 +5548,8 @@ client4_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count,
xdr_to_dict(&rsp.xdata, &xdata);
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(rchecksum, frame, rsp.op_ret,
@@ -5657,8 +5699,8 @@ client4_0_put_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ NULL);
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
goto out;
@@ -5672,8 +5714,8 @@ client4_0_put_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
out:
if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
+ gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, NULL);
}
CLIENT_STACK_UNWIND(put, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno),
@@ -5719,11 +5761,10 @@ client4_0_namelink(call_frame_t *frame, xlator_t *this, void *data)
dict_to_xdr(args->xdata, &req.xdata);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_NAMELINK,
- client4_namelink_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_namelink_req);
+ client4_namelink_cbk, NULL,
+ (xdrproc_t)xdr_gfx_namelink_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5771,8 +5812,8 @@ client4_0_icreate(call_frame_t *frame, xlator_t *this, void *data)
op_errno = ESTALE;
dict_to_xdr(args->xdata, &req.xdata);
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ICREATE,
- client4_icreate_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_icreate_req);
+ client4_icreate_cbk, NULL,
+ (xdrproc_t)xdr_gfx_icreate_req);
if (ret)
goto free_reqdata;
GF_FREE(req.xdata.pairs.pairs_val);
@@ -5798,6 +5839,7 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data)
int op_errno = ESTALE;
int ret = 0;
clnt_local_t *local = NULL;
+ client_payload_t cp;
if (!frame || !this || !data)
goto unwind;
@@ -5824,9 +5866,13 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data)
goto unwind;
}
+ memset(&cp, 0, sizeof(client_payload_t));
+
+ cp.iobref = args->iobref;
+ cp.payload = args->vector;
+ cp.payload_cnt = args->count;
ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_PUT,
- client4_0_put_cbk, args->iobref, args->vector,
- args->count, NULL, 0, NULL,
+ client4_0_put_cbk, &cp,
(xdrproc_t)xdr_gfx_put_req);
if (ret) {
/*
@@ -5834,8 +5880,7 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data)
* do the unwind for us (see rpc_clnt_submit), so don't unwind
* here in such cases.
*/
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
return 0;
@@ -5846,12 +5891,15 @@ unwind:
}
int32_t
-client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
+client4_0_copy_file_range(call_frame_t *frame, xlator_t *this, void *data)
{
clnt_args_t *args = NULL;
clnt_conf_t *conf = NULL;
- gfx_fsetattr_req req = {
- {0},
+ clnt_local_t *local = NULL;
+ gfx_copy_file_range_req req = {
+ {
+ 0,
+ },
};
int op_errno = ESTALE;
int ret = 0;
@@ -5862,37 +5910,65 @@ client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
args = data;
conf = this->private;
- ret = client_pre_fsetattr_v2(this, &req, args->fd, args->valid, args->stbuf,
- args->xdata);
+ ret = client_pre_copy_file_range_v2(this, &req, args->fd, args->off_in,
+ args->fd_out, args->off_out, args->size,
+ args->flags, &args->xdata);
+
if (ret) {
op_errno = -ret;
goto unwind;
}
- ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR,
- client4_0_fsetattr_cbk, NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfx_fsetattr_req);
+
+ ret = client_fd_fop_prepare_local(frame, args->fd, req.fd_in);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+
+ /*
+ * Since frame->local is allocated in above function call
+ * itself, better to use it (with the assumption that it
+ * has been allocated) directly instead of again calling
+ * client_fd_fop_prepare_local or modifying it, as doing
+ * so requires changes in other places as well.
+ */
+
+ local = frame->local;
+ local->fd_out = fd_ref(args->fd_out);
+ local->attempt_reopen_out = client_is_reopen_needed(args->fd_out, this,
+ req.fd_out);
+
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_COPY_FILE_RANGE,
+ client4_0_copy_file_range_cbk, NULL,
+ (xdrproc_t)xdr_gfx_copy_file_range_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ /*
+ * If the lower layers fail to submit a request, they'll also
+ * do the unwind for us (see rpc_clnt_submit), so don't unwind
+ * here in such cases.
+ */
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
return 0;
+
unwind:
- CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
+ CLIENT_STACK_UNWIND(copy_file_range, frame, -1, op_errno, NULL, NULL, NULL,
+ NULL);
GF_FREE(req.xdata.pairs.pairs_val);
return 0;
}
int32_t
-client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
+client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data)
{
clnt_args_t *args = NULL;
- int64_t remote_fd = -1;
clnt_conf_t *conf = NULL;
- gfx_rchecksum_req req = {
+ gfx_fsetattr_req req = {
{0},
};
int op_errno = ESTALE;
@@ -5904,240 +5980,71 @@ client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
args = data;
conf = this->private;
- CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno,
- unwind);
-
- req.len = args->len;
- req.offset = args->offset;
- req.fd = remote_fd;
- memcpy(req.gfid, args->fd->inode->gfid, 16);
-
- dict_to_xdr(args->xdata, &req.xdata);
-
- ret = client_submit_request(
- this, &req, frame, conf->fops, GFS3_OP_RCHECKSUM, client4_rchecksum_cbk,
- NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfx_rchecksum_req);
+ ret = client_pre_fsetattr_v2(this, &req, args->fd, args->valid, args->stbuf,
+ args->xdata);
+ if (ret) {
+ op_errno = -ret;
+ goto unwind;
+ }
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR,
+ client4_0_fsetattr_cbk, NULL,
+ (xdrproc_t)xdr_gfx_fsetattr_req);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
- "failed to send the fop");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
GF_FREE(req.xdata.pairs.pairs_val);
return 0;
unwind:
- CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL);
+ CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
return 0;
}
-int
-client4_0_compound_cbk(struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
-{
- gfx_compound_rsp rsp = {
- 0,
- };
- compound_args_cbk_t *args_cbk = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
- clnt_local_t *local = NULL;
- int i = 0;
- int length = 0;
- int ret = -1;
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_compound_rsp);
- if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- length = local->length;
-
- xdr_to_dict(&rsp.xdata, &xdata);
-
- args_cbk = compound_args_cbk_alloc(length, xdata);
- if (!args_cbk) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOMEM;
- goto out;
- }
-
- /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
- for (i = 0; i < args_cbk->fop_length; i++) {
- ret = client_process_response_v2(frame, this, req, &rsp, args_cbk, i);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
- }
- rsp.op_ret = 0;
-out:
- if (rsp.op_ret == -1) {
- gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
- }
- CLIENT_STACK_UNWIND(compound, frame, rsp.op_ret,
- gf_error_to_errno(rsp.op_errno), args_cbk, xdata);
-
- client_compound_rsp_cleanup_v2(&rsp, length);
- free(rsp.compound_rsp_array.compound_rsp_array_val);
-
- if (xdata)
- dict_unref(xdata);
-
- compound_args_cbk_cleanup(args_cbk);
- return 0;
-}
-
-/* Brief explanation of gfs3_compound_req structure :
- * 1) It consists of version of compounding.
- * 2) A compound-fop enum, new enum for compound fops
- * 3) A 'compound_req_arrray' structure that has
- * a) array len - based on the number of fops compounded
- * b) compound_req_array_val - pointer to an array of compound_req's
- * 4) compound_req - structure that contains:
- * a) fop enum of type glusterfs_fop_t
- * b) union of structures of xdr requests of all fops.
- */
-
int32_t
-client4_0_compound(call_frame_t *frame, xlator_t *this, void *data)
+client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data)
{
+ clnt_args_t *args = NULL;
+ int64_t remote_fd = -1;
clnt_conf_t *conf = NULL;
- compound_args_t *c_args = data;
- gfx_compound_req req = {
- 0,
- };
- clnt_local_t *local = NULL;
- int op_errno = ENOMEM;
- int ret = 0;
- int i = 0;
- int rsp_count = 0;
- struct iovec rsp_vector[MAX_IOVEC] = {
- {0},
- };
- struct iovec req_vector[MAX_IOVEC] = {
- {0},
- };
- struct iovec vector[MAX_IOVEC] = {
+ gfx_rchecksum_req req = {
{0},
};
- struct iovec *rsphdr = NULL;
- struct iobref *req_iobref = NULL;
- struct iobref *rsp_iobref = NULL;
- struct iobref *rsphdr_iobref = NULL;
- struct iobuf *rsphdr_iobuf = NULL;
- int rsphdr_count = 0;
- int req_count = 0;
- dict_t *xdata = c_args->xdata;
-
- GF_ASSERT(frame);
+ int op_errno = ESTALE;
+ int ret = 0;
- if (!this)
+ if (!frame || !this || !data)
goto unwind;
- memset(req_vector, 0, sizeof(req_vector));
- memset(rsp_vector, 0, sizeof(rsp_vector));
-
+ args = data;
conf = this->private;
- local = mem_get0(this->local_pool);
- if (!local) {
- op_errno = ENOMEM;
- goto unwind;
- }
- frame->local = local;
-
- local->length = c_args->fop_length;
- local->compound_args = c_args;
-
- rsphdr_iobref = iobref_new();
- if (rsphdr_iobref == NULL) {
- goto unwind;
- }
-
- /* TODO: what is the size we should send ? */
- rsphdr_iobuf = iobuf_get(this->ctx->iobuf_pool);
- if (rsphdr_iobuf == NULL) {
- goto unwind;
- }
-
- rsphdr = &vector[0];
- rsphdr->iov_base = iobuf_ptr(rsphdr_iobuf);
- rsphdr->iov_len = iobuf_pagesize(rsphdr_iobuf);
- rsphdr_count = 1;
- iobref_add(rsphdr_iobref, rsphdr_iobuf);
- iobuf_unref(rsphdr_iobuf);
- rsphdr_iobuf = NULL;
-
- req.compound_fop_enum = c_args->fop_enum;
- req.compound_req_array.compound_req_array_len = c_args->fop_length;
- req.compound_version = 0;
- dict_to_xdr(xdata, &req.xdata);
+ CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno,
+ unwind);
- req.compound_req_array.compound_req_array_val = GF_CALLOC(
- local->length, sizeof(compound_req_v2), gf_client_mt_compound_req_t);
+ req.len = args->len;
+ req.offset = args->offset;
+ req.fd = remote_fd;
+ memcpy(req.gfid, args->fd->inode->gfid, 16);
- if (!req.compound_req_array.compound_req_array_val) {
- op_errno = ENOMEM;
- goto unwind;
- }
+ dict_to_xdr(args->xdata, &req.xdata);
- for (i = 0; i < local->length; i++) {
- ret = client_handle_fop_requirements_v2(
- this, frame, &req, local, &req_iobref, &rsp_iobref, req_vector,
- rsp_vector, &req_count, &rsp_count, &c_args->req_list[i],
- c_args->enum_list[i], i);
- if (ret) {
- op_errno = ret;
- goto unwind;
- }
+ ret = client_submit_request(this, &req, frame, conf->fops,
+ GFS3_OP_RCHECKSUM, client4_rchecksum_cbk, NULL,
+ (xdrproc_t)xdr_gfx_rchecksum_req);
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL);
}
- local->iobref = rsp_iobref;
- rsp_iobref = NULL;
-
- ret = client_submit_compound_request(
- this, &req, frame, conf->fops, GFS3_OP_COMPOUND, client4_0_compound_cbk,
- req_vector, req_count, req_iobref, rsphdr, rsphdr_count, rsp_vector,
- rsp_count, local->iobref, (xdrproc_t)xdr_gfx_compound_req);
-
GF_FREE(req.xdata.pairs.pairs_val);
- iobref_unref(rsphdr_iobref);
-
- compound_request_cleanup_v2(&req);
return 0;
unwind:
- CLIENT_STACK_UNWIND(compound, frame, -1, op_errno, NULL, NULL);
-
- if (rsp_iobref)
- iobref_unref(rsp_iobref);
-
- if (rsphdr_iobref)
- iobref_unref(rsphdr_iobref);
-
+ CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL);
GF_FREE(req.xdata.pairs.pairs_val);
- compound_request_cleanup_v2(&req);
return 0;
}
@@ -6254,9 +6161,10 @@ rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = {
[GF_FOP_LEASE] = {"LEASE", client4_0_lease},
[GF_FOP_GETACTIVELK] = {"GETACTIVELK", client4_0_getactivelk},
[GF_FOP_SETACTIVELK] = {"SETACTIVELK", client4_0_setactivelk},
- [GF_FOP_COMPOUND] = {"COMPOUND", client4_0_compound},
+ [GF_FOP_COMPOUND] = {"COMPOUND", NULL},
[GF_FOP_ICREATE] = {"ICREATE", client4_0_icreate},
[GF_FOP_NAMELINK] = {"NAMELINK", client4_0_namelink},
+ [GF_FOP_COPY_FILE_RANGE] = {"COPY-FILE-RANGE", client4_0_copy_file_range},
};
rpc_clnt_prog_t clnt4_0_fop_prog = {
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index c5bf28dcfb6..0f31fea9511 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -9,12 +9,12 @@
*/
#include "client.h"
-#include "xlator.h"
-#include "defaults.h"
-#include "glusterfs.h"
-#include "statedump.h"
-#include "compat-errno.h"
-#include "gf-event.h"
+#include <glusterfs/xlator.h>
+#include <glusterfs/defaults.h>
+#include <glusterfs/glusterfs.h>
+#include <glusterfs/statedump.h>
+#include <glusterfs/compat-errno.h>
+#include <glusterfs/gf-event.h>
#include "xdr-rpc.h"
#include "glusterfs3.h"
@@ -26,12 +26,8 @@ extern struct rpcclnt_cb_program gluster_cbk_prog;
int
client_handshake(xlator_t *this, struct rpc_clnt *rpc);
-int
-client_init_rpc(xlator_t *this);
-int
+static int
client_destroy_rpc(xlator_t *this);
-int
-client_mark_fd_bad(xlator_t *this);
static void
client_filter_o_direct(clnt_conf_t *conf, int32_t *flags)
@@ -46,29 +42,87 @@ client_fini_complete(xlator_t *this)
GF_VALIDATE_OR_GOTO(this->name, this->private, out);
clnt_conf_t *conf = this->private;
-
if (!conf->destroy)
return 0;
- this->private = NULL;
-
- pthread_spin_destroy(&conf->fd_lock);
- pthread_mutex_destroy(&conf->lock);
- GF_FREE(conf);
+ pthread_mutex_lock(&conf->lock);
+ {
+ conf->fini_completed = _gf_true;
+ pthread_cond_broadcast(&conf->fini_complete_cond);
+ }
+ pthread_mutex_unlock(&conf->lock);
out:
return 0;
}
+static int
+client_is_last_child_down(xlator_t *this, int32_t event, struct rpc_clnt *rpc)
+{
+ rpc_clnt_connection_t *conn = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ if (!this || !rpc)
+ goto out;
+
+ conf = this->private;
+ if (!conf)
+ goto out;
+
+ if (!conf->parent_down)
+ goto out;
+
+ if (event != GF_EVENT_CHILD_DOWN)
+ goto out;
+
+ conn = &rpc->conn;
+ pthread_mutex_lock(&conn->lock);
+ {
+ if (!conn->reconnect && rpc->disabled) {
+ ret = 1;
+ }
+ }
+ pthread_mutex_unlock(&conn->lock);
+out:
+ return ret;
+}
+
int
client_notify_dispatch_uniq(xlator_t *this, int32_t event, void *data, ...)
{
clnt_conf_t *conf = this->private;
+ glusterfs_ctx_t *ctx = this->ctx;
+ glusterfs_graph_t *graph = this->graph;
+
+ pthread_mutex_lock(&ctx->notify_lock);
+ {
+ while (ctx->notifying)
+ pthread_cond_wait(&ctx->notify_cond, &ctx->notify_lock);
+
+ if (client_is_last_child_down(this, event, data) && graph) {
+ pthread_mutex_lock(&graph->mutex);
+ {
+ graph->parent_down++;
+ if (graph->parent_down == graph_total_client_xlator(graph)) {
+ graph->used = 0;
+ pthread_cond_broadcast(&graph->child_down_cond);
+ }
+ }
+ pthread_mutex_unlock(&graph->mutex);
+ }
+ }
+ pthread_mutex_unlock(&ctx->notify_lock);
if (conf->last_sent_event == event)
return 0;
return client_notify_dispatch(this, event, data);
+
+ /* Please avoid any code that access xlator object here
+ * Because for a child down event, once we do the signal
+ * we will start cleanup.
+ */
}
int
@@ -76,6 +130,7 @@ client_notify_dispatch(xlator_t *this, int32_t event, void *data, ...)
{
int ret = -1;
glusterfs_ctx_t *ctx = this->ctx;
+
clnt_conf_t *conf = this->private;
pthread_mutex_lock(&ctx->notify_lock);
@@ -89,6 +144,7 @@ client_notify_dispatch(xlator_t *this, int32_t event, void *data, ...)
/* We assume that all translators in the graph handle notification
* events in sequence.
* */
+
ret = default_notify(this, event, data);
/* NB (Even) with MT-epoll and EPOLLET|EPOLLONESHOT we are guaranteed
@@ -105,36 +161,18 @@ client_notify_dispatch(xlator_t *this, int32_t event, void *data, ...)
}
pthread_mutex_unlock(&ctx->notify_lock);
- return ret;
-}
-
-int32_t
-client_type_to_gf_type(short l_type)
-{
- int32_t gf_type = GF_LK_EOL;
-
- switch (l_type) {
- case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ /* Please avoid any code that access xlator object here
+ * Because for a child down event, once we do the signal
+ * we will start cleanup.
+ */
- return gf_type;
+ return ret;
}
int
client_submit_request(xlator_t *this, void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn,
- struct iobref *iobref, struct iovec *payload,
- int payloadcnt, struct iovec *rsp_payload,
- int rsp_payload_count, struct iobref *rsp_iobref,
- xdrproc_t xdrproc)
+ client_payload_t *cp, xdrproc_t xdrproc)
{
int ret = -1;
clnt_conf_t *conf = NULL;
@@ -180,21 +218,18 @@ client_submit_request(xlator_t *this, void *req, call_frame_t *frame,
goto out;
}
- if (iobref != NULL) {
- ret = iobref_merge(new_iobref, iobref);
+ if (cp && cp->iobref != NULL) {
+ ret = iobref_merge(new_iobref, cp->iobref);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "cannot merge "
- "iobref passed from caller into "
- "new_iobref");
+ gf_smsg(this->name, GF_LOG_WARNING, ENOMEM,
+ PC_MSG_MERGE_IOBREF_FAILED, NULL);
}
}
ret = iobref_add(new_iobref, iobuf);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
- "cannot add iobuf into "
- "iobref");
+ gf_smsg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_ADD_IOBUF_FAILED,
+ NULL);
goto out;
}
@@ -224,130 +259,17 @@ client_submit_request(xlator_t *this, void *req, call_frame_t *frame,
}
/* Send the msg */
- ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count, payload,
- payloadcnt, new_iobref, frame, payload, payloadcnt,
- rsp_payload, rsp_payload_count, rsp_iobref);
-
- if (ret < 0) {
- gf_msg_debug(this->name, 0, "rpc_clnt_submit failed");
- }
-
- ret = 0;
-
- if (new_iobref)
- iobref_unref(new_iobref);
-
- if (iobuf)
- iobuf_unref(iobuf);
-
- return ret;
-
-out:
- rpcreq.rpc_status = -1;
-
- cbkfn(&rpcreq, NULL, 0, frame);
-
- if (new_iobref)
- iobref_unref(new_iobref);
-
- if (iobuf)
- iobuf_unref(iobuf);
-
- return ret;
-}
-
-int
-client_submit_compound_request(xlator_t *this, void *req, call_frame_t *frame,
- rpc_clnt_prog_t *prog, int procnum,
- fop_cbk_fn_t cbkfn, struct iovec *req_payload,
- int req_count, struct iobref *iobref,
- struct iovec *rsphdr, int rsphdr_count,
- struct iovec *rsp_payload, int rsp_payload_count,
- struct iobref *rsp_iobref, xdrproc_t xdrproc)
-{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- struct iovec iov = {
- 0,
- };
- struct iobuf *iobuf = NULL;
- int count = 0;
- struct iobref *new_iobref = NULL;
- ssize_t xdr_size = 0;
- struct rpc_req rpcreq = {
- 0,
- };
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- GF_VALIDATE_OR_GOTO(this->name, prog, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
-
- conf = this->private;
-
- /* If 'setvolume' is not successful, we should not send frames to
- * server
- */
-
- if (!conf->connected) {
- gf_msg_debug(this->name, 0, "connection in disconnected state");
- goto out;
+ if (cp) {
+ ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count,
+ cp->payload, cp->payload_cnt, new_iobref, frame,
+ cp->rsphdr, cp->rsphdr_cnt, cp->rsp_payload,
+ cp->rsp_payload_cnt, cp->rsp_iobref);
+ } else {
+ ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count,
+ NULL, 0, new_iobref, frame, NULL, 0, NULL, 0,
+ NULL);
}
- if (req && xdrproc) {
- xdr_size = xdr_sizeof(xdrproc, req);
- iobuf = iobuf_get2(this->ctx->iobuf_pool, xdr_size);
- if (!iobuf) {
- goto out;
- };
-
- new_iobref = iobref_new();
- if (!new_iobref) {
- goto out;
- }
-
- if (iobref != NULL) {
- ret = iobref_merge(new_iobref, iobref);
- if (ret != 0) {
- goto out;
- }
- }
-
- ret = iobref_add(new_iobref, iobuf);
- if (ret != 0) {
- goto out;
- }
-
- iov.iov_base = iobuf->ptr;
- iov.iov_len = iobuf_size(iobuf);
-
- /* Create the xdr payload */
- ret = xdr_serialize_generic(iov, req, xdrproc);
- if (ret == -1) {
- /* callingfn so that, we can get to know which xdr
- function was called */
- gf_log_callingfn(this->name, GF_LOG_WARNING,
- "XDR payload creation failed");
- goto out;
- }
- iov.iov_len = ret;
- count = 1;
- }
-
- /* do not send all groups if they are resolved server-side */
- if (!conf->send_gids) {
- if (frame->root->ngrps <= SMALL_GROUP_COUNT) {
- frame->root->groups_small[0] = frame->root->gid;
- frame->root->groups = frame->root->groups_small;
- }
- frame->root->ngrps = 1;
- }
-
- /* Send the msg */
- ret = rpc_clnt_submit(conf->rpc, prog, procnum, cbkfn, &iov, count,
- req_payload, req_count, new_iobref, frame, rsphdr,
- rsphdr_count, rsp_payload, rsp_payload_count,
- rsp_iobref);
-
if (ret < 0) {
gf_msg_debug(this->name, 0, "rpc_clnt_submit failed");
}
@@ -373,17 +295,17 @@ out:
if (iobuf)
iobuf_unref(iobuf);
- return 0;
+ return ret;
}
-int32_t
+static int32_t
client_forget(xlator_t *this, inode_t *inode)
{
/* Nothing here */
return 0;
}
-int32_t
+static int32_t
client_releasedir(xlator_t *this, fd_t *fd)
{
int ret = -1;
@@ -397,20 +319,19 @@ client_releasedir(xlator_t *this, fd_t *fd)
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
-
proc = &conf->fops->proctable[GF_FOP_RELEASEDIR];
if (proc->fn) {
+ args.fd = fd;
ret = proc->fn(NULL, this, &args);
}
out:
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DIR_OP_FAILED,
- "releasedir fop failed");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_RELEASE_DIR_OP_FAILED,
+ NULL);
return 0;
}
-int32_t
+static int32_t
client_release(xlator_t *this, fd_t *fd)
{
int ret = -1;
@@ -424,19 +345,18 @@ client_release(xlator_t *this, fd_t *fd)
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
proc = &conf->fops->proctable[GF_FOP_RELEASE];
if (proc->fn) {
+ args.fd = fd;
ret = proc->fn(NULL, this, &args);
}
out:
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED,
- "release fop failed");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED, NULL);
return 0;
}
-int32_t
+static int32_t
client_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
int ret = -1;
@@ -450,12 +370,12 @@ client_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_LOOKUP];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
/* think of avoiding a missing frame */
if (ret)
@@ -465,7 +385,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
int ret = -1;
@@ -479,12 +399,12 @@ client_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_STAT];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(stat, frame, -1, ENOTCONN, NULL, NULL);
@@ -492,7 +412,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
dict_t *xdata)
{
@@ -507,13 +427,13 @@ client_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.offset = offset;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_TRUNCATE];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.offset = offset;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(truncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -521,7 +441,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
dict_t *xdata)
{
@@ -536,13 +456,13 @@ client_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.offset = offset;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FTRUNCATE];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.offset = offset;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -550,7 +470,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
dict_t *xdata)
{
@@ -565,13 +485,13 @@ client_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.mask = mask;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_ACCESS];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mask = mask;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(access, frame, -1, ENOTCONN, NULL);
@@ -579,7 +499,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
dict_t *xdata)
{
@@ -594,13 +514,13 @@ client_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.size = size;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_READLINK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.size = size;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(readlink, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -608,7 +528,7 @@ out:
return 0;
}
-int
+static int
client_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dev_t rdev, mode_t umask, dict_t *xdata)
{
@@ -623,15 +543,15 @@ client_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.mode = mode;
- args.rdev = rdev;
- args.umask = umask;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_MKNOD];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mode = mode;
+ args.rdev = rdev;
+ args.umask = umask;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(mknod, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -640,7 +560,7 @@ out:
return 0;
}
-int
+static int
client_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
mode_t umask, dict_t *xdata)
{
@@ -655,14 +575,14 @@ client_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.mode = mode;
- args.umask = umask;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_MKDIR];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mode = mode;
+ args.umask = umask;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(mkdir, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -671,7 +591,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
dict_t *xdata)
{
@@ -686,13 +606,13 @@ client_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
- args.flags = xflag;
-
proc = &conf->fops->proctable[GF_FOP_UNLINK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
+ args.flags = xflag;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(unlink, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -700,7 +620,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
dict_t *xdata)
{
@@ -715,13 +635,13 @@ client_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.flags = flags;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_RMDIR];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.flags = flags;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
/* think of avoiding a missing frame */
if (ret)
@@ -730,7 +650,7 @@ out:
return 0;
}
-int
+static int
client_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
loc_t *loc, mode_t umask, dict_t *xdata)
{
@@ -745,14 +665,14 @@ client_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
if (!conf || !conf->fops)
goto out;
- args.linkname = linkpath;
- args.loc = loc;
- args.umask = umask;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_SYMLINK];
- if (proc->fn)
+ if (proc->fn) {
+ args.linkname = linkpath;
+ args.loc = loc;
+ args.umask = umask;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(symlink, frame, -1, ENOTCONN, NULL, NULL, NULL,
@@ -761,7 +681,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata)
{
@@ -776,13 +696,13 @@ client_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
if (!conf || !conf->fops)
goto out;
- args.oldloc = oldloc;
- args.newloc = newloc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_RENAME];
- if (proc->fn)
+ if (proc->fn) {
+ args.oldloc = oldloc;
+ args.newloc = newloc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(rename, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -791,7 +711,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata)
{
@@ -806,13 +726,13 @@ client_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
if (!conf || !conf->fops)
goto out;
- args.oldloc = oldloc;
- args.newloc = newloc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_LINK];
- if (proc->fn)
+ if (proc->fn) {
+ args.oldloc = oldloc;
+ args.newloc = newloc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(link, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -821,7 +741,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
{
@@ -836,18 +756,17 @@ client_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.mode = mode;
- args.fd = fd;
- args.umask = umask;
- args.xdata = xdata;
- args.flags = flags;
-
- client_filter_o_direct(conf, &args.flags);
-
proc = &conf->fops->proctable[GF_FOP_CREATE];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mode = mode;
+ args.fd = fd;
+ args.umask = umask;
+ args.xdata = xdata;
+ args.flags = flags;
+ client_filter_o_direct(conf, &args.flags);
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(create, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -856,7 +775,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, dict_t *xdata)
{
@@ -871,17 +790,15 @@ client_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.fd = fd;
- args.xdata = xdata;
- args.flags = flags;
-
- client_filter_o_direct(conf, &args.flags);
-
proc = &conf->fops->proctable[GF_FOP_OPEN];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.fd = fd;
+ args.xdata = xdata;
+ args.flags = flags;
+ client_filter_o_direct(conf, &args.flags);
ret = proc->fn(frame, this, &args);
-
+ }
out:
if (ret)
STACK_UNWIND_STRICT(open, frame, -1, ENOTCONN, NULL, NULL);
@@ -889,7 +806,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, uint32_t flags, dict_t *xdata)
{
@@ -904,18 +821,17 @@ client_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.size = size;
- args.offset = offset;
- args.flags = flags;
- args.xdata = xdata;
-
- client_filter_o_direct(conf, &args.flags);
-
proc = &conf->fops->proctable[GF_FOP_READ];
- if (proc->fn)
- ret = proc->fn(frame, this, &args);
+ if (proc->fn) {
+ args.fd = fd;
+ args.size = size;
+ args.offset = offset;
+ args.flags = flags;
+ args.xdata = xdata;
+ client_filter_o_direct(conf, &args.flags);
+ ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(readv, frame, -1, ENOTCONN, NULL, 0, NULL, NULL,
@@ -924,7 +840,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count, off_t off, uint32_t flags,
struct iobref *iobref, dict_t *xdata)
@@ -940,20 +856,19 @@ client_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.vector = vector;
- args.count = count;
- args.offset = off;
- args.size = iov_length(vector, count);
- args.flags = flags;
- args.iobref = iobref;
- args.xdata = xdata;
-
- client_filter_o_direct(conf, &args.flags);
-
proc = &conf->fops->proctable[GF_FOP_WRITE];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.vector = vector;
+ args.count = count;
+ args.offset = off;
+ args.size = iov_length(vector, count);
+ args.flags = flags;
+ args.iobref = iobref;
+ args.xdata = xdata;
+ client_filter_o_direct(conf, &args.flags);
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(writev, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -961,7 +876,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
int ret = -1;
@@ -975,12 +890,12 @@ client_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FLUSH];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(flush, frame, -1, ENOTCONN, NULL);
@@ -988,7 +903,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
dict_t *xdata)
{
@@ -1003,13 +918,13 @@ client_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.flags = flags;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FSYNC];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.flags = flags;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fsync, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1017,7 +932,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
int ret = -1;
@@ -1031,12 +946,12 @@ client_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FSTAT];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fstat, frame, -1, ENOTCONN, NULL, NULL);
@@ -1044,7 +959,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
dict_t *xdata)
{
@@ -1059,13 +974,13 @@ client_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.fd = fd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_OPENDIR];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.fd = fd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(opendir, frame, -1, ENOTCONN, NULL, NULL);
@@ -1088,13 +1003,13 @@ client_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.flags = flags;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FSYNCDIR];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.flags = flags;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fsyncdir, frame, -1, ENOTCONN, NULL);
@@ -1102,7 +1017,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
int ret = -1;
@@ -1116,12 +1031,12 @@ client_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_STATFS];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(statfs, frame, -1, ENOTCONN, NULL, NULL);
@@ -1129,13 +1044,47 @@ out:
return 0;
}
+static int32_t
+client_copy_file_range(call_frame_t *frame, xlator_t *this, fd_t *fd_in,
+ off_t off_in, fd_t *fd_out, off_t off_out, size_t len,
+ uint32_t flags, dict_t *xdata)
+{
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {
+ 0,
+ };
+
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
+
+ proc = &conf->fops->proctable[GF_FOP_COPY_FILE_RANGE];
+ if (proc->fn) {
+ args.fd = fd_in;
+ args.fd_out = fd_out;
+ args.offset = off_in;
+ args.off_out = off_out;
+ args.size = len;
+ args.flags = flags;
+ args.xdata = xdata;
+ ret = proc->fn(frame, this, &args);
+ }
+out:
+ if (ret)
+ STACK_UNWIND_STRICT(copy_file_range, frame, -1, ENOTCONN, NULL, NULL,
+ NULL, NULL);
+
+ return 0;
+}
+
static gf_boolean_t
is_client_rpc_init_command(dict_t *dict, xlator_t *this, char **value)
{
gf_boolean_t ret = _gf_false;
- int dict_ret = -1;
- dict_ret = dict_get_str(dict, CLIENT_CMD_CONNECT, value);
+ int dict_ret = dict_get_str_sizen(dict, CLIENT_CMD_CONNECT, value);
if (dict_ret) {
gf_msg_trace(this->name, 0, "key %s not present", CLIENT_CMD_CONNECT);
goto out;
@@ -1159,7 +1108,7 @@ is_client_rpc_destroy_command(dict_t *dict, xlator_t *this)
goto out;
}
- dict_ret = dict_get_str(dict, CLIENT_CMD_DISCONNECT, &dummy);
+ dict_ret = dict_get_str_sizen(dict, CLIENT_CMD_DISCONNECT, &dummy);
if (dict_ret) {
gf_msg_trace(this->name, 0, "key %s not present",
CLIENT_CMD_DISCONNECT);
@@ -1183,9 +1132,12 @@ client_set_remote_options(char *value, xlator_t *this)
char *remote_port_str = NULL;
char *tmp = NULL;
int remote_port = 0;
- int ret = 0;
+ int ret = -1;
dup_value = gf_strdup(value);
+ if (dup_value == NULL) {
+ goto out;
+ }
host = strtok_r(dup_value, ":", &tmp);
subvol = strtok_r(NULL, ":", &tmp);
remote_port_str = strtok_r(NULL, ":", &tmp);
@@ -1195,10 +1147,11 @@ client_set_remote_options(char *value, xlator_t *this)
if (!host_dup) {
goto out;
}
- ret = dict_set_dynstr(this->options, "remote-host", host_dup);
+ ret = dict_set_dynstr_sizen(this->options, "remote-host", host_dup);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
+ gf_smsg(this->name, GF_LOG_WARNING, 0,
+ PC_MSG_REMOTE_HOST_SET_FAILED, "host=%s", host, NULL);
+ GF_FREE(host_dup);
goto out;
}
}
@@ -1209,10 +1162,12 @@ client_set_remote_options(char *value, xlator_t *this)
goto out;
}
- ret = dict_set_dynstr(this->options, "remote-subvolume", subvol_dup);
+ ret = dict_set_dynstr_sizen(this->options, "remote-subvolume",
+ subvol_dup);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
+ gf_smsg(this->name, GF_LOG_WARNING, 0,
+ PC_MSG_REMOTE_HOST_SET_FAILED, "host=%s", host, NULL);
+ GF_FREE(subvol_dup);
goto out;
}
}
@@ -1220,10 +1175,10 @@ client_set_remote_options(char *value, xlator_t *this)
if (remote_port_str) {
remote_port = atoi(remote_port_str);
- ret = dict_set_int32(this->options, "remote-port", remote_port);
+ ret = dict_set_int32_sizen(this->options, "remote-port", remote_port);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-port to %d", remote_port);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_REMOTE_PORT_SET_FAILED,
+ "remote-port=%d", remote_port, NULL);
goto out;
}
}
@@ -1235,7 +1190,7 @@ out:
return ret;
}
-int32_t
+static int32_t
client_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
int32_t flags, dict_t *xdata)
{
@@ -1252,8 +1207,7 @@ client_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
if (is_client_rpc_init_command(dict, this, &value) == _gf_true) {
GF_ASSERT(value);
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
- "client rpc init command");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT, NULL);
ret = client_set_remote_options(value, this);
if (!ret) {
op_ret = 0;
@@ -1264,8 +1218,7 @@ client_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
}
if (is_client_rpc_destroy_command(dict, this) == _gf_true) {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY,
- "client rpc destroy command");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY, NULL);
ret = client_destroy_rpc(this);
if (ret) {
op_ret = 0;
@@ -1282,13 +1235,12 @@ client_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
goto out;
}
- args.loc = loc;
- args.xattr = dict;
- args.flags = flags;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_SETXATTR];
if (proc->fn) {
+ args.loc = loc;
+ args.xattr = dict;
+ args.flags = flags;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
if (ret) {
need_unwind = 1;
@@ -1301,7 +1253,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
int32_t flags, dict_t *xdata)
{
@@ -1316,14 +1268,14 @@ client_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.xattr = dict;
- args.flags = flags;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FSETXATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.xattr = dict;
+ args.flags = flags;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fsetxattr, frame, -1, ENOTCONN, NULL);
@@ -1331,7 +1283,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata)
{
@@ -1346,13 +1298,13 @@ client_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.name = name;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FGETXATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.name = name;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fgetxattr, frame, -1, ENOTCONN, NULL, NULL);
@@ -1360,7 +1312,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
@@ -1375,13 +1327,13 @@ client_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.name = name;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_GETXATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.name = name;
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(getxattr, frame, -1, ENOTCONN, NULL, NULL);
@@ -1389,7 +1341,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
@@ -1404,14 +1356,14 @@ client_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.flags = flags;
- args.xattr = dict;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_XATTROP];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.flags = flags;
+ args.xattr = dict;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(xattrop, frame, -1, ENOTCONN, NULL, NULL);
@@ -1419,7 +1371,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
{
@@ -1434,14 +1386,14 @@ client_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.flags = flags;
- args.xattr = dict;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FXATTROP];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.flags = flags;
+ args.xattr = dict;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOTCONN, NULL, NULL);
@@ -1449,7 +1401,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
@@ -1464,13 +1416,13 @@ client_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.name = name;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.name = name;
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(removexattr, frame, -1, ENOTCONN, NULL);
@@ -1478,7 +1430,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata)
{
@@ -1493,13 +1445,13 @@ client_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.name = name;
- args.fd = fd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.name = name;
+ args.fd = fd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fremovexattr, frame, -1, ENOTCONN, NULL);
@@ -1507,7 +1459,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_lease(call_frame_t *frame, xlator_t *this, loc_t *loc,
struct gf_lease *lease, dict_t *xdata)
{
@@ -1522,13 +1474,13 @@ client_lease(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.lease = lease;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_LEASE];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.lease = lease;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(lk, frame, -1, ENOTCONN, NULL, NULL);
@@ -1536,7 +1488,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
struct gf_flock *lock, dict_t *xdata)
{
@@ -1551,14 +1503,14 @@ client_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.cmd = cmd;
- args.flock = lock;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_LK];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(lk, frame, -1, ENOTCONN, NULL, NULL);
@@ -1566,7 +1518,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
{
@@ -1581,15 +1533,15 @@ client_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.cmd = cmd;
- args.flock = lock;
- args.volume = volume;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_INODELK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.volume = volume;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(inodelk, frame, -1, ENOTCONN, NULL);
@@ -1597,7 +1549,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
{
@@ -1612,15 +1564,15 @@ client_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.cmd = cmd;
- args.flock = lock;
- args.volume = volume;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FINODELK];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.cmd = cmd;
+ args.flock = lock;
+ args.volume = volume;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(finodelk, frame, -1, ENOTCONN, NULL);
@@ -1628,7 +1580,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_entrylk(call_frame_t *frame, xlator_t *this, const char *volume,
loc_t *loc, const char *basename, entrylk_cmd cmd,
entrylk_type type, dict_t *xdata)
@@ -1644,16 +1596,16 @@ client_entrylk(call_frame_t *frame, xlator_t *this, const char *volume,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.basename = basename;
- args.type = type;
- args.volume = volume;
- args.cmd_entrylk = cmd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_ENTRYLK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.basename = basename;
+ args.type = type;
+ args.volume = volume;
+ args.cmd_entrylk = cmd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(entrylk, frame, -1, ENOTCONN, NULL);
@@ -1661,7 +1613,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume,
fd_t *fd, const char *basename, entrylk_cmd cmd,
entrylk_type type, dict_t *xdata)
@@ -1677,16 +1629,16 @@ client_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.basename = basename;
- args.type = type;
- args.volume = volume;
- args.cmd_entrylk = cmd;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FENTRYLK];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.basename = basename;
+ args.type = type;
+ args.volume = volume;
+ args.cmd_entrylk = cmd;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOTCONN, NULL);
@@ -1694,7 +1646,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_rchecksum(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
int32_t len, dict_t *xdata)
{
@@ -1709,14 +1661,14 @@ client_rchecksum(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.offset = offset;
- args.len = len;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_RCHECKSUM];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.offset = offset;
+ args.len = len;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL);
@@ -1739,17 +1691,17 @@ client_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!conf || !conf->fops)
goto out;
- if (off != 0)
- off = gf_dirent_orig_offset(this, off);
-
- args.fd = fd;
- args.size = size;
- args.offset = off;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_READDIR];
- if (proc->fn)
+ if (proc->fn) {
+ if (off != 0)
+ off = gf_dirent_orig_offset(this, off);
+
+ args.fd = fd;
+ args.size = size;
+ args.offset = off;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(readdir, frame, -1, ENOTCONN, NULL, NULL);
@@ -1757,7 +1709,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t off, dict_t *dict)
{
@@ -1772,17 +1724,17 @@ client_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!conf || !conf->fops)
goto out;
- if (off != 0)
- off = gf_dirent_orig_offset(this, off);
-
- args.fd = fd;
- args.size = size;
- args.offset = off;
- args.xdata = dict;
-
proc = &conf->fops->proctable[GF_FOP_READDIRP];
- if (proc->fn)
+ if (proc->fn) {
+ if (off != 0)
+ off = gf_dirent_orig_offset(this, off);
+
+ args.fd = fd;
+ args.size = size;
+ args.offset = off;
+ args.xdata = dict;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(readdirp, frame, -1, ENOTCONN, NULL, NULL);
@@ -1790,7 +1742,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
@@ -1805,14 +1757,14 @@ client_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.stbuf = stbuf;
- args.valid = valid;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_SETATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.stbuf = stbuf;
+ args.valid = valid;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(setattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1820,7 +1772,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iatt *stbuf, int32_t valid, dict_t *xdata)
{
@@ -1835,14 +1787,14 @@ client_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.stbuf = stbuf;
- args.valid = valid;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FSETATTR];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.stbuf = stbuf;
+ args.valid = valid;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1850,7 +1802,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
off_t offset, size_t len, dict_t *xdata)
{
@@ -1865,15 +1817,15 @@ client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.flags = mode;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_FALLOCATE];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.flags = mode;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(fallocate, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1881,7 +1833,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
size_t len, dict_t *xdata)
{
@@ -1896,14 +1848,14 @@ client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_DISCARD];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(discard, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1911,7 +1863,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
off_t len, dict_t *xdata)
{
@@ -1926,14 +1878,14 @@ client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.offset = offset;
- args.size = len;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_ZEROFILL];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.offset = offset;
+ args.size = len;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(zerofill, frame, -1, ENOTCONN, NULL, NULL, NULL);
@@ -1941,7 +1893,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_ipc(call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
{
int ret = -1;
@@ -1955,12 +1907,12 @@ client_ipc(call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args.cmd = op;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_IPC];
- if (proc->fn)
+ if (proc->fn) {
+ args.cmd = op;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(ipc, frame, -1, ENOTCONN, NULL);
@@ -1968,7 +1920,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
gf_seek_what_t what, dict_t *xdata)
{
@@ -1983,14 +1935,14 @@ client_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
if (!conf || !conf->fops)
goto out;
- args.fd = fd;
- args.offset = offset;
- args.what = what;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_SEEK];
- if (proc->fn)
+ if (proc->fn) {
+ args.fd = fd;
+ args.offset = offset;
+ args.what = what;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(seek, frame, -1, ENOTCONN, 0, NULL);
@@ -1998,7 +1950,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_getactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
dict_t *xdata)
{
@@ -2013,12 +1965,12 @@ client_getactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_GETACTIVELK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(getactivelk, frame, -1, ENOTCONN, NULL, NULL);
@@ -2026,7 +1978,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_setactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
lock_migration_info_t *locklist, dict_t *xdata)
{
@@ -2041,13 +1993,13 @@ client_setactivelk(call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.xdata = xdata;
- args.locklist = locklist;
-
proc = &conf->fops->proctable[GF_FOP_SETACTIVELK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
+ args.locklist = locklist;
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(setactivelk, frame, -1, ENOTCONN, NULL);
@@ -2055,7 +2007,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_getspec(call_frame_t *frame, xlator_t *this, const char *key,
int32_t flags)
{
@@ -2070,12 +2022,11 @@ client_getspec(call_frame_t *frame, xlator_t *this, const char *key,
if (!conf || !conf->fops || !conf->handshake)
goto out;
- args.name = key;
- args.flags = flags;
-
/* For all other xlators, getspec is an fop, hence its in fops table */
proc = &conf->fops->proctable[GF_FOP_GETSPEC];
if (proc->fn) {
+ args.name = key;
+ args.flags = flags;
/* But at protocol level, this is handshake */
ret = proc->fn(frame, this, &args);
}
@@ -2086,7 +2037,7 @@ out:
return 0;
}
-int32_t
+static int32_t
client_compound(call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata)
{
int ret = -1;
@@ -2098,11 +2049,11 @@ client_compound(call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata)
if (!conf || !conf->fops)
goto out;
- args->xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_COMPOUND];
- if (proc->fn)
+ if (proc->fn) {
+ args->xdata = xdata;
ret = proc->fn(frame, this, args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(compound, frame, -1, ENOTCONN, NULL, NULL);
@@ -2124,20 +2075,19 @@ client_namelink(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (!conf || !conf->fops || !conf->handshake)
goto out;
- args.loc = loc;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_NAMELINK];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
-
+ }
out:
if (ret)
STACK_UNWIND_STRICT(namelink, frame, -1, EINVAL, NULL, NULL, NULL);
return 0;
}
-int32_t
+static int32_t
client_icreate(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dict_t *xdata)
{
@@ -2152,21 +2102,20 @@ client_icreate(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
if (!conf || !conf->fops || !conf->handshake)
goto out;
- args.loc = loc;
- args.mode = mode;
- args.xdata = xdata;
-
proc = &conf->fops->proctable[GF_FOP_ICREATE];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mode = mode;
+ args.xdata = xdata;
ret = proc->fn(frame, this, &args);
-
+ }
out:
if (ret)
STACK_UNWIND_STRICT(icreate, frame, -1, EINVAL, NULL, NULL, NULL);
return 0;
}
-int32_t
+static int32_t
client_put(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
mode_t umask, uint32_t flags, struct iovec *vector, int32_t count,
off_t off, struct iobref *iobref, dict_t *xattr, dict_t *xdata)
@@ -2182,23 +2131,23 @@ client_put(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
if (!conf || !conf->fops)
goto out;
- args.loc = loc;
- args.mode = mode;
- args.umask = umask;
- args.flags = flags;
- args.vector = vector;
- args.count = count;
- args.offset = off;
- args.size = iov_length(vector, count);
- args.iobref = iobref;
- args.xattr = xattr;
- args.xdata = xdata;
-
- client_filter_o_direct(conf, &args.flags);
-
proc = &conf->fops->proctable[GF_FOP_PUT];
- if (proc->fn)
+ if (proc->fn) {
+ args.loc = loc;
+ args.mode = mode;
+ args.umask = umask;
+ args.flags = flags;
+ args.vector = vector;
+ args.count = count;
+ args.offset = off;
+ args.size = iov_length(vector, count);
+ args.iobref = iobref;
+ args.xattr = xattr;
+ args.xdata = xdata;
+
+ client_filter_o_direct(conf, &args.flags);
ret = proc->fn(frame, this, &args);
+ }
out:
if (ret)
STACK_UNWIND_STRICT(put, frame, -1, ENOTCONN, NULL, NULL, NULL, NULL,
@@ -2207,14 +2156,12 @@ out:
return 0;
}
-int
+static void
client_mark_fd_bad(xlator_t *this)
{
- clnt_conf_t *conf = NULL;
+ clnt_conf_t *conf = this->private;
clnt_fd_ctx_t *tmp = NULL, *fdctx = NULL;
- conf = this->private;
-
pthread_spin_lock(&conf->fd_lock);
{
list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos)
@@ -2223,8 +2170,6 @@ client_mark_fd_bad(xlator_t *this)
}
}
pthread_spin_unlock(&conf->fd_lock);
-
- return 0;
}
int
@@ -2233,13 +2178,13 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
{
xlator_t *this = NULL;
clnt_conf_t *conf = NULL;
+ gf_boolean_t is_parent_down = _gf_false;
int ret = 0;
this = mydata;
if (!this || !this->private) {
- gf_msg("client", GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
- (this != NULL) ? "private structure of the xlator is NULL"
- : "xlator is NULL");
+ gf_smsg("client", GF_LOG_ERROR, EINVAL, PC_MSG_XLATOR_NULL,
+ (this != NULL) ? "private structue" : "", NULL);
goto out;
}
@@ -2247,10 +2192,12 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
switch (event) {
case RPC_CLNT_PING: {
- ret = default_notify(this, GF_EVENT_CHILD_PING, data);
- if (ret)
- gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed");
- conf->last_sent_event = GF_EVENT_CHILD_PING;
+ if (conf->connection_to_brick) {
+ ret = default_notify(this, GF_EVENT_CHILD_PING, data);
+ if (ret)
+ gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed");
+ conf->last_sent_event = GF_EVENT_CHILD_PING;
+ }
break;
}
case RPC_CLNT_CONNECT: {
@@ -2261,10 +2208,8 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
ret = client_handshake(this, rpc);
if (ret)
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_HANDSHAKE_RETURN,
- "handshake "
- "msg returned %d",
- ret);
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_HANDSHAKE_RETURN,
+ "ret=%d", ret, NULL);
break;
}
case RPC_CLNT_DISCONNECT:
@@ -2275,13 +2220,9 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
if (!conf->skip_notify) {
if (conf->can_log_disconnect) {
if (!conf->disconnect_err_logged) {
- gf_msg(this->name, GF_LOG_INFO, 0,
- PC_MSG_CLIENT_DISCONNECTED,
- "disconnected from %s. Client "
- "process will keep trying to "
- "connect to glusterd until "
- "brick's port is available",
- conf->rpc->conn.name);
+ gf_smsg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CLIENT_DISCONNECTED, "conn-name=%s",
+ conf->rpc->conn.name, NULL);
} else {
gf_msg_debug(this->name, 0,
"disconnected from %s. "
@@ -2294,17 +2235,35 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
if (conf->portmap_err_logged)
conf->disconnect_err_logged = 1;
}
+ /*
+ * Once we complete the child down notification,
+ * There is a chance that the graph might get freed,
+ * So it is not safe to access any xlator contens
+ * So here we are checking whether the parent is down
+ * or not.
+ */
+ pthread_mutex_lock(&conf->lock);
+ {
+ is_parent_down = conf->parent_down;
+ }
+ pthread_mutex_unlock(&conf->lock);
+
/* If the CHILD_DOWN event goes to parent xlator
multiple times, the logic of parent xlator notify
may get screwed up.. (eg. CHILD_MODIFIED event in
replicate), hence make sure events which are passed
to parent are genuine */
ret = client_notify_dispatch_uniq(this, GF_EVENT_CHILD_DOWN,
- NULL);
+ rpc);
+ if (is_parent_down) {
+ /* If parent is down, then there should not be any
+ * operation after a child down.
+ */
+ goto out;
+ }
if (ret)
- gf_msg(this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_DOWN_NOTIFY_FAILED,
- "CHILD_DOWN notify failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CHILD_DOWN_NOTIFY_FAILED, NULL);
} else {
if (conf->can_log_disconnect)
@@ -2317,11 +2276,13 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
conf->skip_notify = 0;
if (conf->quick_reconnect) {
+ conf->connection_to_brick = _gf_true;
conf->quick_reconnect = 0;
rpc_clnt_cleanup_and_start(rpc);
} else {
rpc->conn.config.remote_port = 0;
+ conf->connection_to_brick = _gf_false;
}
break;
case RPC_CLNT_DESTROY:
@@ -2342,6 +2303,8 @@ int
notify(xlator_t *this, int32_t event, void *data, ...)
{
clnt_conf_t *conf = NULL;
+ glusterfs_graph_t *graph = this->graph;
+ int ret = -1;
conf = this->private;
if (!conf)
@@ -2349,18 +2312,14 @@ notify(xlator_t *this, int32_t event, void *data, ...)
switch (event) {
case GF_EVENT_PARENT_UP: {
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP,
- "parent translators are ready, attempting connect "
- "on transport");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP, NULL);
rpc_clnt_start(conf->rpc);
break;
}
case GF_EVENT_PARENT_DOWN:
- gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN,
- "current graph is no longer active, destroying "
- "rpc_client ");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN, NULL);
pthread_mutex_lock(&conf->lock);
{
@@ -2368,7 +2327,19 @@ notify(xlator_t *this, int32_t event, void *data, ...)
}
pthread_mutex_unlock(&conf->lock);
- rpc_clnt_disable(conf->rpc);
+ ret = rpc_clnt_disable(conf->rpc);
+ if (ret == -1 && graph) {
+ pthread_mutex_lock(&graph->mutex);
+ {
+ graph->parent_down++;
+ if (graph->parent_down ==
+ graph_total_client_xlator(graph)) {
+ graph->used = 0;
+ pthread_cond_broadcast(&graph->child_down_cond);
+ }
+ }
+ pthread_mutex_unlock(&graph->mutex);
+ }
break;
default:
@@ -2383,31 +2354,28 @@ notify(xlator_t *this, int32_t event, void *data, ...)
return 0;
}
-int
+static int
client_check_remote_host(xlator_t *this, dict_t *options)
{
char *remote_host = NULL;
int ret = -1;
- ret = dict_get_str(options, "remote-host", &remote_host);
+ ret = dict_get_str_sizen(options, "remote-host", &remote_host);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, EINVAL, PC_MSG_DICT_GET_FAILED,
- "Remote host is not set. "
- "Assuming the volfile server as remote host");
+ gf_smsg(this->name, GF_LOG_INFO, EINVAL, PC_MSG_REMOTE_HOST_NOT_SET,
+ NULL);
if (!this->ctx->cmd_args.volfile_server) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_DICT_GET_FAILED,
- "No remote host to "
- "connect.");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_NOREMOTE_HOST,
+ NULL);
goto out;
}
- ret = dict_set_str(options, "remote-host",
- this->ctx->cmd_args.volfile_server);
+ ret = dict_set_str_sizen(options, "remote-host",
+ this->ctx->cmd_args.volfile_server);
if (ret == -1) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_GET_FAILED,
- "Failed to set the "
- "remote host");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_REMOTE_HOST_SET_FAILED,
+ NULL);
goto out;
}
}
@@ -2417,14 +2385,11 @@ out:
return ret;
}
-int
+static int
build_client_config(xlator_t *this, clnt_conf_t *conf)
{
int ret = -1;
- if (!conf)
- goto out;
-
GF_OPTION_INIT("frame-timeout", conf->rpc_conf.rpc_timeout, int32, out);
GF_OPTION_INIT("remote-port", conf->rpc_conf.remote_port, int32, out);
@@ -2433,13 +2398,16 @@ build_client_config(xlator_t *this, clnt_conf_t *conf)
GF_OPTION_INIT("remote-subvolume", conf->opt.remote_subvolume, path, out);
if (!conf->opt.remote_subvolume)
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "option 'remote-subvolume' not given");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_REMOTE_SUBVOL_NOT_GIVEN, NULL);
GF_OPTION_INIT("filter-O_DIRECT", conf->filter_o_direct, bool, out);
GF_OPTION_INIT("send-gids", conf->send_gids, bool, out);
+ GF_OPTION_INIT("testing.old-protocol", conf->old_protocol, bool, out);
+ GF_OPTION_INIT("strict-locks", conf->strict_locks, bool, out);
+
conf->client_id = glusterfs_leaf_position(this);
ret = client_check_remote_host(this, this->options);
@@ -2462,15 +2430,14 @@ mem_acct_init(xlator_t *this)
ret = xlator_mem_acct_init(this, gf_client_mt_end + 1);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
- "Memory accounting init failed");
+ gf_smsg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY, NULL);
return ret;
}
return ret;
}
-int
+static int
client_destroy_rpc(xlator_t *this)
{
int ret = -1;
@@ -2490,15 +2457,13 @@ client_destroy_rpc(xlator_t *this)
goto out;
}
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL,
- "RPC destroy called on already destroyed "
- "connection");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL, NULL);
out:
return ret;
}
-int
+static int
client_init_rpc(xlator_t *this)
{
int ret = -1;
@@ -2507,24 +2472,20 @@ client_init_rpc(xlator_t *this)
conf = this->private;
if (conf->rpc) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INITED_ALREADY,
- "client rpc already "
- "init'ed");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INITED_ALREADY, NULL);
ret = -1;
goto out;
}
conf->rpc = rpc_clnt_new(this->options, this, this->name, 0);
if (!conf->rpc) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED,
- "failed to initialize RPC");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED, NULL);
goto out;
}
ret = rpc_clnt_register_notify(conf->rpc, client_rpc_notify, this);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED,
- "failed to register notify");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED, NULL);
goto out;
}
@@ -2533,8 +2494,7 @@ client_init_rpc(xlator_t *this)
ret = rpcclnt_cbk_program_register(conf->rpc, &gluster_cbk_prog, this);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED,
- "failed to register callback program");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED, NULL);
goto out;
}
@@ -2545,7 +2505,7 @@ out:
return ret;
}
-int
+static int
client_check_event_threads(xlator_t *this, clnt_conf_t *conf, int32_t old,
int32_t new)
{
@@ -2553,8 +2513,8 @@ client_check_event_threads(xlator_t *this, clnt_conf_t *conf, int32_t old,
return 0;
conf->event_threads = new;
- return event_reconfigure_threads(this->ctx->event_pool,
- conf->event_threads);
+ return gf_event_reconfigure_threads(this->ctx->event_pool,
+ conf->event_threads);
}
int
@@ -2590,10 +2550,12 @@ reconfigure(xlator_t *this, dict_t *options)
if (ret)
goto out;
- subvol_ret = dict_get_str(this->options, "remote-host", &old_remote_host);
+ subvol_ret = dict_get_str_sizen(this->options, "remote-host",
+ &old_remote_host);
if (subvol_ret == 0) {
- subvol_ret = dict_get_str(options, "remote-host", &new_remote_host);
+ subvol_ret = dict_get_str_sizen(options, "remote-host",
+ &new_remote_host);
if (subvol_ret == 0) {
if (strcmp(old_remote_host, new_remote_host)) {
ret = 1;
@@ -2602,12 +2564,12 @@ reconfigure(xlator_t *this, dict_t *options)
}
}
- subvol_ret = dict_get_str(this->options, "remote-subvolume",
- &old_remote_subvol);
+ subvol_ret = dict_get_str_sizen(this->options, "remote-subvolume",
+ &old_remote_subvol);
if (subvol_ret == 0) {
- subvol_ret = dict_get_str(options, "remote-subvolume",
- &new_remote_subvol);
+ subvol_ret = dict_get_str_sizen(options, "remote-subvolume",
+ &new_remote_subvol);
if (subvol_ret == 0) {
if (strcmp(old_remote_subvol, new_remote_subvol)) {
ret = 1;
@@ -2624,6 +2586,7 @@ reconfigure(xlator_t *this, dict_t *options)
out);
GF_OPTION_RECONF("send-gids", conf->send_gids, options, bool, out);
+ GF_OPTION_RECONF("strict-locks", conf->strict_locks, options, bool, out);
ret = 0;
out:
@@ -2637,15 +2600,13 @@ init(xlator_t *this)
clnt_conf_t *conf = NULL;
if (this->children) {
- gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
- "FATAL: client protocol "
- "translator cannot have any subvolumes");
+ gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_FATAL_CLIENT_PROTOCOL,
+ NULL);
goto out;
}
if (!this->parents) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
- "Volume is dangling. ");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_VOL_DANGLING, NULL);
}
conf = GF_CALLOC(1, sizeof(*conf), gf_client_mt_clnt_conf_t);
@@ -2653,6 +2614,7 @@ init(xlator_t *this)
goto out;
pthread_mutex_init(&conf->lock, NULL);
+ pthread_cond_init(&conf->fini_complete_cond, NULL);
pthread_spin_init(&conf->fd_lock, 0);
INIT_LIST_HEAD(&conf->saved_fds);
@@ -2689,8 +2651,8 @@ init(xlator_t *this)
this->local_pool = mem_pool_new(clnt_local_t, 64);
if (!this->local_pool) {
ret = -1;
- gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
- "failed to create local_t's memory pool");
+ gf_smsg(this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_CREATE_MEM_POOL_FAILED,
+ NULL);
goto out;
}
@@ -2711,6 +2673,7 @@ fini(xlator_t *this)
if (!conf)
return;
+ conf->fini_completed = _gf_false;
conf->destroy = 1;
if (conf->rpc) {
/* cleanup the saved-frames before last unref */
@@ -2718,6 +2681,18 @@ fini(xlator_t *this)
rpc_clnt_unref(conf->rpc);
}
+ pthread_mutex_lock(&conf->lock);
+ {
+ while (!conf->fini_completed)
+ pthread_cond_wait(&conf->fini_complete_cond, &conf->lock);
+ }
+ pthread_mutex_unlock(&conf->lock);
+
+ pthread_spin_destroy(&conf->fd_lock);
+ pthread_mutex_destroy(&conf->lock);
+ pthread_cond_destroy(&conf->fini_complete_cond);
+ GF_FREE(conf);
+
/* Saved Fds */
/* TODO: */
@@ -2744,13 +2719,14 @@ client_fd_lk_ctx_dump(xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd)
if (ret != 0)
return;
+ gf_proc_dump_write("------", "------");
+
+ lock_no = 0;
+
ret = TRY_LOCK(&lk_ctx_ref->lock);
if (ret)
return;
- gf_proc_dump_write("------", "------");
-
- lock_no = 0;
list_for_each_entry(plock, &lk_ctx_ref->lk_list, next)
{
snprintf(key, sizeof(key), "granted-posix-lock[%d]", lock_no++);
@@ -2765,13 +2741,14 @@ client_fd_lk_ctx_dump(xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd)
get_lk_type(plock->user_flock.l_type), plock->user_flock.l_start,
plock->user_flock.l_len);
}
+ UNLOCK(&lk_ctx_ref->lock);
+
gf_proc_dump_write("------", "------");
- UNLOCK(&lk_ctx_ref->lock);
fd_lk_ctx_unref(lk_ctx_ref);
}
-int
+static int
client_priv_dump(xlator_t *this)
{
clnt_conf_t *conf = NULL;
@@ -2789,15 +2766,15 @@ client_priv_dump(xlator_t *this)
if (!conf)
return -1;
- ret = pthread_mutex_trylock(&conf->lock);
- if (ret)
- return -1;
-
gf_proc_dump_build_key(key_prefix, "xlator.protocol.client", "%s.priv",
this->name);
gf_proc_dump_add_section("%s", key_prefix);
+ ret = pthread_mutex_trylock(&conf->lock);
+ if (ret)
+ return -1;
+
pthread_spin_lock(&conf->fd_lock);
list_for_each_entry(tmp, &conf->saved_fds, sfd_pos)
{
@@ -2898,6 +2875,7 @@ struct xlator_fops fops = {
.icreate = client_icreate,
.namelink = client_namelink,
.put = client_put,
+ .copy_file_range = client_copy_file_range,
};
struct xlator_dumpops dumpops = {
@@ -2939,7 +2917,7 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_TIME,
.min = 0,
.max = 1013,
- .default_value = "42",
+ .default_value = TOSTRING(GF_NETWORK_TIMEOUT),
.description = "Time duration for which the client waits to "
"check if the server is responsive.",
.op_version = {1},
@@ -2979,5 +2957,41 @@ struct volume_options options[] = {
" power. Range 1-32 threads.",
.op_version = {GD_OP_VERSION_3_7_0},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+
+ /* This option is required for running code-coverage tests with
+ old protocol */
+ {
+ .key = {"testing.old-protocol"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .op_version = {GD_OP_VERSION_7_0},
+ .flags = OPT_FLAG_SETTABLE,
+ },
+ {.key = {"strict-locks"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .op_version = {GD_OP_VERSION_7_0},
+ .flags = OPT_FLAG_SETTABLE,
+ .description = "When set, doesn't reopen saved fds after reconnect "
+ "if POSIX locks are held on them. Hence subsequent "
+ "operations on these fds will fail. This is "
+ "necessary for stricter lock complaince as bricks "
+ "cleanup any granted locks when a client "
+ "disconnects."},
{.key = {NULL}},
};
+
+xlator_api_t xlator_api = {
+ .init = init,
+ .fini = fini,
+ .notify = notify,
+ .reconfigure = reconfigure,
+ .mem_acct_init = mem_acct_init,
+ .op_version = {1}, /* Present from the initial version */
+ .dumpops = &dumpops,
+ .fops = &fops,
+ .cbks = &cbks,
+ .options = options,
+ .identifier = "client",
+ .category = GF_MAINTAINED,
+};
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index c63e3a290d6..ab799c41755 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -15,15 +15,15 @@
#include <stdint.h>
#include "rpc-clnt.h"
-#include "list.h"
-#include "inode.h"
+#include <glusterfs/list.h>
+#include <glusterfs/inode.h>
#include "client-mem-types.h"
#include "protocol-common.h"
#include "glusterfs3.h"
#include "glusterfs3-xdr.h"
-#include "fd-lk.h"
-#include "defaults.h"
-#include "default-args.h"
+#include <glusterfs/fd-lk.h>
+#include <glusterfs/defaults.h>
+#include <glusterfs/default-args.h>
#include "client-messages.h"
/* FIXME: Needs to be defined in a common file */
@@ -36,68 +36,24 @@ typedef enum {
FALLBACK_TO_ANON_FD = 1
} clnt_remote_fd_flags_t;
-#define CPD_REQ_FIELD(v, f) (v)->compound_req_u.compound_##f##_req
-#define CPD_RSP_FIELD(v, f) (v)->compound_rsp_u.compound_##f##_rsp
-
#define CLIENT_POST_FOP(fop, this_rsp_u, this_args_cbk, params...) \
do { \
gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u, fop); \
- int _op_ret = 0; \
- int _op_errno = 0; \
\
- _op_ret = _this_rsp->op_ret; \
- _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
+ int _op_ret = _this_rsp->op_ret; \
+ int _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \
} while (0)
#define CLIENT_POST_FOP_TYPE(fop, this_rsp_u, this_args_cbk, params...) \
do { \
gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp_u, fop); \
- int _op_ret = 0; \
- int _op_errno = 0; \
\
- _op_ret = _this_rsp->op_ret; \
- _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
+ int _op_ret = _this_rsp->op_ret; \
+ int _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \
} while (0)
-#define CLIENT_PRE_FOP(fop, xl, compound_req, op_errno, label, params...) \
- do { \
- gfs3_##fop##_req *_req = (gfs3_##fop##_req *)compound_req; \
- int _ret = 0; \
- \
- _ret = client_pre_##fop(xl, _req, params); \
- if (_ret < 0) { \
- op_errno = -ret; \
- goto label; \
- } \
- } while (0)
-
-#define CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fop) \
- do { \
- gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \
- \
- GF_FREE(_req->xdata.xdata_val); \
- } while (0)
-
-#define CLIENT_COMMON_RSP_CLEANUP(rsp, fop, i) \
- do { \
- compound_rsp *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \
- \
- free(_this_rsp->xdata.xdata_val); \
- } while (0)
-
-#define CLIENT_FOP_RSP_CLEANUP(rsp, fop, i) \
- do { \
- compound_rsp *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \
- \
- free(_this_rsp->xdata.xdata_val); \
- } while (0)
-
#define CLIENT_GET_REMOTE_FD(xl, fd, flags, remote_fd, op_errno, label) \
do { \
int _ret = 0; \
@@ -107,10 +63,8 @@ typedef enum {
goto label; \
} \
if (remote_fd == -1) { \
- gf_msg(xl->name, GF_LOG_WARNING, EBADFD, PC_MSG_BAD_FD, \
- " (%s) " \
- "remote_fd is -1. EBADFD", \
- uuid_utoa(fd->inode->gfid)); \
+ gf_smsg(xl->name, GF_LOG_WARNING, EBADFD, PC_MSG_BAD_FD, \
+ "gfid=%s", uuid_utoa(fd->inode->gfid), NULL); \
op_errno = EBADFD; \
goto label; \
} \
@@ -126,52 +80,6 @@ typedef enum {
client_local_wipe(__local); \
} while (0)
-/* compound v2 */
-#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req)
-#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp)
-
-#define CLIENT4_POST_FOP(fop, this_rsp_u, this_args_cbk, params...) \
- do { \
- gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \
- int _op_ret = 0; \
- int _op_errno = 0; \
- \
- _op_ret = _this_rsp->op_ret; \
- _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
- args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \
- } while (0)
-
-#define CLIENT4_POST_FOP_TYPE(fop, rsp_type, this_rsp_u, this_args_cbk, \
- params...) \
- do { \
- gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp_u, fop); \
- int _op_ret = 0; \
- int _op_errno = 0; \
- \
- _op_ret = _this_rsp->op_ret; \
- _op_errno = gf_error_to_errno(_this_rsp->op_errno); \
- args_##fop##_cbk_store(this_args_cbk, _op_ret, _op_errno, params); \
- } while (0)
-
-#define CLIENT4_PRE_FOP(fop, xl, compound_req, op_errno, label, params...) \
- do { \
- gfx_##fop##_req *_req = (gfx_##fop##_req *)compound_req; \
- int _ret = 0; \
- \
- _ret = client_pre_##fop##_v2(xl, _req, params); \
- if (_ret < 0) { \
- op_errno = -ret; \
- goto label; \
- } \
- } while (0)
-
-#define CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fop) \
- do { \
- gfx_##fop##_req *_req = &CPD4_REQ_FIELD(curr_req, fop); \
- \
- GF_FREE(_req->xdata.pairs.pairs_val); \
- } while (0)
-
struct clnt_options {
char *remote_subvolume;
int ping_timeout;
@@ -235,6 +143,22 @@ typedef struct clnt_conf {
* up, disconnects can be
* logged
*/
+
+ gf_boolean_t old_protocol; /* used only for old-protocol testing */
+ pthread_cond_t fini_complete_cond; /* Used to wait till we finsh the fini
+ compltely, ie client_fini_complete
+ to return*/
+ gf_boolean_t fini_completed;
+ gf_boolean_t strict_locks; /* When set, doesn't reopen saved fds after
+ reconnect if POSIX locks are held on them.
+ Hence subsequent operations on these fds will
+ fail. This is necessary for stricter lock
+ complaince as bricks cleanup any granted
+ locks when a client disconnects.
+ */
+
+ gf_boolean_t connection_to_brick; /*True from attempt to connect to brick
+ till disconnection to brick*/
} clnt_conf_t;
typedef struct _client_fd_ctx {
@@ -269,6 +193,7 @@ typedef struct client_local {
loc_t loc;
loc_t loc2;
fd_t *fd;
+ fd_t *fd_out; /* used in copy_file_range */
clnt_fd_ctx_t *fdctx;
uint32_t flags;
struct iobref *iobref;
@@ -280,16 +205,22 @@ typedef struct client_local {
pthread_mutex_t mutex;
char *name;
gf_boolean_t attempt_reopen;
- /* required for compound fops */
- compound_args_t *compound_args;
- unsigned int length; /* length of a compound fop */
- unsigned int
- read_length; /* defines the last processed length for a compound read */
+ /*
+ * The below boolean variable is used
+ * only for copy_file_range fop
+ */
+ gf_boolean_t attempt_reopen_out;
} clnt_local_t;
typedef struct client_args {
loc_t *loc;
+ /*
+ * This is the source fd for copy_file_range and
+ * the default fd for any other fd based fop which
+ * requires only one fd (i.e. opetates on one fd)
+ */
fd_t *fd;
+ fd_t *fd_out; /* this is the destination fd for copy_file_range */
const char *linkname;
struct iobref *iobref;
struct iovec *vector;
@@ -301,7 +232,17 @@ typedef struct client_args {
struct gf_flock *flock;
const char *volume;
const char *basename;
+
off_t offset;
+ /*
+ * According to the man page of copy_file_range,
+ * the offsets for source and destination file
+ * are of type loff_t. But the type loff_t is
+ * linux specific and is actual a typedef of
+ * off64_t.
+ */
+ off64_t off_in; /* used in copy_file_range for source fd */
+ off64_t off_out; /* used in copy_file_range for dst fd */
int32_t mask;
int32_t cmd;
size_t size;
@@ -323,6 +264,17 @@ typedef struct client_args {
lock_migration_info_t *locklist;
} clnt_args_t;
+typedef struct client_payload {
+ struct iobref *iobref;
+ struct iovec *payload;
+ struct iovec *rsphdr;
+ struct iovec *rsp_payload;
+ struct iobref *rsp_iobref;
+ int payload_cnt;
+ int rsphdr_cnt;
+ int rsp_payload_cnt;
+} client_payload_t;
+
typedef ssize_t (*gfs_serialize_t)(struct iovec outmsg, void *args);
clnt_fd_ctx_t *
@@ -337,19 +289,7 @@ client_local_wipe(clnt_local_t *local);
int
client_submit_request(xlator_t *this, void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbk,
- struct iobref *iobref, struct iovec *rsphdr,
- int rsphdr_count, struct iovec *rsp_payload,
- int rsp_count, struct iobref *rsp_iobref,
- xdrproc_t xdrproc);
-
-int
-client_submit_compound_request(xlator_t *this, void *req, call_frame_t *frame,
- rpc_clnt_prog_t *prog, int procnum,
- fop_cbk_fn_t cbkfn, struct iovec *req_vector,
- int req_count, struct iobref *iobref,
- struct iovec *rsphdr, int rsphdr_count,
- struct iovec *rsp_payload, int rsp_payload_count,
- struct iobref *rsp_iobref, xdrproc_t xdrproc);
+ client_payload_t *cp, xdrproc_t xdrproc);
int
unserialize_rsp_dirent(xlator_t *this, struct gfs3_readdir_rsp *rsp,
@@ -374,8 +314,6 @@ void
client_save_number_fds(clnt_conf_t *conf, int count);
int
dump_client_locks(inode_t *inode);
-int
-client_notify_parents_child_up(xlator_t *this);
int32_t
is_client_dump_locks_cmd(char *name);
int32_t
@@ -383,12 +321,6 @@ client_dump_locks(char *name, inode_t *inode, dict_t *dict);
int
client_fdctx_destroy(xlator_t *this, clnt_fd_ctx_t *fdctx);
-int32_t
-client_type_to_gf_type(short l_type);
-
-int
-client_mark_fd_bad(xlator_t *this);
-
int
client_fd_lk_list_empty(fd_lk_ctx_t *lk_ctx, gf_boolean_t use_try_lock);
void
@@ -413,19 +345,6 @@ int
client_add_fd_to_saved_fds(xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
int64_t remote_fd, int is_dir);
int
-client_handle_fop_requirements(
- xlator_t *this, call_frame_t *frame, gfs3_compound_req *req,
- clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
- struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args, int fop_enum, int index);
-int
-client_process_response(call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfs3_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk, int index);
-void
-compound_request_cleanup(gfs3_compound_req *req);
-
-int
clnt_unserialize_rsp_locklist(xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
lock_migration_info_t *lmi);
void
@@ -439,9 +358,6 @@ serialize_req_locklist(lock_migration_info_t *locklist,
gfs3_setactivelk_req *req);
void
-client_compound_rsp_cleanup(gfs3_compound_rsp *rsp, int len);
-
-void
clnt_getactivelk_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp);
void
@@ -469,18 +385,10 @@ int
clnt_readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp);
int
-client_handle_fop_requirements_v2(
- xlator_t *this, call_frame_t *frame, gfx_compound_req *req,
- clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
- struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args, int fop_enum, int index);
+client_add_lock_for_recovery(fd_t *fd, struct gf_flock *flock,
+ gf_lkowner_t *owner, int32_t cmd);
+
int
-client_process_response_v2(call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfx_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk, int index);
-void
-compound_request_cleanup_v2(gfx_compound_req *req);
-void
-client_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, int len);
+client_is_setlk(int32_t cmd);
#endif /* !_CLIENT_H */
diff --git a/xlators/protocol/server/src/Makefile.am b/xlators/protocol/server/src/Makefile.am
index 01edbd35d9c..5e875c8df0b 100644
--- a/xlators/protocol/server/src/Makefile.am
+++ b/xlators/protocol/server/src/Makefile.am
@@ -4,11 +4,11 @@ endif
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/protocol
-server_la_LDFLAGS = $(LIB_DL) -module $(GF_XLATOR_DEFAULT_LDFLAGS)
+server_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS)
server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
- $(top_builddir)/rpc/xdr/src/libgfxdr.la
+ $(top_builddir)/rpc/xdr/src/libgfxdr.la $(LIB_DL)
server_la_SOURCES = server.c server-resolve.c server-helpers.c \
server-rpc-fops.c server-handshake.c authenticate.c \
diff --git a/xlators/protocol/server/src/authenticate.h b/xlators/protocol/server/src/authenticate.h
index 6fc53933343..6888cf696e6 100644
--- a/xlators/protocol/server/src/authenticate.h
+++ b/xlators/protocol/server/src/authenticate.h
@@ -17,10 +17,10 @@
#include <stdio.h>
#include <fnmatch.h>
-#include "dict.h"
-#include "compat.h"
-#include "list.h"
-#include "xlator.h"
+#include <glusterfs/dict.h>
+#include <glusterfs/compat.h>
+#include <glusterfs/list.h>
+#include <glusterfs/xlator.h>
typedef enum { AUTH_ACCEPT, AUTH_REJECT, AUTH_DONT_CARE } auth_result_t;
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c
index b5d61edccfb..cd79cf4d930 100644
--- a/xlators/protocol/server/src/server-common.c
+++ b/xlators/protocol/server/src/server-common.c
@@ -1,13 +1,13 @@
#include "server.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "server-messages.h"
#include "server-helpers.h"
-#include "defaults.h"
-#include "fd.h"
+#include <glusterfs/defaults.h>
+#include <glusterfs/fd.h>
#include "xdr-nfs3.h"
void
@@ -21,11 +21,8 @@ server_post_stat(server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -182,11 +179,8 @@ server_post_fstat(server_state_t *state, gfs3_fstat_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -454,9 +448,7 @@ server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame,
{
inode_t *root_inode = NULL;
inode_t *link_inode = NULL;
- uuid_t rootgfid = {
- 0,
- };
+ static uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
root_inode = frame->root->client->bound_xl->itable->root;
@@ -480,7 +472,6 @@ server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame,
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
stbuf->ia_ino = 1;
- rootgfid[15] = 1;
gf_uuid_copy(stbuf->ia_gfid, rootgfid);
if (inode->ia_type == 0)
inode->ia_type = stbuf->ia_type;
@@ -521,11 +512,8 @@ server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
preparent->ia_ino = 1;
postparent->ia_ino = 1;
gf_uuid_copy(preparent->ia_gfid, gfid);
@@ -541,6 +529,16 @@ server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp,
}
void
+server4_post_common_3iatt_noinode(gfx_common_3iatt_rsp *rsp, struct iatt *stbuf,
+ struct iatt *prebuf_dst,
+ struct iatt *postbuf_dst)
+{
+ gfx_stat_from_iattx(&rsp->stat, stbuf);
+ gfx_stat_from_iattx(&rsp->preparent, prebuf_dst);
+ gfx_stat_from_iattx(&rsp->postparent, postbuf_dst);
+}
+
+void
server4_post_common_2iatt(gfx_common_2iatt_rsp *rsp, struct iatt *prebuf,
struct iatt *postbuf)
{
@@ -581,11 +579,8 @@ server4_post_common_iatt(server_state_t *state, gfx_common_iatt_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -646,7 +641,8 @@ server4_post_rchecksum(gfx_rchecksum_rsp *rsp, uint32_t weak_checksum,
uint8_t *strong_checksum)
{
rsp->weak_checksum = weak_checksum;
-
+ /* When the length encoding changes, update the change
+ in posix code also. */
rsp->strong_checksum.strong_checksum_val = (char *)strong_checksum;
rsp->strong_checksum.strong_checksum_len = SHA256_DIGEST_LENGTH;
rsp->flags = 1; /* Indicates SHA256 TYPE */
@@ -791,9 +787,7 @@ server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
{
inode_t *root_inode = NULL;
inode_t *link_inode = NULL;
- uuid_t rootgfid = {
- 0,
- };
+ static uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
root_inode = frame->root->client->bound_xl->itable->root;
@@ -817,7 +811,6 @@ server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
stbuf->ia_ino = 1;
- rootgfid[15] = 1;
gf_uuid_copy(stbuf->ia_gfid, rootgfid);
if (inode->ia_type == 0)
inode->ia_type = stbuf->ia_type;
@@ -835,7 +828,7 @@ server4_post_lease(gfx_lease_rsp *rsp, struct gf_lease *lease)
void
server4_post_link(server_state_t *state, gfx_common_3iatt_rsp *rsp,
inode_t *inode, struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
+ struct iatt *postparent)
{
inode_t *link_inode = NULL;
diff --git a/xlators/protocol/server/src/server-common.h b/xlators/protocol/server/src/server-common.h
index 53e46afdc69..6200415e304 100644
--- a/xlators/protocol/server/src/server-common.h
+++ b/xlators/protocol/server/src/server-common.h
@@ -1,11 +1,11 @@
#include "server.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "server-messages.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#include "xdr-nfs3.h"
void
@@ -192,3 +192,8 @@ void
server4_post_link(server_state_t *state, gfx_common_3iatt_rsp *rsp,
inode_t *inode, struct iatt *stbuf, struct iatt *pre,
struct iatt *post);
+
+void
+server4_post_common_3iatt_noinode(gfx_common_3iatt_rsp *rsp, struct iatt *stbuf,
+ struct iatt *prebuf_dst,
+ struct iatt *postbuf_dst);
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index db502ee5034..85c87c1ab8b 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -12,13 +12,13 @@
#include "server-helpers.h"
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "glusterfs3.h"
#include "authenticate.h"
#include "server-messages.h"
-#include "syscall.h"
-#include "events.h"
-#include "syncop.h"
+#include <glusterfs/syscall.h>
+#include <glusterfs/events.h>
+#include <glusterfs/syncop.h>
struct __get_xl_struct {
const char *name;
@@ -36,7 +36,6 @@ gf_compare_client_version(rpcsvc_request_t *req, int fop_prognum,
return ret;
}
-
int
server_getspec(rpcsvc_request_t *req)
{
@@ -232,6 +231,7 @@ server_setvolume(rpcsvc_request_t *req)
dict_t *config_params = NULL;
dict_t *params = NULL;
char *name = NULL;
+ char *volume_id = NULL;
char *client_uid = NULL;
char *clnt_version = NULL;
xlator_t *xl = NULL;
@@ -240,7 +240,6 @@ server_setvolume(rpcsvc_request_t *req)
int32_t ret = -1;
int32_t op_ret = -1;
int32_t op_errno = EINVAL;
- char *buf = NULL;
uint32_t opversion = 0;
rpc_transport_t *xprt = NULL;
int32_t fop_version = 0;
@@ -250,6 +249,7 @@ server_setvolume(rpcsvc_request_t *req)
char *subdir_mount = NULL;
char *client_name = NULL;
gf_boolean_t cleanup_starting = _gf_false;
+ gf_boolean_t xlator_in_graph = _gf_true;
params = dict_new();
reply = dict_new();
@@ -267,18 +267,11 @@ server_setvolume(rpcsvc_request_t *req)
*/
config_params = dict_copy_with_ref(this->options, NULL);
- buf = memdup(args.dict.dict_val, args.dict.dict_len);
- if (buf == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
-
- ret = dict_unserialize(buf, args.dict.dict_len, &params);
+ ret = dict_unserialize(args.dict.dict_val, args.dict.dict_len, &params);
if (ret < 0) {
- ret = dict_set_str(reply, "ERROR",
- "Internal error: failed to unserialize "
- "request dictionary");
+ ret = dict_set_sizen_str_sizen(reply, "ERROR",
+ "Internal error: failed to unserialize "
+ "request dictionary");
if (ret < 0)
gf_msg_debug(this->name, 0,
"failed to set error "
@@ -291,9 +284,6 @@ server_setvolume(rpcsvc_request_t *req)
goto fail;
}
- params->extra_free = buf;
- buf = NULL;
-
ret = dict_get_str(params, "remote-subvolume", &name);
if (ret < 0) {
ret = dict_set_str(reply, "ERROR",
@@ -311,8 +301,10 @@ server_setvolume(rpcsvc_request_t *req)
LOCK(&ctx->volfile_lock);
{
xl = get_xlator_by_name(this, name);
- if (!xl)
+ if (!xl) {
+ xlator_in_graph = _gf_false;
xl = this;
+ }
}
UNLOCK(&ctx->volfile_lock);
if (xl == NULL) {
@@ -354,6 +346,7 @@ server_setvolume(rpcsvc_request_t *req)
goto fail;
}
+ pthread_mutex_lock(&conf->mutex);
list_for_each_entry(tmp, &conf->child_status->status_list, status_list)
{
if (strcmp(tmp->name, name) == 0)
@@ -361,10 +354,8 @@ server_setvolume(rpcsvc_request_t *req)
}
if (!tmp->name) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
- "No xlator %s is found in "
- "child status list",
- name);
+ gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CHILD_STATUS_FAILED,
+ "No xlator %s is found in child status list", name);
} else {
ret = dict_set_int32(reply, "child_up", tmp->child_up);
if (ret < 0)
@@ -372,7 +363,21 @@ server_setvolume(rpcsvc_request_t *req)
"Failed to set 'child_up' for xlator %s "
"in the reply dict",
tmp->name);
+ if (!tmp->child_up) {
+ ret = dict_set_str(reply, "ERROR",
+ "Not received child_up for this xlator");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0, "failed to set error msg");
+
+ gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
+ "Not received child_up for this xlator %s", name);
+ op_ret = -1;
+ op_errno = EAGAIN;
+ pthread_mutex_unlock(&conf->mutex);
+ goto fail;
+ }
}
+ pthread_mutex_unlock(&conf->mutex);
ret = dict_get_str(params, "process-uuid", &client_uid);
if (ret < 0) {
@@ -396,6 +401,25 @@ server_setvolume(rpcsvc_request_t *req)
client_name = "unknown";
}
+ /* If any value is set, the first element will be non-0.
+ It would be '0', but not '\0' :-) */
+ if (xl->graph->volume_id[0]) {
+ ret = dict_get_str_sizen(params, "volume-id", &volume_id);
+ if (!ret && strcmp(xl->graph->volume_id, volume_id)) {
+ ret = dict_set_str(reply, "ERROR",
+ "Volume-ID different, possible case "
+ "of same brick re-used in another volume");
+ if (ret < 0)
+ gf_msg_debug(this->name, 0, "failed to set error msg");
+
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto fail;
+ }
+ ret = dict_set_str(reply, "volume-id", tmp->volume_id);
+ if (ret)
+ gf_msg_debug(this->name, 0, "failed to set 'volume-id'");
+ }
client = gf_client_get(this, &req->cred, client_uid, subdir_mount);
if (client == NULL) {
op_ret = -1;
@@ -533,8 +557,8 @@ server_setvolume(rpcsvc_request_t *req)
req->trans->clnt_options = dict_ref(params);
gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_ACCEPTED,
- "accepted client from %s (version: %s)", client->client_uid,
- (clnt_version) ? clnt_version : "old");
+ "accepted client from %s (version: %s) with subvol %s",
+ client->client_uid, (clnt_version) ? clnt_version : "old", name);
gf_event(EVENT_CLIENT_CONNECT,
"client_uid=%s;"
@@ -555,20 +579,30 @@ server_setvolume(rpcsvc_request_t *req)
"failed to set error "
"msg");
} else {
- gf_event(EVENT_CLIENT_AUTH_REJECT,
- "client_uid=%s;"
- "client_identifier=%s;server_identifier=%s;"
- "brick_path=%s",
- client->client_uid, req->trans->peerinfo.identifier,
- req->trans->myinfo.identifier, name);
- gf_msg(this->name, GF_LOG_ERROR, EACCES, PS_MSG_AUTHENTICATE_ERROR,
- "Cannot authenticate client"
- " from %s %s",
- client->client_uid, (clnt_version) ? clnt_version : "old");
-
op_ret = -1;
- op_errno = EACCES;
- ret = dict_set_str(reply, "ERROR", "Authentication failed");
+ if (!xlator_in_graph) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOENT, PS_MSG_AUTHENTICATE_ERROR,
+ "Cannot authenticate client"
+ " from %s %s because brick is not attached in graph",
+ client->client_uid, (clnt_version) ? clnt_version : "old");
+
+ op_errno = ENOENT;
+ ret = dict_set_str(reply, "ERROR", "Brick not found");
+ } else {
+ gf_event(EVENT_CLIENT_AUTH_REJECT,
+ "client_uid=%s;"
+ "client_identifier=%s;server_identifier=%s;"
+ "brick_path=%s",
+ client->client_uid, req->trans->peerinfo.identifier,
+ req->trans->myinfo.identifier, name);
+ gf_msg(this->name, GF_LOG_ERROR, EACCES, PS_MSG_AUTHENTICATE_ERROR,
+ "Cannot authenticate client"
+ " from %s %s",
+ client->client_uid, (clnt_version) ? clnt_version : "old");
+
+ op_errno = EACCES;
+ ret = dict_set_str(reply, "ERROR", "Authentication failed");
+ }
if (ret < 0)
gf_msg_debug(this->name, 0,
"failed to set error "
@@ -638,6 +672,8 @@ fail:
ret = dict_set_str(reply, "ERROR",
"cleanup flag is set for xlator "
"before call first_lookup Try again later");
+ /* quisce coverity about UNUSED_VALUE ret */
+ (void)(ret);
} else {
op_ret = server_first_lookup(this, client, reply);
if (op_ret == -1)
@@ -649,21 +685,16 @@ fail:
GF_ASSERT(rsp);
rsp->op_ret = 0;
- rsp->dict.dict_len = dict_serialized_length(reply);
- if (rsp->dict.dict_len) {
- rsp->dict.dict_val = GF_CALLOC(1, rsp->dict.dict_len,
- gf_server_mt_rsp_buf_t);
- if (rsp->dict.dict_val) {
- ret = dict_serialize(reply, rsp->dict.dict_val);
- if (ret < 0) {
- gf_msg_debug("server-handshake", 0,
- "failed "
- "to serialize reply dict");
- op_ret = -1;
- op_errno = -ret;
- }
- }
+
+ ret = dict_allocate_and_serialize(reply, (char **)&rsp->dict.dict_val,
+ &rsp->dict.dict_len);
+ if (ret != 0) {
+ ret = -1;
+ gf_msg_debug("server-handshake", 0, "failed to serialize reply dict");
+ op_ret = -1;
+ op_errno = -ret;
}
+
rsp->op_ret = op_ret;
rsp->op_errno = gf_errno_to_error(op_errno);
@@ -698,8 +729,6 @@ fail:
dict_unref(config_params);
}
- GF_FREE(buf);
-
return 0;
}
@@ -747,15 +776,15 @@ fail:
return 0;
}
-rpcsvc_actor_t gluster_handshake_actors[GF_HNDSK_MAXVALUE] = {
- [GF_HNDSK_NULL] = {"NULL", GF_HNDSK_NULL, server_null, NULL, 0, DRC_NA},
- [GF_HNDSK_SETVOLUME] = {"SETVOLUME", GF_HNDSK_SETVOLUME, server_setvolume,
- NULL, 0, DRC_NA},
- [GF_HNDSK_GETSPEC] = {"GETSPEC", GF_HNDSK_GETSPEC, server_getspec, NULL, 0,
- DRC_NA},
- [GF_HNDSK_PING] = {"PING", GF_HNDSK_PING, server_ping, NULL, 0, DRC_NA},
- [GF_HNDSK_SET_LK_VER] = {"SET_LK_VER", GF_HNDSK_SET_LK_VER,
- server_set_lk_version, NULL, 0, DRC_NA},
+static rpcsvc_actor_t gluster_handshake_actors[GF_HNDSK_MAXVALUE] = {
+ [GF_HNDSK_NULL] = {"NULL", server_null, NULL, GF_HNDSK_NULL, DRC_NA, 0},
+ [GF_HNDSK_SETVOLUME] = {"SETVOLUME", server_setvolume, NULL,
+ GF_HNDSK_SETVOLUME, DRC_NA, 0},
+ [GF_HNDSK_GETSPEC] = {"GETSPEC", server_getspec, NULL, GF_HNDSK_GETSPEC,
+ DRC_NA, 0},
+ [GF_HNDSK_PING] = {"PING", server_ping, NULL, GF_HNDSK_PING, DRC_NA, 0},
+ [GF_HNDSK_SET_LK_VER] = {"SET_LK_VER", server_set_lk_version, NULL,
+ GF_HNDSK_SET_LK_VER, DRC_NA, 0},
};
struct rpcsvc_program gluster_handshake_prog = {
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index cb2a73c7168..6e644912a46 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -10,16 +10,15 @@
#include "server.h"
#include "server-helpers.h"
-#include "gidcache.h"
+#include <glusterfs/gidcache.h>
#include "server-messages.h"
-#include "syscall.h"
-#include "defaults.h"
-#include "default-args.h"
+#include <glusterfs/syscall.h>
+#include <glusterfs/defaults.h>
+#include <glusterfs/default-args.h>
#include "server-common.h"
#include <fnmatch.h>
#include <pwd.h>
-#include "compound-fop-utils.h"
/* based on nfs_fix_aux_groups() */
int
@@ -53,14 +52,14 @@ gid_resolve(server_conf_t *conf, call_stack_t *root)
ret = getpwuid_r(root->uid, &mypw, mystrs, sizeof(mystrs), &result);
if (ret != 0) {
- gf_msg("gid-cache", GF_LOG_ERROR, errno, PS_MSG_GET_UID_FAILED,
- "getpwuid_r(%u) failed", root->uid);
+ gf_smsg("gid-cache", GF_LOG_ERROR, errno, PS_MSG_GET_UID_FAILED,
+ "uid=%u", root->uid, NULL);
return -1;
}
if (!result) {
- gf_msg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND,
- "getpwuid_r(%u) found nothing", root->uid);
+ gf_smsg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND, "uid=%u",
+ root->uid, NULL);
return -1;
}
@@ -68,9 +67,9 @@ gid_resolve(server_conf_t *conf, call_stack_t *root)
ngroups = gf_getgrouplist(result->pw_name, root->gid, &mygroups);
if (ngroups == -1) {
- gf_msg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
- "could not map %s to group list (%d gids)", result->pw_name,
- root->ngrps);
+ gf_smsg("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
+ "pw_name=%s", result->pw_name, "root->ngtps=%d", root->ngrps,
+ NULL);
return -1;
}
root->ngrps = (uint16_t)ngroups;
@@ -210,8 +209,6 @@ free_state(server_state_t *state)
server_resolve_wipe(&state->resolve);
server_resolve_wipe(&state->resolve2);
- compound_args_cleanup(state->args);
-
/* Call rpc_trnasport_unref to avoid crashes at last after free
all resources because of server_rpc_notify (for transport destroy)
call's xlator_mem_cleanup if all xprt are destroyed that internally
@@ -233,16 +230,51 @@ server_connection_cleanup_flush_cbk(call_frame_t *frame, void *cookie,
int32_t ret = -1;
fd_t *fd = NULL;
client_t *client = NULL;
+ uint64_t fd_cnt = 0;
+ xlator_t *victim = NULL;
+ server_conf_t *conf = NULL;
+ xlator_t *serv_xl = NULL;
+ rpc_transport_t *xprt = NULL;
+ rpc_transport_t *xp_next = NULL;
+ int32_t detach = (long)cookie;
+ gf_boolean_t xprt_found = _gf_false;
GF_VALIDATE_OR_GOTO("server", this, out);
GF_VALIDATE_OR_GOTO("server", frame, out);
fd = frame->local;
client = frame->root->client;
+ serv_xl = frame->this;
+ conf = serv_xl->private;
fd_unref(fd);
frame->local = NULL;
+ if (client)
+ victim = client->bound_xl;
+
+ if (victim) {
+ fd_cnt = GF_ATOMIC_DEC(client->fd_cnt);
+ if (!fd_cnt && conf && detach) {
+ pthread_mutex_lock(&conf->mutex);
+ {
+ list_for_each_entry_safe(xprt, xp_next, &conf->xprt_list, list)
+ {
+ if (!xprt->xl_private)
+ continue;
+ if (xprt->xl_private == client) {
+ xprt_found = _gf_true;
+ break;
+ }
+ }
+ }
+ pthread_mutex_unlock(&conf->mutex);
+ if (xprt_found) {
+ rpc_transport_unref(xprt);
+ }
+ }
+ }
+
gf_client_unref(client);
STACK_DESTROY(frame->root);
@@ -253,7 +285,7 @@ out:
static int
do_fd_cleanup(xlator_t *this, client_t *client, fdentry_t *fdentries,
- int fd_count)
+ int fd_count, int32_t detach)
{
fd_t *fd = NULL;
int i = 0, ret = -1;
@@ -265,6 +297,7 @@ do_fd_cleanup(xlator_t *this, client_t *client, fdentry_t *fdentries,
GF_VALIDATE_OR_GOTO("server", fdentries, out);
bound_xl = client->bound_xl;
+
for (i = 0; i < fd_count; i++) {
fd = fdentries[i].fd;
@@ -274,18 +307,18 @@ do_fd_cleanup(xlator_t *this, client_t *client, fdentry_t *fdentries,
goto out;
}
+ tmp_frame->root->type = GF_OP_TYPE_FOP;
GF_ASSERT(fd->inode);
ret = inode_path(fd->inode, NULL, &path);
if (ret > 0) {
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
- "fd cleanup on %s", path);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
+ "path=%s", path, NULL);
GF_FREE(path);
} else {
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
- "fd cleanup on inode with gfid %s",
- uuid_utoa(fd->inode->gfid));
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_FD_CLEANUP,
+ "inode-gfid=%s", uuid_utoa(fd->inode->gfid), NULL);
}
tmp_frame->local = fd;
@@ -294,8 +327,9 @@ do_fd_cleanup(xlator_t *this, client_t *client, fdentry_t *fdentries,
tmp_frame->root->client = client;
memset(&tmp_frame->root->lk_owner, 0, sizeof(gf_lkowner_t));
- STACK_WIND(tmp_frame, server_connection_cleanup_flush_cbk, bound_xl,
- bound_xl->fops->flush, fd, NULL);
+ STACK_WIND_COOKIE(tmp_frame, server_connection_cleanup_flush_cbk,
+ (void *)(long)detach, bound_xl,
+ bound_xl->fops->flush, fd, NULL);
}
}
@@ -307,13 +341,19 @@ out:
}
int
-server_connection_cleanup(xlator_t *this, client_t *client, int32_t flags)
+server_connection_cleanup(xlator_t *this, client_t *client, int32_t flags,
+ gf_boolean_t *fd_exist)
{
server_ctx_t *serv_ctx = NULL;
fdentry_t *fdentries = NULL;
uint32_t fd_count = 0;
int cd_ret = 0;
int ret = 0;
+ xlator_t *bound_xl = NULL;
+ int i = 0;
+ fd_t *fd = NULL;
+ uint64_t fd_cnt = 0;
+ int32_t detach = 0;
GF_VALIDATE_OR_GOTO("server", this, out);
GF_VALIDATE_OR_GOTO(this->name, client, out);
@@ -322,9 +362,7 @@ server_connection_cleanup(xlator_t *this, client_t *client, int32_t flags)
serv_ctx = server_ctx_get(client, client->this);
if (serv_ctx == NULL) {
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
- "server_ctx_get() "
- "failed");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED, NULL);
goto out;
}
@@ -343,14 +381,36 @@ server_connection_cleanup(xlator_t *this, client_t *client, int32_t flags)
}
if (fdentries != NULL) {
+ /* Loop to configure fd_count on victim brick */
+ bound_xl = client->bound_xl;
+ if (bound_xl) {
+ for (i = 0; i < fd_count; i++) {
+ fd = fdentries[i].fd;
+ if (!fd)
+ continue;
+ fd_cnt++;
+ }
+ if (fd_cnt) {
+ if (fd_exist)
+ (*fd_exist) = _gf_true;
+ GF_ATOMIC_ADD(client->fd_cnt, fd_cnt);
+ }
+ }
+
+ /* If fd_exist is not NULL it means function is invoke
+ by server_rpc_notify at the time of getting DISCONNECT
+ notification
+ */
+ if (fd_exist)
+ detach = 1;
+
gf_msg_debug(this->name, 0,
"Performing cleanup on %d "
"fdentries",
fd_count);
- ret = do_fd_cleanup(this, client, fdentries, fd_count);
+ ret = do_fd_cleanup(this, client, fdentries, fd_count, detach);
} else
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL,
- "no fdentries to clean");
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL, NULL);
if (cd_ret || ret)
ret = -1;
@@ -378,6 +438,7 @@ server_alloc_frame(rpcsvc_request_t *req)
if (!frame)
goto out;
+ frame->root->type = GF_OP_TYPE_FOP;
state = GF_CALLOC(1, sizeof(*state), gf_server_mt_state_t);
if (!state)
goto out;
@@ -391,7 +452,6 @@ server_alloc_frame(rpcsvc_request_t *req)
frame->root->client = client;
frame->root->state = state; /* which socket */
- frame->root->unique = 0; /* which call */
frame->this = client->this;
out:
@@ -413,16 +473,12 @@ get_frame_from_request(rpcsvc_request_t *req)
GF_VALIDATE_OR_GOTO("server", req, out);
- client = req->trans->xl_private;
-
frame = server_alloc_frame(req);
if (!frame)
goto out;
frame->root->op = req->procnum;
- frame->root->unique = req->xid;
-
client = req->trans->xl_private;
this = req->trans->xl;
priv = this->private;
@@ -435,44 +491,51 @@ get_frame_from_request(rpcsvc_request_t *req)
would not have been set. So for non trusted clients
(i.e clients not from the same machine as the brick,
and clients from outside the storage pool)
- do the root-squashing.
+ do the root-squashing and all-squashing.
TODO: If any client within the storage pool (i.e
mounting within a machine from the pool but using
other machine's ip/hostname from the same pool)
is present treat it as a trusted client
*/
- if (!client->auth.username && req->pid != NFS_PID)
+ if (!client->auth.username && req->pid != NFS_PID) {
RPC_AUTH_ROOT_SQUASH(req);
+ RPC_AUTH_ALL_SQUASH(req);
+ }
/* Problem: If we just check whether the client is
- trusted client and do not do root squashing for
- them, then for smb clients and UFO clients root
- squashing will never happen as they use the fuse
- mounts done within the trusted pool (i.e they are
- trusted clients).
- Solution: To fix it, do root squashing for trusted
- clients also. If one wants to have a client within
- the storage pool for which root-squashing does not
- happen, then the client has to be mounted with
+ trusted client and do not do root squashing and
+ all squashing for them, then for smb clients and
+ UFO clients root squashing and all squashing will
+ never happen as they use the fuse mounts done within
+ the trusted pool (i.e they are trusted clients).
+ Solution: To fix it, do root squashing and all squashing
+ for trusted clients also. If one wants to have a client
+ within the storage pool for which root-squashing does
+ not happen, then the client has to be mounted with
--no-root-squash option. But for defrag client and
- gsyncd client do not do root-squashing.
+ gsyncd client do not do root-squashing and all-squashing.
*/
if (client->auth.username &&
req->pid != GF_CLIENT_PID_NO_ROOT_SQUASH &&
req->pid != GF_CLIENT_PID_GSYNCD &&
req->pid != GF_CLIENT_PID_DEFRAG &&
req->pid != GF_CLIENT_PID_SELF_HEALD &&
- req->pid != GF_CLIENT_PID_QUOTA_MOUNT)
+ req->pid != GF_CLIENT_PID_QUOTA_MOUNT) {
RPC_AUTH_ROOT_SQUASH(req);
+ RPC_AUTH_ALL_SQUASH(req);
+ }
/* For nfs clients the server processes will be running
within the trusted storage pool machines. So if we
- do not do root-squashing for nfs servers, thinking
- that its a trusted client, then root-squashing won't
- work for nfs clients.
+ do not do root-squashing and all-squashing for nfs
+ servers, thinking that its a trusted client, then
+ root-squashing and all-squashing won't work for nfs
+ clients.
*/
- if (req->pid == NFS_PID)
+ if (req->pid == NFS_PID) {
RPC_AUTH_ROOT_SQUASH(req);
+ RPC_AUTH_ALL_SQUASH(req);
+ }
}
}
@@ -531,9 +594,8 @@ server_build_config(xlator_t *this, server_conf_t *conf)
if (data) {
ret = gf_string2boolean(data->data, &conf->verify_volfile);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
- "wrong value for '"
- "verify-volfile-checksum', Neglecting option");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_WRONG_VALUE,
+ NULL);
}
}
@@ -541,9 +603,8 @@ server_build_config(xlator_t *this, server_conf_t *conf)
if (data) {
ret = gf_string2boolean(data->data, &conf->trace);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
- "'trace' takes on only "
- "boolean values. Neglecting option");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ NULL);
}
}
@@ -564,18 +625,16 @@ server_build_config(xlator_t *this, server_conf_t *conf)
or directory specified is non standard */
ret = sys_stat(data->data, &buf);
if ((ret != 0) || !S_ISDIR(buf.st_mode)) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_DIR_NOT_FOUND,
- "Directory '%s' doesn't "
- "exist, exiting.",
- data->data);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_DIR_NOT_FOUND,
+ "data=%s", data->data, NULL);
ret = -1;
goto out;
}
/* Make sure that conf-dir doesn't contain ".." in path */
if ((gf_strstr(data->data, "/", "..")) == -1) {
ret = -1;
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CONF_DIR_INVALID,
- "%s: invalid conf_dir", data->data);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_CONF_DIR_INVALID,
+ "data=%s", data->data, NULL);
goto out;
}
@@ -757,8 +816,9 @@ server_print_reply(call_frame_t *frame, int op_ret, int op_errno)
if (state->fd)
snprintf(fdstr, 32, " fd=%p", state->fd);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG,
- "%s%s => (%d, %d)%s", op, caller, op_ret, op_errno, fdstr);
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG, "op=%s", op,
+ "caller=%s", caller, "op_ret=%d", op_ret, "op_errno=%d", op_errno,
+ "fdstr=%s", fdstr, NULL);
out:
return;
}
@@ -818,9 +878,10 @@ server_print_request(call_frame_t *frame)
break;
}
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG, "%s%s%s%s%s%s%s", op,
- caller, resolve_vars, loc_vars, resolve2_vars, loc2_vars,
- other_vars);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG, "op=%s", op,
+ "caller=%s", caller, "resolve_vars=%s", resolve_vars, "loc_vars=%s",
+ loc_vars, "resolve2_vars=%s", resolve2_vars, "loc2_vars=%s",
+ loc2_vars, "other_vars=%s", other_vars, NULL);
out:
return;
}
@@ -832,7 +893,6 @@ serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
gfs3_dirplist *trav = NULL;
gfs3_dirplist *prev = NULL;
int ret = -1;
- int temp = 0;
GF_VALIDATE_OR_GOTO("server", entries, out);
GF_VALIDATE_OR_GOTO("server", rsp, out);
@@ -853,30 +913,12 @@ serialize_rsp_direntp(gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
/* if 'dict' is present, pack it */
if (entry->dict) {
- temp = dict_serialized_length(entry->dict);
-
- if (temp < 0) {
- gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
- "failed to get "
- "serialized length of reply dict");
- errno = EINVAL;
- trav->dict.dict_len = 0;
- goto out;
- }
- trav->dict.dict_len = temp;
-
- trav->dict.dict_val = GF_CALLOC(1, trav->dict.dict_len,
- gf_server_mt_rsp_buf_t);
- if (!trav->dict.dict_val) {
- errno = ENOMEM;
- trav->dict.dict_len = 0;
- goto out;
- }
-
- ret = dict_serialize(entry->dict, trav->dict.dict_val);
- if (ret < 0) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_DICT_SERIALIZE_FAIL,
- "failed to serialize reply dict");
+ ret = dict_allocate_and_serialize(entry->dict,
+ (char **)&trav->dict.dict_val,
+ &trav->dict.dict_len);
+ if (ret != 0) {
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_DICT_SERIALIZE_FAIL,
+ NULL);
errno = -ret;
trav->dict.dict_len = 0;
goto out;
@@ -1107,8 +1149,8 @@ common_rsp_locklist(lock_migration_info_t *locklist, gfs3_locklist **reply)
break;
default:
- gf_msg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
- "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
+ "lock_type=%" PRId32, tmp->flock.l_type, NULL);
break;
}
@@ -1207,8 +1249,9 @@ gf_server_check_getxattr_cmd(call_frame_t *frame, const char *key)
{
list_for_each_entry(xprt, &conf->xprt_list, list)
{
- gf_msg("mount-point-list", GF_LOG_INFO, 0, PS_MSG_MOUNT_PT_FAIL,
- "%s", xprt->peerinfo.identifier);
+ gf_smsg("mount-point-list", GF_LOG_INFO, 0,
+ PS_MSG_MOUNT_PT_FAIL, "identifier=%s",
+ xprt->peerinfo.identifier, NULL);
}
}
pthread_mutex_unlock(&conf->mutex);
@@ -1238,9 +1281,8 @@ gf_server_check_setxattr_cmd(call_frame_t *frame, dict_t *dict)
total_read += xprt->total_bytes_read;
total_write += xprt->total_bytes_write;
}
- gf_msg("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT,
- "total-read %" PRIu64 ", total-write %" PRIu64, total_read,
- total_write);
+ gf_smsg("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT, "total-read=%" PRIu64,
+ total_read, "total-write=%" PRIu64, total_write, NULL);
}
return 0;
@@ -1316,15 +1358,15 @@ auth_set_username_passwd(dict_t *input_params, dict_t *config_params,
ret = dict_get_str(input_params, "password", &password);
if (ret) {
- gf_msg("auth/login", GF_LOG_WARNING, 0, PS_MSG_DICT_GET_FAILED,
- "password not found, returning DONT-CARE");
+ gf_smsg("auth/login", GF_LOG_WARNING, 0, PS_MSG_PASSWORD_NOT_FOUND,
+ NULL);
goto out;
}
ret = dict_get_str(input_params, "remote-subvolume", &brick_name);
if (ret) {
- gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
- "remote-subvolume not specified");
+ gf_smsg("auth/login", GF_LOG_ERROR, 0,
+ PS_MSG_REMOTE_SUBVOL_NOT_SPECIFIED, NULL);
ret = -1;
goto out;
}
@@ -1356,10 +1398,8 @@ auth_set_username_passwd(dict_t *input_params, dict_t *config_params,
GF_FREE(searchstr);
if (!passwd_data) {
- gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
- "wrong "
- "username/password "
- "combination");
+ gf_smsg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
+ NULL);
ret = -1;
goto out;
}
@@ -1369,10 +1409,8 @@ auth_set_username_passwd(dict_t *input_params, dict_t *config_params,
client->auth.username = gf_strdup(username);
client->auth.passwd = gf_strdup(password);
} else {
- gf_msg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
- "wrong "
- "password for user %s",
- username);
+ gf_smsg("auth/login", GF_LOG_ERROR, 0, PS_MSG_LOGIN_ERROR,
+ "username=%s", username, NULL);
}
break;
}
@@ -1409,7 +1447,7 @@ unserialize_req_locklist(gfs3_setactivelk_req *req, lock_migration_info_t *lmi)
while (trav) {
temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
if (temp == NULL) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_NO_MEM, NULL);
goto out;
}
@@ -1446,7 +1484,7 @@ unserialize_req_locklist_v2(gfx_setactivelk_req *req,
while (trav) {
temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
if (temp == NULL) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, 0, "No memory");
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, PS_MSG_NO_MEM, NULL);
goto out;
}
@@ -1467,4443 +1505,3 @@ unserialize_req_locklist_v2(gfx_setactivelk_req *req,
out:
return ret;
}
-
-int
-server_populate_compound_request(gfs3_compound_req *req, call_frame_t *frame,
- default_args_t *this_args, int index)
-{
- int op_errno = 0;
- int ret = -1;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec req_iovec[MAX_IOVEC] = {{
- 0,
- }};
- compound_req *this_req = NULL;
- server_state_t *state = CALL_STATE(frame);
-
- this_req = &req->compound_req_array.compound_req_array_val[index];
-
- switch (this_req->fop_enum) {
- case GF_FOP_STAT: {
- gfs3_stat_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_stat_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_stat_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READLINK: {
- gfs3_readlink_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_readlink_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_readlink_store(this_args, &state->loc, args->size, xdata);
- break;
- }
- case GF_FOP_MKNOD: {
- gfs3_mknod_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_mknod_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_mknod_store(this_args, &state->loc, args->mode, args->dev,
- args->umask, xdata);
- break;
- }
- case GF_FOP_MKDIR: {
- gfs3_mkdir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_mkdir_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_mkdir_store(this_args, &state->loc, args->mode, args->umask,
- xdata);
- break;
- }
- case GF_FOP_UNLINK: {
- gfs3_unlink_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_unlink_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_unlink_store(this_args, &state->loc, args->xflags, xdata);
- break;
- }
- case GF_FOP_RMDIR: {
- gfs3_rmdir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_rmdir_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_rmdir_store(this_args, &state->loc, args->xflags, xdata);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfs3_symlink_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_symlink_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_symlink_store(this_args, args->linkname, &state->loc,
- args->umask, xdata);
-
- this_args->loc.inode = inode_new(state->itable);
-
- break;
- }
- case GF_FOP_RENAME: {
- gfs3_rename_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_rename_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_rename_store(this_args, &state->loc, &state->loc2, xdata);
- break;
- }
- case GF_FOP_LINK: {
- gfs3_link_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_link_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_link_store(this_args, &state->loc, &state->loc2, xdata);
-
- this_args->loc2.inode = inode_ref(this_args->loc.inode);
-
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfs3_truncate_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_truncate_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_truncate_store(this_args, &state->loc, args->offset, xdata);
- break;
- }
- case GF_FOP_OPEN: {
- gfs3_open_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_open_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_open_store(this_args, &state->loc, args->flags, state->fd,
- xdata);
-
- this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
- this_args->fd->flags = this_args->flags;
-
- break;
- }
- case GF_FOP_READ: {
- gfs3_read_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_read_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_readv_store(this_args, state->fd, args->size, args->offset,
- args->flag, xdata);
- break;
- }
- case GF_FOP_WRITE: {
- gfs3_write_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_write_req;
-
- /*TODO : What happens when payload count is more than one? */
- req_iovec[0].iov_base = state->payload_vector[0].iov_base +
- state->write_length;
- req_iovec[0].iov_len = args->size;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- /* The way writev fop works :
- * xdr args of write along with other args contains
- * write length not count. But when the call is wound to posix,
- * this length is not used. It is taken from the request
- * write vector that is passed down. Posix needs the vector
- * count to determine the amount of write to be done.
- * This count for writes that come as part of compound fops
- * will be 1. The vectors are merged into one under
- * GF_FOP_WRITE section of client_handle_fop_requirements()
- * in protocol client.
- */
- args_writev_store(this_args, state->fd, req_iovec, 1, args->offset,
- args->flag, state->iobref, xdata);
- state->write_length += req_iovec[0].iov_len;
- break;
- }
- case GF_FOP_STATFS: {
- gfs3_statfs_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_statfs_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_statfs_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_FLUSH: {
- gfs3_flush_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_flush_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_flush_store(this_args, state->fd, xdata);
- break;
- }
- case GF_FOP_FSYNC: {
- gfs3_fsync_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fsync_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_fsync_store(this_args, state->fd, args->data, xdata);
- break;
- }
- case GF_FOP_SETXATTR: {
- gfs3_setxattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_setxattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xattr, args->dict.dict_val,
- args->dict.dict_len, ret, op_errno, out);
- args_setxattr_store(this_args, &state->loc, xattr, args->flags,
- xdata);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_getxattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- gf_server_check_getxattr_cmd(frame, args->name);
-
- args_getxattr_store(this_args, &state->loc, args->name, xdata);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfs3_removexattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_removexattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_removexattr_store(this_args, &state->loc, args->name, xdata);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfs3_opendir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_opendir_req;
-
- this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
- if (!this_args->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto out;
- }
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_opendir_store(this_args, &state->loc, state->fd, xdata);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gfs3_fsyncdir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fsyncdir_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_fsyncdir_store(this_args, state->fd, args->data, xdata);
- break;
- }
- case GF_FOP_ACCESS: {
- gfs3_access_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_access_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_access_store(this_args, &state->loc, args->mask, xdata);
- break;
- }
- case GF_FOP_CREATE: {
- gfs3_create_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_create_req;
-
- state->loc.inode = inode_new(state->itable);
-
- state->fd = fd_create(state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ? uuid_utoa(state->loc.inode->gfid)
- : NULL);
- goto out;
- }
- state->fd->flags = state->flags;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_create_store(this_args, &state->loc, args->flags, args->mode,
- args->umask, state->fd, xdata);
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfs3_ftruncate_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_ftruncate_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_ftruncate_store(this_args, state->fd, args->offset, xdata);
- break;
- }
- case GF_FOP_FSTAT: {
- gfs3_fstat_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fstat_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_fstat_store(this_args, state->fd, xdata);
- break;
- }
- case GF_FOP_LK: {
- gfs3_lk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_lk_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- case GF_LK_RESLK_LCK:
- this_args->cmd = F_RESLK_LCK;
- break;
- case GF_LK_RESLK_LCKW:
- this_args->cmd = F_RESLK_LCKW;
- break;
- case GF_LK_RESLK_UNLCK:
- this_args->cmd = F_RESLK_UNLCK;
- break;
- case GF_LK_GETLK_FD:
- this_args->cmd = F_GETLK_FD;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- default:
- gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
- PS_MSG_LOCK_ERROR,
- "fd - %" PRId64
- " (%s):"
- " Unknown "
- "lock type: %" PRId32 "!",
- state->resolve.fd_no,
- uuid_utoa(state->fd->inode->gfid), args->type);
- break;
- }
- args_lk_store(this_args, state->fd, this_args->cmd,
- &this_args->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfs3_lookup_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_lookup_req;
-
- if (this_args->loc.inode)
- this_args->loc.inode = server_inode_new(state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_lookup_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READDIR: {
- gfs3_readdir_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_readdir_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_readdir_store(this_args, state->fd, args->size, args->offset,
- xdata);
- break;
- }
- case GF_FOP_INODELK: {
- gfs3_inodelk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_inodelk_req;
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_inodelk_store(this_args, args->volume, &state->loc,
- this_args->cmd, &this_args->lock, xdata);
- break;
- }
- case GF_FOP_FINODELK: {
- gfs3_finodelk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_finodelk_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
- args_finodelk_store(this_args, args->volume, state->fd,
- this_args->cmd, &this_args->lock, xdata);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfs3_entrylk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_entrylk_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_entrylk_store(this_args, args->volume, &state->loc, args->name,
- args->cmd, args->type, xdata);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfs3_fentrylk_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fentrylk_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_fentrylk_store(this_args, args->volume, state->fd, args->name,
- args->cmd, args->type, xdata);
- break;
- }
- case GF_FOP_XATTROP: {
- gfs3_xattrop_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_xattrop_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret, op_errno, out);
- args_xattrop_store(this_args, &state->loc, args->flags, xattr,
- xdata);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fxattrop_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret, op_errno, out);
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_fxattrop_store(this_args, state->fd, args->flags, xattr,
- xdata);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fgetxattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_fgetxattr_store(this_args, state->fd, args->name, xdata);
- break;
- }
- case GF_FOP_FSETXATTR: {
- gfs3_fsetxattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fsetxattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret, op_errno, out);
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_fsetxattr_store(this_args, state->fd, xattr, args->flags,
- xdata);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfs3_rchecksum_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_rchecksum_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_rchecksum_store(this_args, state->fd, args->offset, args->len,
- xdata);
- break;
- }
- case GF_FOP_SETATTR: {
- gfs3_setattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_setattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- gf_stat_to_iatt(&args->stbuf, &this_args->stat);
-
- args_setattr_store(this_args, &state->loc, &this_args->stat,
- args->valid, xdata);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfs3_fsetattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fsetattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- gf_stat_to_iatt(&args->stbuf, &this_args->stat);
-
- args_fsetattr_store(this_args, state->fd, &this_args->stat,
- args->valid, xdata);
- break;
- }
- case GF_FOP_READDIRP: {
- gfs3_readdirp_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_readdirp_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xattr, (args->dict.dict_val),
- (args->dict.dict_len), ret, op_errno, out);
-
- args_readdirp_store(this_args, state->fd, args->size, args->offset,
- xattr);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfs3_fremovexattr_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fremovexattr_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_fremovexattr_store(this_args, state->fd, args->name, xdata);
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfs3_fallocate_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_fallocate_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_fallocate_store(this_args, state->fd, args->flags,
- args->offset, args->size, xdata);
- break;
- }
- case GF_FOP_DISCARD: {
- gfs3_discard_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_discard_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- args_discard_store(this_args, state->fd, args->offset, args->size,
- xdata);
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfs3_zerofill_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_zerofill_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_zerofill_store(this_args, state->fd, args->offset, args->size,
- xdata);
- break;
- }
- case GF_FOP_SEEK: {
- gfs3_seek_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_seek_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
- args_seek_store(this_args, state->fd, args->offset, args->what,
- xdata);
- break;
- }
- case GF_FOP_LEASE: {
- gfs3_lease_req *args = NULL;
-
- args = &this_req->compound_req_u.compound_lease_req;
-
- GF_PROTOCOL_DICT_UNSERIALIZE(
- frame->root->client->bound_xl, xdata, args->xdata.xdata_val,
- args->xdata.xdata_len, ret, op_errno, out);
-
- gf_proto_lease_to_lease(&args->lease, &state->lease);
-
- args_lease_store(this_args, &state->loc, &state->lease, xdata);
- break;
- }
- default:
- return ENOTSUP;
- }
-out:
- if (xattr)
- dict_unref(xattr);
- if (xdata)
- dict_unref(xdata);
- return op_errno;
-}
-
-int
-server_populate_compound_response(xlator_t *this, gfs3_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index)
-{
- int op_errno = EINVAL;
- default_args_cbk_t *this_args_cbk = NULL;
- compound_rsp *this_rsp = NULL;
- server_state_t *state = NULL;
- int ret = 0;
-
- state = CALL_STATE(frame);
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
-
- this_args_cbk = &args_cbk->rsp_list[index];
- this_rsp->fop_enum = args_cbk->enum_list[index];
-
- switch (this_rsp->fop_enum) {
- case GF_FOP_STAT: {
- gfs3_stat_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_stat_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_stat(state, rsp_args, &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READLINK: {
- gfs3_readlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readlink_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (this_args_cbk->op_ret >= 0) {
- server_post_readlink(rsp_args, &this_args_cbk->stat,
- this_args_cbk->buf);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- if (!rsp_args->path)
- rsp_args->path = "";
- break;
- }
- case GF_FOP_MKNOD: {
- gfs3_mknod_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_mknod_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_mknod(state, rsp_args, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- this_args_cbk->inode);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_MKDIR: {
- gfs3_mkdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_mkdir(
- state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_UNLINK: {
- gfs3_unlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_unlink_rsp;
-
- if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_unlink(state, rsp_args, &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_RMDIR: {
- gfs3_rmdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_rmdir(state, rsp_args, &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfs3_symlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_symlink_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_symlink(
- state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_RENAME: {
- gfs3_rename_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rename_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_rename(
- frame, state, rsp_args, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- &this_args_cbk->preparent2, &this_args_cbk->postparent2);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LINK: {
- gfs3_link_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_link_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_link(
- state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- this_args_cbk->xdata);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfs3_truncate_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_truncate_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_truncate(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_OPEN: {
- gfs3_open_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_open_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_open(frame, this, rsp_args, this_args_cbk->fd);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READ: {
- gfs3_read_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_read_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret >= 0) {
- server_post_readv(rsp_args, &this_args_cbk->stat,
- this_args_cbk->op_ret);
-
- if (!state->rsp_iobref) {
- state->rsp_iobref = this_args_cbk->iobref;
- state->rsp_count = 0;
- }
- iobref_merge(state->rsp_iobref, this_args_cbk->iobref);
- memcpy(&state->rsp_vector[state->rsp_count],
- this_args_cbk->vector,
- (this_args_cbk->count * sizeof(state->rsp_vector[0])));
- state->rsp_count += this_args_cbk->count;
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_WRITE: {
- gfs3_write_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_write_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret >= 0) {
- server_post_writev(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_STATFS: {
- gfs3_statfs_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_statfs_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_statfs(rsp_args, &this_args_cbk->statvfs);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FLUSH: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_flush_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FSYNC: {
- gfs3_fsync_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fsync_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_fsync(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SETXATTR: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
-
- if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (-1 != this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
-
- if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfs3_opendir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_opendir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_opendir(frame, this, rsp_args, this_args_cbk->fd);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_ACCESS: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_access_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_CREATE: {
- gfs3_create_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_create_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
-
- if (!this_args_cbk->op_ret) {
- rsp_args->op_ret = server_post_create(
- frame, rsp_args, state, this, this_args_cbk->fd,
- this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent);
- if (rsp_args->op_ret) {
- rsp_args->op_errno = -rsp_args->op_ret;
- rsp_args->op_ret = -1;
- }
- }
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfs3_ftruncate_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_ftruncate(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FSTAT: {
- gfs3_fstat_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fstat_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- if (!this_args_cbk->op_ret) {
- server_post_fstat(state, rsp_args, &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LK: {
- gfs3_lk_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_lk_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_lk(this, rsp_args, &this_args_cbk->lock);
- }
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfs3_lookup_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_lookup_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_lookup(rsp_args, frame, state, this_args_cbk->inode,
- &this_args_cbk->stat,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READDIR: {
- gfs3_readdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readdir_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server_post_readdir(rsp_args, &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- }
- }
- break;
- }
- case GF_FOP_INODELK: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FINODELK: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_XATTROP: {
- gfs3_xattrop_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (-1 != this_args_cbk->op_ret) {
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xattr, &rsp_args->dict.dict_val,
- rsp_args->dict.dict_len, rsp_args->op_errno, out);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FSETXATTR: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
-
- if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfs3_rchecksum_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_rchecksum(rsp_args, this_args_cbk->weak_checksum,
- this_args_cbk->strong_checksum);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SETATTR: {
- gfs3_setattr_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_setattr_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_setattr(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfs3_fsetattr_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_fsetattr(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READDIRP: {
- gfs3_readdirp_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server_post_readdirp(rsp_args, &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- goto out;
- }
- gf_link_inodes_from_dirent(this, state->fd->inode,
- &this_args_cbk->entries);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gf_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
-
- if (gf_replace_old_iatt_in_dict(this_args_cbk->xdata)) {
- rsp_args->op_errno = errno;
- rsp_args->op_ret = -1;
- goto out;
- }
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfs3_fallocate_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_fallocate(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_DISCARD: {
- gfs3_discard_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_discard_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_discard(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfs3_zerofill_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_zerofill(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SEEK: {
- gfs3_seek_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_seek_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LEASE: {
- gfs3_lease_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_u.compound_lease_rsp;
-
- GF_PROTOCOL_DICT_SERIALIZE(
- this, this_args_cbk->xdata, &rsp_args->xdata.xdata_val,
- rsp_args->xdata.xdata_len, rsp_args->op_errno, out);
-
- if (!this_args_cbk->op_ret) {
- server_post_lease(rsp_args, &this_args_cbk->lease);
- }
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- default:
- return ENOTSUP;
- }
- op_errno = 0;
-out:
- return op_errno;
-}
-/* This works only when the compound fop acts on one loc/inode/gfid.
- * If compound fops on more than one inode is required, multiple
- * resolve and resumes will have to be done. This will have to change.
- * Right now, multiple unlinks, rmdirs etc is are not supported.
- * This can be added for future enhancements.
- */
-int
-server_get_compound_resolve(server_state_t *state, gfs3_compound_req *req)
-{
- int i = 0;
- compound_req *array = &req->compound_req_array.compound_req_array_val[i];
-
- switch (array->fop_enum) {
- case GF_FOP_STAT: {
- gfs3_stat_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_stat_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_READLINK: {
- gfs3_readlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_readlink_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_MKNOD: {
- gfs3_mknod_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_mknod_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_MKDIR: {
- gfs3_mkdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_mkdir_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_UNLINK: {
- gfs3_unlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_unlink_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_RMDIR: {
- gfs3_rmdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_rmdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfs3_symlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_symlink_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_RENAME: {
- gfs3_rename_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_rename_req;
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup(this_req.oldbname);
- memcpy(state->resolve.pargfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup(this_req.newbname);
- memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
- break;
- }
- case GF_FOP_LINK: {
- gfs3_link_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_link_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup(this_req.newbname);
- memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfs3_truncate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_truncate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_OPEN: {
- gfs3_open_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_open_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_READ: {
- gfs3_read_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_read_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_WRITE: {
- gfs3_write_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_write_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_STATFS: {
- gfs3_statfs_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_statfs_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FLUSH: {
- gfs3_flush_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_flush_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSYNC: {
- gfs3_fsync_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fsync_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SETXATTR: {
- gfs3_setxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_setxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_getxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfs3_removexattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_removexattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfs3_opendir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_opendir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gfs3_fsyncdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fsyncdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ACCESS: {
- gfs3_access_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_access_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_CREATE: {
- gfs3_create_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_create_req;
-
- state->flags = gf_flags_to_flags(this_req.flags);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
-
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfs3_ftruncate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_ftruncate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSTAT: {
- gfs3_fstat_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fstat_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LK: {
- gfs3_lk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_lk_req;
-
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LOOKUP: {
- gfs3_lookup_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_lookup_req;
- state->resolve.type = RESOLVE_DONTCARE;
-
- if (this_req.bname && strcmp(this_req.bname, "")) {
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- } else {
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- }
- break;
- }
- case GF_FOP_READDIR: {
- gfs3_readdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_readdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_INODELK: {
- gfs3_inodelk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_inodelk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FINODELK: {
- gfs3_finodelk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_finodelk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfs3_entrylk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_entrylk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfs3_fentrylk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fentrylk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_XATTROP: {
- gfs3_xattrop_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_xattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fxattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fgetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSETXATTR: {
- gfs3_fsetxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fsetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfs3_rchecksum_req this_req = {
- 0,
- };
-
- this_req = array[i].compound_req_u.compound_rchecksum_req;
-
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SETATTR: {
- gfs3_setattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_setattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfs3_fsetattr_req this_req = {
- 0,
- };
-
- this_req = array[i].compound_req_u.compound_fsetattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_READDIRP: {
- gfs3_readdirp_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_readdirp_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfs3_fremovexattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fremovexattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfs3_fallocate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_fallocate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_DISCARD: {
- gfs3_discard_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_discard_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfs3_zerofill_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_zerofill_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SEEK: {
- gfs3_seek_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_seek_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LEASE: {
- gfs3_lease_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_u.compound_lease_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- default:
- return ENOTSUP;
- }
- return 0;
-}
-
-void
-server_compound_rsp_cleanup(gfs3_compound_rsp *rsp, compound_args_cbk_t *args)
-{
- int i, len = 0;
- compound_rsp *this_rsp = NULL;
-
- if (!rsp->compound_rsp_array.compound_rsp_array_val)
- return;
-
- len = rsp->compound_rsp_array.compound_rsp_array_len;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (args->enum_list[i]) {
- case GF_FOP_STAT:
- SERVER_FOP_RSP_CLEANUP(rsp, stat, i);
- break;
- case GF_FOP_MKNOD:
- SERVER_FOP_RSP_CLEANUP(rsp, mknod, i);
- break;
- case GF_FOP_MKDIR:
- SERVER_FOP_RSP_CLEANUP(rsp, mkdir, i);
- break;
- case GF_FOP_UNLINK:
- SERVER_FOP_RSP_CLEANUP(rsp, unlink, i);
- break;
- case GF_FOP_RMDIR:
- SERVER_FOP_RSP_CLEANUP(rsp, rmdir, i);
- break;
- case GF_FOP_SYMLINK:
- SERVER_FOP_RSP_CLEANUP(rsp, symlink, i);
- break;
- case GF_FOP_RENAME:
- SERVER_FOP_RSP_CLEANUP(rsp, rename, i);
- break;
- case GF_FOP_LINK:
- SERVER_FOP_RSP_CLEANUP(rsp, link, i);
- break;
- case GF_FOP_TRUNCATE:
- SERVER_FOP_RSP_CLEANUP(rsp, truncate, i);
- break;
- case GF_FOP_OPEN:
- SERVER_FOP_RSP_CLEANUP(rsp, open, i);
- break;
- case GF_FOP_READ:
- SERVER_FOP_RSP_CLEANUP(rsp, read, i);
- break;
- case GF_FOP_WRITE:
- SERVER_FOP_RSP_CLEANUP(rsp, write, i);
- break;
- case GF_FOP_STATFS:
- SERVER_FOP_RSP_CLEANUP(rsp, statfs, i);
- break;
- case GF_FOP_FSYNC:
- SERVER_FOP_RSP_CLEANUP(rsp, fsync, i);
- break;
- case GF_FOP_OPENDIR:
- SERVER_FOP_RSP_CLEANUP(rsp, opendir, i);
- break;
- case GF_FOP_CREATE:
- SERVER_FOP_RSP_CLEANUP(rsp, create, i);
- break;
- case GF_FOP_FTRUNCATE:
- SERVER_FOP_RSP_CLEANUP(rsp, ftruncate, i);
- break;
- case GF_FOP_FSTAT:
- SERVER_FOP_RSP_CLEANUP(rsp, fstat, i);
- break;
- case GF_FOP_LK:
- SERVER_FOP_RSP_CLEANUP(rsp, lk, i);
- break;
- case GF_FOP_LOOKUP:
- SERVER_FOP_RSP_CLEANUP(rsp, lookup, i);
- break;
- case GF_FOP_SETATTR:
- SERVER_FOP_RSP_CLEANUP(rsp, setattr, i);
- break;
- case GF_FOP_FSETATTR:
- SERVER_FOP_RSP_CLEANUP(rsp, fsetattr, i);
- break;
- case GF_FOP_FALLOCATE:
- SERVER_FOP_RSP_CLEANUP(rsp, fallocate, i);
- break;
- case GF_FOP_DISCARD:
- SERVER_FOP_RSP_CLEANUP(rsp, discard, i);
- break;
- case GF_FOP_ZEROFILL:
- SERVER_FOP_RSP_CLEANUP(rsp, zerofill, i);
- break;
- case GF_FOP_IPC:
- SERVER_FOP_RSP_CLEANUP(rsp, ipc, i);
- break;
- case GF_FOP_SEEK:
- SERVER_FOP_RSP_CLEANUP(rsp, seek, i);
- break;
- case GF_FOP_LEASE:
- SERVER_FOP_RSP_CLEANUP(rsp, lease, i);
- break;
- /* fops that use gf_common_rsp */
- case GF_FOP_FLUSH:
- SERVER_COMMON_RSP_CLEANUP(rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- SERVER_COMMON_RSP_CLEANUP(rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- SERVER_COMMON_RSP_CLEANUP(rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- SERVER_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- SERVER_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- SERVER_COMMON_RSP_CLEANUP(rsp, access, i);
- break;
- case GF_FOP_INODELK:
- SERVER_COMMON_RSP_CLEANUP(rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- SERVER_COMMON_RSP_CLEANUP(rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- SERVER_COMMON_RSP_CLEANUP(rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- SERVER_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
- break;
- case GF_FOP_READLINK:
- SERVER_FOP_RSP_CLEANUP(rsp, readlink, i);
- break;
- case GF_FOP_RCHECKSUM:
- SERVER_FOP_RSP_CLEANUP(rsp, rchecksum, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_XATTROP: {
- gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, xattrop);
- SERVER_FOP_RSP_CLEANUP(rsp, xattrop, i);
- GF_FREE(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, fxattrop);
- SERVER_FOP_RSP_CLEANUP(rsp, fxattrop, i);
- GF_FREE(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_READDIR: {
- gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdir);
- SERVER_FOP_RSP_CLEANUP(rsp, readdir, i);
- readdir_rsp_cleanup(tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP: {
- gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdirp);
- SERVER_FOP_RSP_CLEANUP(rsp, readdir, i);
- readdirp_rsp_cleanup(tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, getxattr);
- SERVER_FOP_RSP_CLEANUP(rsp, getxattr, i);
- GF_FREE(tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fgetxattr);
- SERVER_FOP_RSP_CLEANUP(rsp, fgetxattr, i);
- GF_FREE(tmp_rsp->dict.dict_val);
- break;
- }
- default:
- break;
- }
- }
- GF_FREE(rsp->compound_rsp_array.compound_rsp_array_val);
- return;
-}
-
-void
-server_compound_req_cleanup(gfs3_compound_req *req, int len)
-{
- int i = 0;
- compound_req *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < len; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, stat);
- break;
- case GF_FOP_READLINK:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, mknod);
- break;
- case GF_FOP_MKDIR: {
- gfs3_mkdir_req *args = &CPD_REQ_FIELD(curr_req, mkdir);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
- free(args->bname);
- break;
- }
- case GF_FOP_UNLINK: {
- gfs3_unlink_req *args = &CPD_REQ_FIELD(curr_req, unlink);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, unlink);
- free(args->bname);
- break;
- }
- case GF_FOP_RMDIR: {
- gfs3_rmdir_req *args = &CPD_REQ_FIELD(curr_req, rmdir);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
- free(args->bname);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfs3_symlink_req *args = &CPD_REQ_FIELD(curr_req, symlink);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, symlink);
- free(args->bname);
- free(args->linkname);
- break;
- }
- case GF_FOP_RENAME: {
- gfs3_rename_req *args = &CPD_REQ_FIELD(curr_req, rename);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, rename);
- free(args->oldbname);
- free(args->newbname);
- break;
- }
- case GF_FOP_LINK: {
- gfs3_link_req *args = &CPD_REQ_FIELD(curr_req, link);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, link);
- free(args->newbname);
- break;
- }
- case GF_FOP_TRUNCATE:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, open);
- break;
- case GF_FOP_READ:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, read);
- break;
- case GF_FOP_WRITE:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, write);
- break;
- case GF_FOP_STATFS:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsync);
- break;
- case GF_FOP_SETXATTR: {
- gfs3_setxattr_req *args = &CPD_REQ_FIELD(curr_req, setxattr);
-
- free(args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfs3_getxattr_req *args = &CPD_REQ_FIELD(curr_req, getxattr);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
- free(args->name);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfs3_removexattr_req *args = &CPD_REQ_FIELD(curr_req,
- removexattr);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
- free(args->name);
- break;
- }
- case GF_FOP_OPENDIR:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, access);
- break;
- case GF_FOP_CREATE: {
- gfs3_create_req *args = &CPD_REQ_FIELD(curr_req, create);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, create);
- free(args->bname);
- break;
- }
- case GF_FOP_FTRUNCATE:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fstat);
- break;
- case GF_FOP_LK: {
- gfs3_lk_req *args = &CPD_REQ_FIELD(curr_req, lk);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, lk);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfs3_lookup_req *args = &CPD_REQ_FIELD(curr_req, lookup);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, lookup);
- free(args->bname);
- break;
- }
- case GF_FOP_READDIR:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, readdir);
- break;
- case GF_FOP_INODELK: {
- gfs3_inodelk_req *args = &CPD_REQ_FIELD(curr_req, inodelk);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
- free(args->volume);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_FINODELK: {
- gfs3_finodelk_req *args = &CPD_REQ_FIELD(curr_req, finodelk);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
- free(args->volume);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfs3_entrylk_req *args = &CPD_REQ_FIELD(curr_req, entrylk);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
- free(args->volume);
- free(args->name);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfs3_fentrylk_req *args = &CPD_REQ_FIELD(curr_req, fentrylk);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
- free(args->volume);
- free(args->name);
- break;
- }
- case GF_FOP_XATTROP: {
- gfs3_xattrop_req *args = &CPD_REQ_FIELD(curr_req, xattrop);
-
- free(args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfs3_fxattrop_req *args = &CPD_REQ_FIELD(curr_req, fxattrop);
-
- free(args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfs3_fgetxattr_req *args = &CPD_REQ_FIELD(curr_req, fgetxattr);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
- free(args->name);
- break;
- }
- case GF_FOP_FSETXATTR: {
- gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req, fsetxattr);
-
- free(args->dict.dict_val);
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP: {
- gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req, readdirp);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
- free(args->dict.dict_val);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfs3_fremovexattr_req *args = &CPD_REQ_FIELD(curr_req,
- fremovexattr);
-
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
- free(args->name);
- break;
- }
- case GF_FOP_FALLOCATE:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- SERVER_COMPOUND_FOP_CLEANUP(curr_req, seek);
- break;
- default:
- break;
- }
- }
-
- return;
-}
-
-/* compound v2 */
-int
-server_populate_compound_request_v2(gfx_compound_req *req, call_frame_t *frame,
- default_args_t *this_args, int index)
-{
- int op_errno = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec req_iovec[MAX_IOVEC] = {{
- 0,
- }};
- compound_req_v2 *this_req = NULL;
- server_state_t *state = CALL_STATE(frame);
-
- this_req = &req->compound_req_array.compound_req_array_val[index];
-
- switch (this_req->fop_enum) {
- case GF_FOP_STAT: {
- gfx_stat_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_stat_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_stat_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READLINK: {
- gfx_readlink_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_readlink_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_readlink_store(this_args, &state->loc, args->size, xdata);
- break;
- }
- case GF_FOP_MKNOD: {
- gfx_mknod_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_mknod_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_mknod_store(this_args, &state->loc, args->mode, args->dev,
- args->umask, xdata);
- break;
- }
- case GF_FOP_MKDIR: {
- gfx_mkdir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_mkdir_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_mkdir_store(this_args, &state->loc, args->mode, args->umask,
- xdata);
- break;
- }
- case GF_FOP_UNLINK: {
- gfx_unlink_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_unlink_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_unlink_store(this_args, &state->loc, args->xflags, xdata);
- break;
- }
- case GF_FOP_RMDIR: {
- gfx_rmdir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_rmdir_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_rmdir_store(this_args, &state->loc, args->xflags, xdata);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfx_symlink_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_symlink_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_symlink_store(this_args, args->linkname, &state->loc,
- args->umask, xdata);
-
- this_args->loc.inode = inode_new(state->itable);
-
- break;
- }
- case GF_FOP_RENAME: {
- gfx_rename_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_rename_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_rename_store(this_args, &state->loc, &state->loc2, xdata);
- break;
- }
- case GF_FOP_LINK: {
- gfx_link_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_link_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_link_store(this_args, &state->loc, &state->loc2, xdata);
-
- this_args->loc2.inode = inode_ref(this_args->loc.inode);
-
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfx_truncate_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_truncate_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_truncate_store(this_args, &state->loc, args->offset, xdata);
- break;
- }
- case GF_FOP_OPEN: {
- gfx_open_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_open_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_open_store(this_args, &state->loc, args->flags, state->fd,
- xdata);
-
- this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
- this_args->fd->flags = this_args->flags;
-
- break;
- }
- case GF_FOP_READ: {
- gfx_read_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_read_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_readv_store(this_args, state->fd, args->size, args->offset,
- args->flag, xdata);
- break;
- }
- case GF_FOP_WRITE: {
- gfx_write_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_write_req;
-
- /*TODO : What happens when payload count is more than one? */
- req_iovec[0].iov_base = state->payload_vector[0].iov_base +
- state->write_length;
- req_iovec[0].iov_len = args->size;
-
- xdr_to_dict(&args->xdata, &xdata);
- /* The way writev fop works :
- * xdr args of write along with other args contains
- * write length not count. But when the call is wound to posix,
- * this length is not used. It is taken from the request
- * write vector that is passed down. Posix needs the vector
- * count to determine the amount of write to be done.
- * This count for writes that come as part of compound fops
- * will be 1. The vectors are merged into one under
- * GF_FOP_WRITE section of client_handle_fop_requirements()
- * in protocol client.
- */
- args_writev_store(this_args, state->fd, req_iovec, 1, args->offset,
- args->flag, state->iobref, xdata);
- state->write_length += req_iovec[0].iov_len;
- break;
- }
- case GF_FOP_STATFS: {
- gfx_statfs_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_statfs_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_statfs_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_FLUSH: {
- gfx_flush_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_flush_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_flush_store(this_args, state->fd, xdata);
- break;
- }
- case GF_FOP_FSYNC: {
- gfx_fsync_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fsync_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_fsync_store(this_args, state->fd, args->data, xdata);
- break;
- }
- case GF_FOP_SETXATTR: {
- gfx_setxattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_setxattr_req;
-
- xdr_to_dict(&args->dict, &xattr);
- xdr_to_dict(&args->xdata, &xdata);
- args_setxattr_store(this_args, &state->loc, xattr, args->flags,
- xdata);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfx_getxattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_getxattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- gf_server_check_getxattr_cmd(frame, args->name);
-
- args_getxattr_store(this_args, &state->loc, args->name, xdata);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfx_removexattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_removexattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_removexattr_store(this_args, &state->loc, args->name, xdata);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfx_opendir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_opendir_req;
-
- this_args->fd = fd_create(this_args->loc.inode, frame->root->pid);
- if (!this_args->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
- goto out;
- }
- xdr_to_dict(&args->xdata, &xdata);
-
- args_opendir_store(this_args, &state->loc, state->fd, xdata);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gfx_fsyncdir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fsyncdir_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_fsyncdir_store(this_args, state->fd, args->data, xdata);
- break;
- }
- case GF_FOP_ACCESS: {
- gfx_access_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_access_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_access_store(this_args, &state->loc, args->mask, xdata);
- break;
- }
- case GF_FOP_CREATE: {
- gfx_create_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_create_req;
-
- state->loc.inode = inode_new(state->itable);
-
- state->fd = fd_create(state->loc.inode, frame->root->pid);
- if (!state->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ? uuid_utoa(state->loc.inode->gfid)
- : NULL);
- goto out;
- }
- state->fd->flags = state->flags;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_create_store(this_args, &state->loc, args->flags, args->mode,
- args->umask, state->fd, xdata);
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfx_ftruncate_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_ftruncate_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_ftruncate_store(this_args, state->fd, args->offset, xdata);
- break;
- }
- case GF_FOP_FSTAT: {
- gfx_fstat_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fstat_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_fstat_store(this_args, state->fd, xdata);
- break;
- }
- case GF_FOP_LK: {
- gfx_lk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_lk_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- case GF_LK_RESLK_LCK:
- this_args->cmd = F_RESLK_LCK;
- break;
- case GF_LK_RESLK_LCKW:
- this_args->cmd = F_RESLK_LCKW;
- break;
- case GF_LK_RESLK_UNLCK:
- this_args->cmd = F_RESLK_UNLCK;
- break;
- case GF_LK_GETLK_FD:
- this_args->cmd = F_GETLK_FD;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- default:
- gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
- PS_MSG_LOCK_ERROR,
- "fd - %" PRId64
- " (%s):"
- " Unknown "
- "lock type: %" PRId32 "!",
- state->resolve.fd_no,
- uuid_utoa(state->fd->inode->gfid), args->type);
- break;
- }
- args_lk_store(this_args, state->fd, this_args->cmd,
- &this_args->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfx_lookup_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_lookup_req;
-
- if (this_args->loc.inode)
- this_args->loc.inode = server_inode_new(state->itable,
- state->loc.gfid);
- else
- state->is_revalidate = 1;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_lookup_store(this_args, &state->loc, xdata);
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_readdir_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_readdir_store(this_args, state->fd, args->size, args->offset,
- xdata);
- break;
- }
- case GF_FOP_INODELK: {
- gfx_inodelk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_inodelk_req;
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
-
- xdr_to_dict(&args->xdata, &xdata);
- args_inodelk_store(this_args, args->volume, &state->loc,
- this_args->cmd, &this_args->lock, xdata);
- break;
- }
- case GF_FOP_FINODELK: {
- gfx_finodelk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_finodelk_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- switch (args->cmd) {
- case GF_LK_GETLK:
- this_args->cmd = F_GETLK;
- break;
- case GF_LK_SETLK:
- this_args->cmd = F_SETLK;
- break;
- case GF_LK_SETLKW:
- this_args->cmd = F_SETLKW;
- break;
- }
-
- gf_proto_flock_to_flock(&args->flock, &this_args->lock);
-
- switch (args->type) {
- case GF_LK_F_RDLCK:
- this_args->lock.l_type = F_RDLCK;
- break;
- case GF_LK_F_WRLCK:
- this_args->lock.l_type = F_WRLCK;
- break;
- case GF_LK_F_UNLCK:
- this_args->lock.l_type = F_UNLCK;
- break;
- }
- args_finodelk_store(this_args, args->volume, state->fd,
- this_args->cmd, &this_args->lock, xdata);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfx_entrylk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_entrylk_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_entrylk_store(this_args, args->volume, &state->loc, args->name,
- args->cmd, args->type, xdata);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfx_fentrylk_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fentrylk_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_fentrylk_store(this_args, args->volume, state->fd, args->name,
- args->cmd, args->type, xdata);
- break;
- }
- case GF_FOP_XATTROP: {
- gfx_xattrop_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_xattrop_req;
-
- xdr_to_dict(&args->dict, &xattr);
-
- xdr_to_dict(&args->xdata, &xdata);
- args_xattrop_store(this_args, &state->loc, args->flags, xattr,
- xdata);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfx_fxattrop_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fxattrop_req;
-
- xdr_to_dict(&args->dict, &xattr);
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_fxattrop_store(this_args, state->fd, args->flags, xattr,
- xdata);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfx_fgetxattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fgetxattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_fgetxattr_store(this_args, state->fd, args->name, xdata);
- break;
- }
- case GF_FOP_FSETXATTR: {
- gfx_fsetxattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fsetxattr_req;
-
- xdr_to_dict(&args->dict, &xattr);
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_fsetxattr_store(this_args, state->fd, xattr, args->flags,
- xdata);
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfx_rchecksum_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_rchecksum_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_rchecksum_store(this_args, state->fd, args->offset, args->len,
- xdata);
- break;
- }
- case GF_FOP_SETATTR: {
- gfx_setattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_setattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- gfx_stat_to_iattx(&args->stbuf, &this_args->stat);
-
- args_setattr_store(this_args, &state->loc, &this_args->stat,
- args->valid, xdata);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfx_fsetattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fsetattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- gfx_stat_to_iattx(&args->stbuf, &this_args->stat);
-
- args_fsetattr_store(this_args, state->fd, &this_args->stat,
- args->valid, xdata);
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_readdirp_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_readdirp_store(this_args, state->fd, args->size, args->offset,
- xattr);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfx_fremovexattr_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fremovexattr_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_fremovexattr_store(this_args, state->fd, args->name, xdata);
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfx_fallocate_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_fallocate_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_fallocate_store(this_args, state->fd, args->flags,
- args->offset, args->size, xdata);
- break;
- }
- case GF_FOP_DISCARD: {
- gfx_discard_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_discard_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- args_discard_store(this_args, state->fd, args->offset, args->size,
- xdata);
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfx_zerofill_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_zerofill_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_zerofill_store(this_args, state->fd, args->offset, args->size,
- xdata);
- break;
- }
- case GF_FOP_SEEK: {
- gfx_seek_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_seek_req;
-
- xdr_to_dict(&args->xdata, &xdata);
- args_seek_store(this_args, state->fd, args->offset, args->what,
- xdata);
- break;
- }
- case GF_FOP_LEASE: {
- gfx_lease_req *args = NULL;
-
- args = &this_req->compound_req_v2_u.compound_lease_req;
-
- xdr_to_dict(&args->xdata, &xdata);
-
- gf_proto_lease_to_lease(&args->lease, &state->lease);
-
- args_lease_store(this_args, &state->loc, &state->lease, xdata);
- break;
- }
- default:
- return ENOTSUP;
- }
-out:
- if (xattr)
- dict_unref(xattr);
- if (xdata)
- dict_unref(xdata);
- return op_errno;
-}
-
-int
-server_populate_compound_response_v2(xlator_t *this, gfx_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index)
-{
- int op_errno = EINVAL;
- default_args_cbk_t *this_args_cbk = NULL;
- compound_rsp_v2 *this_rsp = NULL;
- server_state_t *state = NULL;
- int ret = 0;
-
- state = CALL_STATE(frame);
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
-
- this_args_cbk = &args_cbk->rsp_list[index];
- this_rsp->fop_enum = args_cbk->enum_list[index];
-
- switch (this_rsp->fop_enum) {
- case GF_FOP_FSTAT:
- case GF_FOP_STAT: {
- gfx_common_iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_common_iatt(state, rsp_args, &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READLINK: {
- gfx_readlink_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (this_args_cbk->op_ret >= 0) {
- server4_post_readlink(rsp_args, &this_args_cbk->stat,
- this_args_cbk->buf);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- if (!rsp_args->path)
- rsp_args->path = "";
- break;
- }
- case GF_FOP_MKNOD:
- case GF_FOP_MKDIR:
- case GF_FOP_SYMLINK:
- case GF_FOP_LINK: {
- gfx_common_3iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_common_3iatt(
- state, rsp_args, this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_UNLINK:
- case GF_FOP_RMDIR: {
- gfx_common_2iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_entry_remove(state, rsp_args,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_RENAME: {
- gfx_rename_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_rename(
- frame, state, rsp_args, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent,
- &this_args_cbk->preparent2, &this_args_cbk->postparent2);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FALLOCATE:
- case GF_FOP_ZEROFILL:
- case GF_FOP_DISCARD:
- case GF_FOP_SETATTR:
- case GF_FOP_FSETATTR:
- case GF_FOP_FTRUNCATE:
- case GF_FOP_TRUNCATE:
- case GF_FOP_WRITE:
- case GF_FOP_FSYNC: {
- gfx_common_2iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_common_2iatt(rsp_args, &this_args_cbk->prestat,
- &this_args_cbk->poststat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_OPEN:
- case GF_FOP_OPENDIR: {
- gfx_open_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_open(frame, this, rsp_args, this_args_cbk->fd);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READ: {
- gfx_read_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (this_args_cbk->op_ret >= 0) {
- server4_post_readv(rsp_args, &this_args_cbk->stat,
- this_args_cbk->op_ret);
-
- if (!state->rsp_iobref) {
- state->rsp_iobref = this_args_cbk->iobref;
- state->rsp_count = 0;
- }
- iobref_merge(state->rsp_iobref, this_args_cbk->iobref);
- memcpy(&state->rsp_vector[state->rsp_count],
- this_args_cbk->vector,
- (this_args_cbk->count * sizeof(state->rsp_vector[0])));
- state->rsp_count += this_args_cbk->count;
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_STATFS: {
- gfx_statfs_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- if (!this_args_cbk->op_ret) {
- server4_post_statfs(rsp_args, &this_args_cbk->statvfs);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FLUSH:
- case GF_FOP_SETXATTR:
- case GF_FOP_FSETXATTR:
- case GF_FOP_REMOVEXATTR:
- case GF_FOP_FREMOVEXATTR:
- case GF_FOP_FSYNCDIR:
- case GF_FOP_ACCESS:
- case GF_FOP_INODELK:
- case GF_FOP_FINODELK:
- case GF_FOP_ENTRYLK:
- case GF_FOP_FENTRYLK: {
- gfx_common_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_FGETXATTR:
- case GF_FOP_GETXATTR:
- case GF_FOP_XATTROP:
- case GF_FOP_FXATTROP: {
- gfx_common_dict_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (-1 != this_args_cbk->op_ret) {
- dict_to_xdr(this_args_cbk->xattr, &rsp_args->dict);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_CREATE: {
- gfx_create_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
-
- if (!this_args_cbk->op_ret) {
- rsp_args->op_ret = server4_post_create(
- frame, rsp_args, state, this, this_args_cbk->fd,
- this_args_cbk->inode, &this_args_cbk->stat,
- &this_args_cbk->preparent, &this_args_cbk->postparent);
- if (rsp_args->op_ret) {
- rsp_args->op_errno = -rsp_args->op_ret;
- rsp_args->op_ret = -1;
- }
- }
- break;
- }
- case GF_FOP_LK: {
- gfx_lk_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_lk(this, rsp_args, &this_args_cbk->lock);
- }
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfx_common_2iatt_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- gfx_stat_from_iattx(&rsp_args->poststat,
- &this_args_cbk->postparent);
-
- if (!this_args_cbk->op_ret) {
- server4_post_lookup(rsp_args, frame, state,
- this_args_cbk->inode, &this_args_cbk->stat);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server4_post_readdir(rsp_args, &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- }
- }
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfx_rchecksum_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_rchecksum(rsp_args, this_args_cbk->weak_checksum,
- this_args_cbk->strong_checksum);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (this_args_cbk->op_ret > 0) {
- ret = server4_post_readdirp(rsp_args, &this_args_cbk->entries);
- if (ret < 0) {
- rsp_args->op_ret = ret;
- rsp_args->op_errno = ENOMEM;
- goto out;
- }
- gf_link_inodes_from_dirent(this, state->fd->inode,
- &this_args_cbk->entries);
- }
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_SEEK: {
- gfx_seek_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- case GF_FOP_LEASE: {
- gfx_lease_rsp *rsp_args = NULL;
-
- rsp_args = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
-
- dict_to_xdr(this_args_cbk->xdata, &rsp_args->xdata);
-
- if (!this_args_cbk->op_ret) {
- server4_post_lease(rsp_args, &this_args_cbk->lease);
- }
-
- rsp_args->op_ret = this_args_cbk->op_ret;
- rsp_args->op_errno = gf_errno_to_error(this_args_cbk->op_errno);
- break;
- }
- default:
- return ENOTSUP;
- }
- op_errno = 0;
-out:
- return op_errno;
-}
-/* This works only when the compound fop acts on one loc/inode/gfid.
- * If compound fops on more than one inode is required, multiple
- * resolve and resumes will have to be done. This will have to change.
- * Right now, multiple unlinks, rmdirs etc is are not supported.
- * This can be added for future enhancements.
- */
-int
-server_get_compound_resolve_v2(server_state_t *state, gfx_compound_req *req)
-{
- int i = 0;
- compound_req_v2 *array = NULL;
-
- array = &req->compound_req_array.compound_req_array_val[i];
-
- switch (array->fop_enum) {
- case GF_FOP_STAT: {
- gfx_stat_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_stat_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_READLINK: {
- gfx_readlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_readlink_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_MKNOD: {
- gfx_mknod_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_mknod_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_MKDIR: {
- gfx_mkdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_mkdir_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_UNLINK: {
- gfx_unlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_unlink_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_RMDIR: {
- gfx_rmdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_rmdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfx_symlink_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_symlink_req;
-
- state->resolve.type = RESOLVE_NOT;
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_RENAME: {
- gfx_rename_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_rename_req;
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.bname = gf_strdup(this_req.oldbname);
- memcpy(state->resolve.pargfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_MAY;
- state->resolve2.bname = gf_strdup(this_req.newbname);
- memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
- break;
- }
- case GF_FOP_LINK: {
- gfx_link_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_link_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.oldgfid, 16);
-
- state->resolve2.type = RESOLVE_NOT;
- state->resolve2.bname = gf_strdup(this_req.newbname);
- memcpy(state->resolve2.pargfid, this_req.newgfid, 16);
- break;
- }
- case GF_FOP_TRUNCATE: {
- gfx_truncate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_truncate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_OPEN: {
- gfx_open_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_open_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_READ: {
- gfx_read_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_read_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_WRITE: {
- gfx_write_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_write_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_STATFS: {
- gfx_statfs_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_statfs_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FLUSH: {
- gfx_flush_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_flush_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSYNC: {
- gfx_fsync_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fsync_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SETXATTR: {
- gfx_setxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_setxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfx_getxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_getxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfx_removexattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_removexattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_OPENDIR: {
- gfx_opendir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_opendir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FSYNCDIR: {
- gfx_fsyncdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fsyncdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ACCESS: {
- gfx_access_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_access_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_CREATE: {
- gfx_create_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_create_req;
-
- state->flags = gf_flags_to_flags(this_req.flags);
- if (state->flags & O_EXCL) {
- state->resolve.type = RESOLVE_NOT;
- } else {
- state->resolve.type = RESOLVE_DONTCARE;
- }
-
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- break;
- }
- case GF_FOP_FTRUNCATE: {
- gfx_ftruncate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_ftruncate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSTAT: {
- gfx_fstat_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fstat_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LK: {
- gfx_lk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_lk_req;
-
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LOOKUP: {
- gfx_lookup_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_lookup_req;
- state->resolve.type = RESOLVE_DONTCARE;
-
- if (this_req.bname && strcmp(this_req.bname, "")) {
- memcpy(state->resolve.pargfid, this_req.pargfid, 16);
- state->resolve.bname = gf_strdup(this_req.bname);
- } else {
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- }
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_readdir_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_INODELK: {
- gfx_inodelk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_inodelk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FINODELK: {
- gfx_finodelk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_finodelk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfx_entrylk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_entrylk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfx_fentrylk_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fentrylk_req;
-
- state->resolve.type = RESOLVE_EXACT;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_XATTROP: {
- gfx_xattrop_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_xattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfx_fxattrop_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fxattrop_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfx_fgetxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fgetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FSETXATTR: {
- gfx_fsetxattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fsetxattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_RCHECKSUM: {
- gfx_rchecksum_req this_req = {
- {
- 0,
- },
- };
-
- this_req = array[i].compound_req_v2_u.compound_rchecksum_req;
-
- state->resolve.type = RESOLVE_MAY;
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SETATTR: {
- gfx_setattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_setattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- case GF_FOP_FSETATTR: {
- gfx_fsetattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fsetattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_readdirp_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfx_fremovexattr_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fremovexattr_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_FALLOCATE: {
- gfx_fallocate_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_fallocate_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_DISCARD: {
- gfx_discard_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_discard_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_ZEROFILL: {
- gfx_zerofill_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_zerofill_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_SEEK: {
- gfx_seek_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_seek_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- state->resolve.fd_no = this_req.fd;
- break;
- }
- case GF_FOP_LEASE: {
- gfx_lease_req this_req = {{
- 0,
- }};
-
- this_req = array[i].compound_req_v2_u.compound_lease_req;
-
- state->resolve.type = RESOLVE_MUST;
- memcpy(state->resolve.gfid, this_req.gfid, 16);
- break;
- }
- default:
- return ENOTSUP;
- }
- return 0;
-}
-
-void
-server_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, compound_args_cbk_t *args)
-{
- int i, len = 0;
- compound_rsp_v2 *this_rsp = NULL;
-
- if (!rsp->compound_rsp_array.compound_rsp_array_val)
- return;
-
- len = rsp->compound_rsp_array.compound_rsp_array_len;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (args->enum_list[i]) {
- case GF_FOP_STAT:
- SERVER4_FOP_RSP_CLEANUP(rsp, stat, i, common_iatt);
- break;
- case GF_FOP_MKNOD:
- SERVER4_FOP_RSP_CLEANUP(rsp, mknod, i, common_3iatt);
- break;
- case GF_FOP_MKDIR:
- SERVER4_FOP_RSP_CLEANUP(rsp, mkdir, i, common_3iatt);
- break;
- case GF_FOP_UNLINK:
- SERVER4_FOP_RSP_CLEANUP(rsp, unlink, i, common_2iatt);
- break;
- case GF_FOP_RMDIR:
- SERVER4_FOP_RSP_CLEANUP(rsp, rmdir, i, common_2iatt);
- break;
- case GF_FOP_SYMLINK:
- SERVER4_FOP_RSP_CLEANUP(rsp, symlink, i, common_3iatt);
- break;
- case GF_FOP_RENAME:
- SERVER4_FOP_RSP_CLEANUP(rsp, rename, i, rename);
- break;
- case GF_FOP_LINK:
- SERVER4_FOP_RSP_CLEANUP(rsp, link, i, common_3iatt);
- break;
- case GF_FOP_TRUNCATE:
- SERVER4_FOP_RSP_CLEANUP(rsp, truncate, i, common_2iatt);
- break;
- case GF_FOP_OPEN:
- SERVER4_FOP_RSP_CLEANUP(rsp, open, i, open);
- break;
- case GF_FOP_READ:
- SERVER4_FOP_RSP_CLEANUP(rsp, read, i, read);
- break;
- case GF_FOP_WRITE:
- SERVER4_FOP_RSP_CLEANUP(rsp, write, i, common_2iatt);
- break;
- case GF_FOP_STATFS:
- SERVER4_FOP_RSP_CLEANUP(rsp, statfs, i, statfs);
- break;
- case GF_FOP_FSYNC:
- SERVER4_FOP_RSP_CLEANUP(rsp, fsync, i, common_2iatt);
- break;
- case GF_FOP_OPENDIR:
- SERVER4_FOP_RSP_CLEANUP(rsp, opendir, i, open);
- break;
- case GF_FOP_CREATE:
- SERVER4_FOP_RSP_CLEANUP(rsp, create, i, create);
- break;
- case GF_FOP_FTRUNCATE:
- SERVER4_FOP_RSP_CLEANUP(rsp, ftruncate, i, common_2iatt);
- break;
- case GF_FOP_FSTAT:
- SERVER4_FOP_RSP_CLEANUP(rsp, fstat, i, common_iatt);
- break;
- case GF_FOP_LK:
- SERVER4_FOP_RSP_CLEANUP(rsp, lk, i, lk);
- break;
- case GF_FOP_LOOKUP:
- SERVER4_FOP_RSP_CLEANUP(rsp, lookup, i, common_2iatt);
- break;
- case GF_FOP_SETATTR:
- SERVER4_FOP_RSP_CLEANUP(rsp, setattr, i, common_2iatt);
- break;
- case GF_FOP_FSETATTR:
- SERVER4_FOP_RSP_CLEANUP(rsp, fsetattr, i, common_2iatt);
- break;
- case GF_FOP_FALLOCATE:
- SERVER4_FOP_RSP_CLEANUP(rsp, fallocate, i, common_2iatt);
- break;
- case GF_FOP_DISCARD:
- SERVER4_FOP_RSP_CLEANUP(rsp, discard, i, common_2iatt);
- break;
- case GF_FOP_ZEROFILL:
- SERVER4_FOP_RSP_CLEANUP(rsp, zerofill, i, common_2iatt);
- break;
- case GF_FOP_SEEK:
- SERVER4_FOP_RSP_CLEANUP(rsp, seek, i, seek);
- break;
- case GF_FOP_LEASE:
- SERVER4_FOP_RSP_CLEANUP(rsp, lease, i, lease);
- break;
- case GF_FOP_READLINK:
- SERVER4_FOP_RSP_CLEANUP(rsp, readlink, i, readlink);
- break;
- case GF_FOP_RCHECKSUM:
- SERVER4_FOP_RSP_CLEANUP(rsp, rchecksum, i, rchecksum);
- break;
- /* fops that use gfx_common_rsp */
- case GF_FOP_IPC:
- SERVER4_COMMON_RSP_CLEANUP(rsp, ipc, i);
- break;
- case GF_FOP_FLUSH:
- SERVER4_COMMON_RSP_CLEANUP(rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- SERVER4_COMMON_RSP_CLEANUP(rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- SERVER4_COMMON_RSP_CLEANUP(rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- SERVER4_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- SERVER4_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- SERVER4_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- SERVER4_COMMON_RSP_CLEANUP(rsp, access, i);
- break;
- case GF_FOP_INODELK:
- SERVER4_COMMON_RSP_CLEANUP(rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- SERVER4_COMMON_RSP_CLEANUP(rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- SERVER4_COMMON_RSP_CLEANUP(rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- SERVER4_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_XATTROP: {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- xattrop);
- SERVER4_FOP_RSP_CLEANUP(rsp, xattrop, i, common_dict);
- GF_FREE(tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_FXATTROP: {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- fxattrop);
- SERVER4_FOP_RSP_CLEANUP(rsp, fxattrop, i, common_dict);
- GF_FREE(tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_READDIR: {
- gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdir);
- SERVER4_FOP_RSP_CLEANUP(rsp, readdir, i, readdir);
- readdir_rsp_cleanup_v2(tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP: {
- gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdirp);
- SERVER4_FOP_RSP_CLEANUP(rsp, readdirp, i, readdirp);
- readdirp_rsp_cleanup_v2(tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- getxattr);
- SERVER4_FOP_RSP_CLEANUP(rsp, getxattr, i, common_dict);
- GF_FREE(tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfx_common_dict_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- fgetxattr);
- SERVER4_FOP_RSP_CLEANUP(rsp, fgetxattr, i, common_dict);
- GF_FREE(tmp_rsp->dict.pairs.pairs_val);
- break;
- }
- default:
- break;
- }
- }
- GF_FREE(rsp->compound_rsp_array.compound_rsp_array_val);
- return;
-}
-
-void
-server_compound_req_cleanup_v2(gfx_compound_req *req, int len)
-{
- int i = 0;
- compound_req_v2 *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < len; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_MKDIR: {
- gfx_mkdir_req *args = &CPD4_REQ_FIELD(curr_req, mkdir);
-
- free(args->bname);
- break;
- }
- case GF_FOP_UNLINK: {
- gfx_unlink_req *args = &CPD4_REQ_FIELD(curr_req, unlink);
- free(args->bname);
- break;
- }
- case GF_FOP_RMDIR: {
- gfx_rmdir_req *args = &CPD4_REQ_FIELD(curr_req, rmdir);
- free(args->bname);
- break;
- }
- case GF_FOP_SYMLINK: {
- gfx_symlink_req *args = &CPD4_REQ_FIELD(curr_req, symlink);
- free(args->bname);
- free(args->linkname);
- break;
- }
- case GF_FOP_RENAME: {
- gfx_rename_req *args = &CPD4_REQ_FIELD(curr_req, rename);
- free(args->oldbname);
- free(args->newbname);
- break;
- }
- case GF_FOP_LINK: {
- gfx_link_req *args = &CPD4_REQ_FIELD(curr_req, link);
- free(args->newbname);
- break;
- }
- case GF_FOP_GETXATTR: {
- gfx_getxattr_req *args = &CPD4_REQ_FIELD(curr_req, getxattr);
-
- free(args->name);
- break;
- }
- case GF_FOP_REMOVEXATTR: {
- gfx_removexattr_req *args = &CPD4_REQ_FIELD(curr_req,
- removexattr);
-
- free(args->name);
- break;
- }
- case GF_FOP_CREATE: {
- gfx_create_req *args = &CPD4_REQ_FIELD(curr_req, create);
-
- free(args->bname);
- break;
- }
- case GF_FOP_LK: {
- gfx_lk_req *args = &CPD4_REQ_FIELD(curr_req, lk);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_LOOKUP: {
- gfx_lookup_req *args = &CPD4_REQ_FIELD(curr_req, lookup);
- free(args->bname);
- break;
- }
- case GF_FOP_INODELK: {
- gfx_inodelk_req *args = &CPD4_REQ_FIELD(curr_req, inodelk);
-
- free(args->volume);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_FINODELK: {
- gfx_finodelk_req *args = &CPD4_REQ_FIELD(curr_req, finodelk);
-
- free(args->volume);
- free(args->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_ENTRYLK: {
- gfx_entrylk_req *args = &CPD4_REQ_FIELD(curr_req, entrylk);
-
- free(args->volume);
- free(args->name);
- break;
- }
- case GF_FOP_FENTRYLK: {
- gfx_fentrylk_req *args = &CPD4_REQ_FIELD(curr_req, fentrylk);
-
- free(args->volume);
- free(args->name);
- break;
- }
- case GF_FOP_FGETXATTR: {
- gfx_fgetxattr_req *args = &CPD4_REQ_FIELD(curr_req, fgetxattr);
-
- free(args->name);
- break;
- }
- case GF_FOP_FREMOVEXATTR: {
- gfx_fremovexattr_req *args = &CPD4_REQ_FIELD(curr_req,
- fremovexattr);
- free(args->name);
- break;
- }
- default:
- break;
- }
- }
-
- return;
-}
diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h
index 20b8d901bd2..837fdc84f17 100644
--- a/xlators/protocol/server/src/server-helpers.h
+++ b/xlators/protocol/server/src/server-helpers.h
@@ -12,7 +12,7 @@
#define _SERVER_HELPERS_H
#include "server.h"
-#include "defaults.h"
+#include <glusterfs/defaults.h>
#define CALL_STATE(frame) ((server_state_t *)frame->root->state)
@@ -43,8 +43,8 @@ call_frame_t *
get_frame_from_request(rpcsvc_request_t *req);
int
-server_connection_cleanup(xlator_t *this, struct _client *client,
- int32_t flags);
+server_connection_cleanup(xlator_t *this, struct _client *client, int32_t flags,
+ gf_boolean_t *fd_exist);
int
server_build_config(xlator_t *this, server_conf_t *conf);
@@ -86,22 +86,6 @@ int
getactivelkinfo_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp);
int
-server_populate_compound_response(xlator_t *this, gfs3_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index);
-int
-server_get_compound_resolve(server_state_t *state, gfs3_compound_req *req);
-
-int
-server_populate_compound_request(gfs3_compound_req *req, call_frame_t *frame,
- default_args_t *this_args, int index);
-void
-server_compound_rsp_cleanup(gfs3_compound_rsp *rsp, compound_args_cbk_t *args);
-
-void
-server_compound_req_cleanup(gfs3_compound_req *req, int len);
-
-int
unserialize_req_locklist(gfs3_setactivelk_req *req, lock_migration_info_t *lmi);
int
@@ -120,21 +104,4 @@ serialize_rsp_dirent_v2(gf_dirent_t *entries, gfx_readdir_rsp *rsp);
int
serialize_rsp_direntp_v2(gf_dirent_t *entries, gfx_readdirp_rsp *rsp);
-int
-server_populate_compound_response_v2(xlator_t *this, gfx_compound_rsp *rsp,
- call_frame_t *frame,
- compound_args_cbk_t *args_cbk, int index);
-int
-server_get_compound_resolve_v2(server_state_t *state, gfx_compound_req *req);
-
-int
-server_populate_compound_request_v2(gfx_compound_req *req, call_frame_t *frame,
- default_args_t *this_args, int index);
-void
-server_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp,
- compound_args_cbk_t *args);
-
-void
-server_compound_req_cleanup_v2(gfx_compound_req *req, int len);
-
#endif /* !_SERVER_HELPERS_H */
diff --git a/xlators/protocol/server/src/server-mem-types.h b/xlators/protocol/server/src/server-mem-types.h
index 4b341e53845..081e9f40e84 100644
--- a/xlators/protocol/server/src/server-mem-types.h
+++ b/xlators/protocol/server/src/server-mem-types.h
@@ -11,19 +11,13 @@
#ifndef __SERVER_MEM_TYPES_H__
#define __SERVER_MEM_TYPES_H__
-#include "mem-types.h"
+#include <glusterfs/mem-types.h>
enum gf_server_mem_types_ {
gf_server_mt_server_conf_t = gf_common_mt_end + 1,
- gf_server_mt_resolv_comp_t,
gf_server_mt_state_t,
- gf_server_mt_locker_t,
- gf_server_mt_lock_table_t,
- gf_server_mt_conn_t,
gf_server_mt_dirent_rsp_t,
gf_server_mt_rsp_buf_t,
- gf_server_mt_volfile_ctx_t,
- gf_server_mt_timer_data_t,
gf_server_mt_setvolume_rsp_t,
gf_server_mt_lock_mig_t,
gf_server_mt_compound_rsp_t,
diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h
index bc7431b9d86..1b2e149cb7d 100644
--- a/xlators/protocol/server/src/server-messages.h
+++ b/xlators/protocol/server/src/server-messages.h
@@ -11,7 +11,7 @@
#ifndef _PS_MESSAGES_H__
#define _PS_MESSAGES_H__
-#include "glfs-message-id.h"
+#include <glusterfs/glfs-message-id.h>
/* To add new message IDs, append new identifiers at the end of the list.
*
@@ -23,43 +23,146 @@
* glfs-message-id.h.
*/
-GLFS_MSGID(PS, PS_MSG_AUTHENTICATE_ERROR, PS_MSG_VOL_VALIDATE_FAILED,
- PS_MSG_AUTH_INIT_FAILED, PS_MSG_REMOTE_CLIENT_REFUSED,
- PS_MSG_GFID_RESOLVE_FAILED, PS_MSG_ANONYMOUS_FD_CREATE_FAILED,
- PS_MSG_NO_MEMORY, PS_MSG_FD_NOT_FOUND, PS_MSG_INVALID_ENTRY,
- PS_MSG_GET_UID_FAILED, PS_MSG_UID_NOT_FOUND, PS_MSG_MAPPING_ERROR,
- PS_MSG_FD_CLEANUP, PS_MSG_SERVER_CTX_GET_FAILED, PS_MSG_FDENTRY_NULL,
- PS_MSG_DIR_NOT_FOUND, PS_MSG_SERVER_MSG, PS_MSG_DICT_SERIALIZE_FAIL,
- PS_MSG_RW_STAT, PS_MSG_DICT_GET_FAILED, PS_MSG_LOGIN_ERROR,
- PS_MSG_REMOUNT_CLIENT_REQD, PS_MSG_DEFAULTING_FILE,
- PS_MSG_VOL_FILE_OPEN_FAILED, PS_MSG_STAT_ERROR,
- PS_MSG_SSL_NAME_SET_FAILED, PS_MSG_ASPRINTF_FAILED,
- PS_MSG_CLIENT_VERSION_NOT_SET, PS_MSG_CLIENT_ACCEPTED,
- PS_MSG_CLIENT_LK_VERSION_ERROR, PS_MSG_GRACE_TIMER_EXPD,
- PS_MSG_SERIALIZE_REPLY_FAILED, PS_MSG_AUTH_IP_ERROR,
- PS_MSG_SKIP_FORMAT_CHK, PS_MSG_INTERNET_ADDR_ERROR,
- PS_MSG_CLIENT_DISCONNECTING, PS_MSG_GRACE_TIMER_START,
- PS_MSG_STATEDUMP_PATH_ERROR, PS_MSG_GRP_CACHE_ERROR,
- PS_MSG_RPC_CONF_ERROR, PS_MSG_TRANSPORT_ERROR, PS_MSG_SUBVOL_NULL,
- PS_MSG_PARENT_VOL_ERROR, PS_MSG_RPCSVC_CREATE_FAILED,
- PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, PS_MSG_RPCSVC_NOTIFY,
- PS_MSG_PGM_REG_FAILED, PS_MSG_ULIMIT_SET_FAILED, PS_MSG_STATFS,
- PS_MSG_LOOKUP_INFO, PS_MSG_LK_INFO, PS_MSG_LOCK_ERROR,
- PS_MSG_INODELK_INFO, PS_MSG_ENTRYLK_INFO, PS_MSG_ACCESS_INFO,
- PS_MSG_DIR_INFO, PS_MSG_MKNOD_INFO, PS_MSG_REMOVEXATTR_INFO,
- PS_MSG_GETXATTR_INFO, PS_MSG_SETXATTR_INFO, PS_MSG_RENAME_INFO,
- PS_MSG_LINK_INFO, PS_MSG_TRUNCATE_INFO, PS_MSG_FSTAT_INFO,
- PS_MSG_FLUSH_INFO, PS_MSG_SYNC_INFO, PS_MSG_WRITE_INFO,
- PS_MSG_READ_INFO, PS_MSG_CHKSUM_INFO, PS_MSG_OPEN_INFO,
- PS_MSG_CREATE_INFO, PS_MSG_SETATTR_INFO, PS_MSG_XATTROP_INFO,
- PS_MSG_ALLOC_INFO, PS_MSG_DISCARD_INFO, PS_MSG_ZEROFILL_INFO,
- PS_MSG_FD_CREATE_FAILED, PS_MSG_WRONG_STATE, PS_MSG_CONF_DIR_INVALID,
- PS_MSG_MOUNT_PT_FAIL, PS_MSG_STAT_INFO, PS_MSG_FILE_OP_FAILED,
- PS_MSG_GRACE_TIMER_CANCELLED, PS_MSG_ENCODE_MSG_FAILED,
- PS_MSG_REPLY_SUBMIT_FAILED, PS_MSG_RPC_NOTIFY_ERROR,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED, PS_MSG_SERVER_IPC_INFO,
- PS_MSG_SEEK_INFO, PS_MSG_COMPOUND_INFO,
- PS_MSG_CLIENT_OPVERSION_GET_FAILED, PS_MSG_CHILD_STATUS_FAILED,
- PS_MSG_PUT_INFO);
+GLFS_MSGID(
+ PS, PS_MSG_AUTHENTICATE_ERROR, PS_MSG_VOL_VALIDATE_FAILED,
+ PS_MSG_AUTH_INIT_FAILED, PS_MSG_REMOTE_CLIENT_REFUSED,
+ PS_MSG_GFID_RESOLVE_FAILED, PS_MSG_ANONYMOUS_FD_CREATE_FAILED,
+ PS_MSG_NO_MEMORY, PS_MSG_FD_NOT_FOUND, PS_MSG_INVALID_ENTRY,
+ PS_MSG_GET_UID_FAILED, PS_MSG_UID_NOT_FOUND, PS_MSG_MAPPING_ERROR,
+ PS_MSG_FD_CLEANUP, PS_MSG_SERVER_CTX_GET_FAILED, PS_MSG_FDENTRY_NULL,
+ PS_MSG_DIR_NOT_FOUND, PS_MSG_SERVER_MSG, PS_MSG_DICT_SERIALIZE_FAIL,
+ PS_MSG_RW_STAT, PS_MSG_DICT_GET_FAILED, PS_MSG_LOGIN_ERROR,
+ PS_MSG_REMOUNT_CLIENT_REQD, PS_MSG_DEFAULTING_FILE,
+ PS_MSG_VOL_FILE_OPEN_FAILED, PS_MSG_STAT_ERROR, PS_MSG_SSL_NAME_SET_FAILED,
+ PS_MSG_ASPRINTF_FAILED, PS_MSG_CLIENT_VERSION_NOT_SET,
+ PS_MSG_CLIENT_ACCEPTED, PS_MSG_CLIENT_LK_VERSION_ERROR,
+ PS_MSG_GRACE_TIMER_EXPD, PS_MSG_SERIALIZE_REPLY_FAILED,
+ PS_MSG_AUTH_IP_ERROR, PS_MSG_SKIP_FORMAT_CHK, PS_MSG_INTERNET_ADDR_ERROR,
+ PS_MSG_CLIENT_DISCONNECTING, PS_MSG_GRACE_TIMER_START,
+ PS_MSG_STATEDUMP_PATH_ERROR, PS_MSG_GRP_CACHE_ERROR, PS_MSG_RPC_CONF_ERROR,
+ PS_MSG_TRANSPORT_ERROR, PS_MSG_SUBVOL_NULL, PS_MSG_PARENT_VOL_ERROR,
+ PS_MSG_RPCSVC_CREATE_FAILED, PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
+ PS_MSG_RPCSVC_NOTIFY, PS_MSG_PGM_REG_FAILED, PS_MSG_ULIMIT_SET_FAILED,
+ PS_MSG_STATFS, PS_MSG_LOOKUP_INFO, PS_MSG_LK_INFO, PS_MSG_LOCK_ERROR,
+ PS_MSG_INODELK_INFO, PS_MSG_ENTRYLK_INFO, PS_MSG_ACCESS_INFO,
+ PS_MSG_DIR_INFO, PS_MSG_MKNOD_INFO, PS_MSG_REMOVEXATTR_INFO,
+ PS_MSG_GETXATTR_INFO, PS_MSG_SETXATTR_INFO, PS_MSG_RENAME_INFO,
+ PS_MSG_LINK_INFO, PS_MSG_TRUNCATE_INFO, PS_MSG_FSTAT_INFO,
+ PS_MSG_FLUSH_INFO, PS_MSG_SYNC_INFO, PS_MSG_WRITE_INFO, PS_MSG_READ_INFO,
+ PS_MSG_CHKSUM_INFO, PS_MSG_OPEN_INFO, PS_MSG_CREATE_INFO,
+ PS_MSG_SETATTR_INFO, PS_MSG_XATTROP_INFO, PS_MSG_ALLOC_INFO,
+ PS_MSG_DISCARD_INFO, PS_MSG_ZEROFILL_INFO, PS_MSG_FD_CREATE_FAILED,
+ PS_MSG_WRONG_STATE, PS_MSG_CONF_DIR_INVALID, PS_MSG_MOUNT_PT_FAIL,
+ PS_MSG_STAT_INFO, PS_MSG_FILE_OP_FAILED, PS_MSG_GRACE_TIMER_CANCELLED,
+ PS_MSG_ENCODE_MSG_FAILED, PS_MSG_REPLY_SUBMIT_FAILED,
+ PS_MSG_RPC_NOTIFY_ERROR, PS_MSG_SERVER_EVENT_UPCALL_FAILED,
+ PS_MSG_SERVER_IPC_INFO, PS_MSG_SEEK_INFO, PS_MSG_COMPOUND_INFO,
+ PS_MSG_CLIENT_OPVERSION_GET_FAILED, PS_MSG_CHILD_STATUS_FAILED,
+ PS_MSG_PUT_INFO, PS_MSG_UNAUTHORIZED_CLIENT, PS_MSG_RECONFIGURE_FAILED,
+ PS_MSG_SET_STATEDUMP_PATH_ERROR, PS_MSG_INIT_GRP_CACHE_ERROR,
+ PS_MSG_RPC_CONFIGURE_FAILED, PS_MSG_TRANSPORT_TYPE_NOT_SET,
+ PS_MSG_GET_TOTAL_AVAIL_TRANSPORT_FAILED, PS_MSG_INVLAID_UPCALL_EVENT,
+ PS_MSG_SERVER_CHILD_EVENT_FAILED, PS_MSG_SETACTIVELK_INFO,
+ PS_MSG_GETACTIVELK_INFO, PS_MSG_WRONG_VALUE, PS_MSG_PASSWORD_NOT_FOUND,
+ PS_MSG_REMOTE_SUBVOL_NOT_SPECIFIED, PS_MSG_NO_MEM);
+#define PS_MSG_SERIALIZE_REPLY_FAILED_STR "Failed to serialize reply"
+#define PS_MSG_AUTH_IP_ERROR_STR "assuming 'auth.ip' to be 'auth.addr'"
+#define PS_MSG_SKIP_FORMAT_CHK_STR "skip format check for non-addr auth option"
+#define PS_MSG_INTERNET_ADDR_ERROR_STR \
+ "internet address does not confirm to standards"
+#define PS_MSG_AUTHENTICATE_ERROR_STR \
+ "volume defined as subvolume, but no authentication defined for the same"
+#define PS_MSG_CLIENT_DISCONNECTING_STR "disconnecting connection"
+#define PS_MSG_DICT_GET_FAILED_STR "failed to get"
+#define PS_MSG_NO_MEMORY_STR "Memory accounting init failed"
+#define PS_MSG_INVALID_ENTRY_STR \
+ "'trace' takes on only boolean values. Neglecting option"
+#define PS_MSG_STATEDUMP_PATH_ERROR_STR \
+ "Error while reconfiguring statedump path"
+#define PS_MSG_GRP_CACHE_ERROR_STR "Failed to reconfigure group cache."
+#define PS_MSG_RPC_CONF_ERROR_STR "No rpc_conf !!!!"
+#define PS_MSG_CLIENT_ACCEPTED_STR \
+ "authorized client, hence we continue with this connection"
+#define PS_MSG_UNAUTHORIZED_CLIENT_STR \
+ "unauthorized client, hence terminating the connection"
+#define PS_MSG_RECONFIGURE_FAILED_STR \
+ "Failed to reconfigure outstanding-rpc-limit"
+#define PS_MSG_TRANSPORT_ERROR_STR "Reconfigure not found for transport"
+#define PS_MSG_SUBVOL_NULL_STR "protocol/server should have subvolume"
+#define PS_MSG_PARENT_VOL_ERROR_STR \
+ "protocol/server should not have parent volumes"
+#define PS_MSG_SET_STATEDUMP_PATH_ERROR_STR "Error setting statedump path"
+#define PS_MSG_INIT_GRP_CACHE_ERROR_STR "Failed to initialize group cache."
+#define PS_MSG_RPCSVC_CREATE_FAILED_STR "creation of rpcsvc failed"
+#define PS_MSG_RPC_CONFIGURE_FAILED_STR \
+ "Failed to configure outstanding-rpc-limit"
+#define PS_MSG_TRANSPORT_TYPE_NOT_SET_STR "option transport-type not set"
+#define PS_MSG_GET_TOTAL_AVAIL_TRANSPORT_FAILED_STR \
+ "failed to get total number of available tranpsorts"
+#define PS_MSG_RPCSVC_LISTENER_CREATE_FAILED_STR "creation of listener failed"
+#define PS_MSG_RPCSVC_NOTIFY_STR "registration of notify with rpcsvc failed"
+#define PS_MSG_PGM_REG_FAILED_STR "registration of program failed"
+#define PS_MSG_ULIMIT_SET_FAILED_STR "WARNING: Failed to set 'ulimit -n 1M'"
+#define PS_MSG_FD_NOT_FOUND_STR "Failed to set max open fd to 64k"
+#define PS_MSG_VOL_FILE_OPEN_FAILED_STR \
+ "volfile-id argument not given. This is mandatory argument, defaulting " \
+ "to 'gluster'"
+#define PS_MSG_INVLAID_UPCALL_EVENT_STR "Received invalid upcall event"
+#define PS_MSG_CHILD_STATUS_FAILED_STR "No xlator is found in child status list"
+#define PS_MSG_SERVER_EVENT_UPCALL_FAILED_STR \
+ "server_process_event_upcall failed"
+#define PS_MSG_SERVER_CHILD_EVENT_FAILED_STR "server_process_child_event failed"
+#define PS_MSG_STATFS_STR "STATFS"
+#define PS_MSG_LOOKUP_INFO_STR "LOOKUP info"
+#define PS_MSG_LK_INFO_STR "LEASE info"
+#define PS_MSG_INODELK_INFO_STR "INODELK info"
+#define PS_MSG_DIR_INFO_STR "MKDIR info"
+#define PS_MSG_MKNOD_INFO_STR "MKNOD info"
+#define PS_MSG_REMOVEXATTR_INFO_STR "REMOVEXATTR info"
+#define PS_MSG_GETXATTR_INFO_STR "GETXATTR info"
+#define PS_MSG_SETXATTR_INFO_STR "SETXATTR info"
+#define PS_MSG_RENAME_INFO_STR "RENAME inf"
+#define PS_MSG_LINK_INFO_STR "LINK info"
+#define PS_MSG_TRUNCATE_INFO_STR "TRUNCATE info"
+#define PS_MSG_STAT_INFO_STR "STAT info"
+#define PS_MSG_FLUSH_INFO_STR "FLUSH info"
+#define PS_MSG_SYNC_INFO_STR "SYNC info"
+#define PS_MSG_WRITE_INFO_STR "WRITE info"
+#define PS_MSG_READ_INFO_STR "READ info"
+#define PS_MSG_CHKSUM_INFO_STR "CHKSUM info"
+#define PS_MSG_OPEN_INFO_STR "OPEN info"
+#define PS_MSG_XATTROP_INFO_STR "XATTROP info"
+#define PS_MSG_ALLOC_INFO_STR "ALLOC info"
+#define PS_MSG_DISCARD_INFO_STR "DISCARD info"
+#define PS_MSG_ZEROFILL_INFO_STR "ZEROFILL info"
+#define PS_MSG_SERVER_IPC_INFO_STR "IPC info"
+#define PS_MSG_SEEK_INFO_STR "SEEK info"
+#define PS_MSG_SETACTIVELK_INFO_STR "SETACTIVELK info"
+#define PS_MSG_CREATE_INFO_STR "CREATE info"
+#define PS_MSG_PUT_INFO_STR "PUT info"
+#define PS_MSG_FD_CREATE_FAILED_STR "could not create the fd"
+#define PS_MSG_GETACTIVELK_INFO_STR "GETACTIVELK info"
+#define PS_MSG_ENTRYLK_INFO_STR "ENTRYLK info"
+#define PS_MSG_ACCESS_INFO_STR "ACCESS info"
+#define PS_MSG_SETATTR_INFO_STR "SETATTR info"
+#define PS_MSG_SERVER_CTX_GET_FAILED_STR "server_ctx_get() failed"
+#define PS_MSG_LOCK_ERROR_STR "Unknown lock type"
+#define PS_MSG_GET_UID_FAILED_STR "getpwuid_r failed"
+#define PS_MSG_UID_NOT_FOUND_STR "getpwuid_r found nothing"
+#define PS_MSG_MAPPING_ERROR_STR "could not map to group list"
+#define PS_MSG_FD_CLEANUP_STR "fd cleanup"
+#define PS_MSG_FDENTRY_NULL_STR "no fdentry to clean"
+#define PS_MSG_WRONG_VALUE_STR \
+ "wrong value for 'verify-volfile-checksum', Neglecting option"
+#define PS_MSG_DIR_NOT_FOUND_STR "Directory doesnot exist"
+#define PS_MSG_CONF_DIR_INVALID_STR "invalid conf_dir"
+#define PS_MSG_SERVER_MSG_STR "server msg"
+#define PS_MSG_DICT_SERIALIZE_FAIL_STR "failed to serialize reply dict"
+#define PS_MSG_MOUNT_PT_FAIL_STR "mount point fail"
+#define PS_MSG_RW_STAT_STR "stat"
+#define PS_MSG_PASSWORD_NOT_FOUND_STR "password not found, returning DONT-CARE"
+#define PS_MSG_REMOTE_SUBVOL_NOT_SPECIFIED_STR "remote-subvolume not specified"
+#define PS_MSG_LOGIN_ERROR_STR "wrong password for user"
+#define PS_MSG_NO_MEM_STR "No memory"
#endif /* !_PS_MESSAGES_H__ */
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 57aa474b8f5..ec768acba44 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -308,7 +308,6 @@ resolve_entry_simple(call_frame_t *frame)
/* expected @parent was found from the inode cache */
gf_uuid_copy(state->loc_now->pargfid, resolve->pargfid);
state->loc_now->parent = inode_ref(parent);
-
if (strchr(resolve->bname, '/')) {
/* basename should be a string (without '/') in a directory,
it can't span multiple levels. This can also lead to
@@ -546,14 +545,39 @@ server_resolve_fd(call_frame_t *frame)
return 0;
}
- state->fd = gf_fd_fdptr_get(serv_ctx->fdtable, fd_no);
-
+ /*
+ * With copy_file_range, there will be 2 fds to resolve.
+ * This same function is called to resolve both the source
+ * fd and the destination fd. As of now, this function does
+ * not have any mechanism to distinguish between the 2 fds
+ * being resolved except for checking the value of state->fd.
+ * The assumption is that, if source fd the one which is
+ * being resolved here, then state->fd would be NULL. If it
+ * is not NULL, then it is the destination fd which is being
+ * resolved.
+ * This method (provided the above assumption is true) is
+ * to achieve the ability to distinguish between 2 fds with
+ * minimum changes being done to this function. If this way
+ * is not correct, then more changes might be needed.
+ */
if (!state->fd) {
- gf_msg("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND,
- "fd not "
- "found in context");
- resolve->op_ret = -1;
- resolve->op_errno = EBADF;
+ state->fd = gf_fd_fdptr_get(serv_ctx->fdtable, fd_no);
+ if (!state->fd) {
+ gf_msg("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND,
+ "fd not "
+ "found in context");
+ resolve->op_ret = -1;
+ resolve->op_errno = EBADF;
+ }
+ } else {
+ state->fd_out = gf_fd_fdptr_get(serv_ctx->fdtable, fd_no);
+ if (!state->fd_out) {
+ gf_msg("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND,
+ "fd not "
+ "found in context");
+ resolve->op_ret = -1;
+ resolve->op_errno = EBADF;
+ }
}
server_resolve_all(frame);
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index c621743fa06..4d8b7be5a34 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -15,13 +15,12 @@
#include "rpc-common-xdr.h"
#include "glusterfs3-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "server-messages.h"
-#include "defaults.h"
-#include "default-args.h"
+#include <glusterfs/defaults.h>
+#include <glusterfs/default-args.h>
#include "server-common.h"
-#include "xlator.h"
-#include "compound-fop-utils.h"
+#include <glusterfs/xlator.h>
#include "xdr-nfs3.h"
@@ -2261,78 +2260,6 @@ out:
return 0;
}
-int
-server_compound_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, void *data, dict_t *xdata)
-{
- struct gfs3_compound_rsp rsp = {
- 0,
- };
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- compound_args_cbk_t *args_cbk = data;
- int i = 0;
-
- req = frame->local;
- state = CALL_STATE(frame);
-
- GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&rsp.xdata.xdata_val),
- rsp.xdata.xdata_len, op_errno, out);
-
- if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_COMPOUND, op_errno), op_errno,
- PS_MSG_COMPOUND_INFO,
- "%" PRId64 ": COMPOUND%" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
- }
-
- /* TODO: I assume a single 10MB payload is large, if not, we need to
- agree to valid payload */
- if ((args_cbk->fop_length <= 0) ||
- ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
- op_ret = -1;
- op_errno = EINVAL;
- goto out;
- }
-
- rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC(
- args_cbk->fop_length, sizeof(compound_rsp),
- gf_server_mt_compound_rsp_t);
-
- if (!rsp.compound_rsp_array.compound_rsp_array_val) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto out;
- }
- rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
-
- for (i = 0; i < args_cbk->fop_length; i++) {
- op_ret = server_populate_compound_response(this, &rsp, frame, args_cbk,
- i);
-
- if (op_ret) {
- op_errno = op_ret;
- op_ret = -1;
- goto out;
- }
- }
-out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error(op_errno);
-
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_compound_rsp);
-
- server_compound_rsp_cleanup(&rsp, args_cbk);
- GF_FREE(rsp.xdata.xdata_val);
-
- return 0;
-}
-
/* Resume function section */
int
@@ -3453,60 +3380,6 @@ err:
return 0;
}
-int
-server_compound_resume(call_frame_t *frame, xlator_t *bound_xl)
-{
- server_state_t *state = NULL;
- gfs3_compound_req *req = NULL;
- compound_args_t *args = NULL;
- int i = 0;
- int ret = -1;
- int length = 0;
- int op_errno = ENOMEM;
- compound_req *c_req = NULL;
-
- state = CALL_STATE(frame);
-
- if (state->resolve.op_ret != 0) {
- ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
-
- req = &state->req;
-
- length = req->compound_req_array.compound_req_array_len;
- state->args = compound_fop_alloc(length, req->compound_fop_enum,
- state->xdata);
- args = state->args;
-
- if (!args)
- goto err;
-
- for (i = 0; i < length; i++) {
- c_req = &req->compound_req_array.compound_req_array_val[i];
- args->enum_list[i] = c_req->fop_enum;
-
- ret = server_populate_compound_request(req, frame, &args->req_list[i],
- i);
-
- if (ret) {
- op_errno = ret;
- ret = -1;
- goto err;
- }
- }
-
- STACK_WIND(frame, server_compound_cbk, bound_xl, bound_xl->fops->compound,
- args, state->xdata);
-
- return 0;
-err:
- server_compound_cbk(frame, NULL, frame->this, ret, op_errno, NULL, NULL);
-
- return ret;
-}
-
/* Fop section */
int
rpc_receive_common(rpcsvc_request_t *req, call_frame_t **fr,
@@ -4180,7 +4053,7 @@ server3_3_writev_vecsizer(int state, ssize_t *readsize, char *base_addr,
/* need to round off to proper roof (%4), as XDR packing pads
the end of opaque object with '0' */
- size = roof(write_req.xdata.xdata_len, 4);
+ size = gf_roof(write_req.xdata.xdata_len, 4);
*readsize = size;
@@ -4250,6 +4123,7 @@ server3_3_release(rpcsvc_request_t *req)
ret = 0;
out:
+ free(args.xdata.xdata_val);
return ret;
}
@@ -4297,6 +4171,7 @@ server3_3_releasedir(rpcsvc_request_t *req)
ret = 0;
out:
+ free(args.xdata.xdata_val);
return ret;
}
@@ -6087,166 +5962,116 @@ out:
int
server3_3_compound(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- call_frame_t *frame = NULL;
- gfs3_compound_req args = {
- 0,
- };
- ssize_t len = 0;
- int length = 0;
- int i = 0;
int ret = -1;
- int op_errno = 0;
-
- if (!req)
- return ret;
-
- ret = rpc_receive_common(req, &frame, &state, &len, &args,
- xdr_gfs3_compound_req, GF_FOP_COMPOUND);
- if (ret != 0) {
- goto out;
- }
-
- state->req = args;
- state->iobref = iobref_ref(req->iobref);
-
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
-
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++] = req->msg[i];
- }
-
- state->size = iov_length(state->payload_vector, state->payload_count);
-
- ret = server_get_compound_resolve(state, &args);
-
- if (ret) {
- SERVER_REQ_SET_ERROR(req, ret);
- goto out;
- }
-
- GF_PROTOCOL_DICT_UNSERIALIZE(frame->root->client->bound_xl, state->xdata,
- args.xdata.xdata_val, args.xdata.xdata_len,
- ret, op_errno, out);
-
- ret = 0;
- resolve_and_resume(frame, server_compound_resume);
-out:
- free(args.xdata.xdata_val);
-
- length = args.compound_req_array.compound_req_array_len;
- server_compound_req_cleanup(&args, length);
- free(args.compound_req_array.compound_req_array_val);
-
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
+ SERVER_REQ_SET_ERROR(req, ret);
return ret;
}
-rpcsvc_actor_t glusterfs3_3_fop_actors[GLUSTER_FOP_PROCCNT] = {
- [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0, DRC_NA},
- [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server3_3_stat, NULL, 0, DRC_NA},
- [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server3_3_readlink,
- NULL, 0, DRC_NA},
- [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server3_3_mknod, NULL, 0,
- DRC_NA},
- [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server3_3_mkdir, NULL, 0,
- DRC_NA},
- [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server3_3_unlink, NULL, 0,
- DRC_NA},
- [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server3_3_rmdir, NULL, 0,
- DRC_NA},
- [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server3_3_symlink, NULL, 0,
- DRC_NA},
- [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server3_3_rename, NULL, 0,
- DRC_NA},
- [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server3_3_link, NULL, 0, DRC_NA},
- [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server3_3_truncate,
- NULL, 0, DRC_NA},
- [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server3_3_open, NULL, 0, DRC_NA},
- [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server3_3_readv, NULL, 0, DRC_NA},
- [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server3_3_writev,
- server3_3_writev_vecsizer, 0, DRC_NA},
- [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server3_3_statfs, NULL, 0,
- DRC_NA},
- [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server3_3_flush, NULL, 0,
- DRC_NA},
- [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server3_3_fsync, NULL, 0,
- DRC_NA},
- [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server3_3_setxattr,
- NULL, 0, DRC_NA},
- [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server3_3_getxattr,
- NULL, 0, DRC_NA},
- [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR,
- server3_3_removexattr, NULL, 0, DRC_NA},
- [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server3_3_opendir, NULL, 0,
- DRC_NA},
- [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server3_3_fsyncdir,
- NULL, 0, DRC_NA},
- [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server3_3_access, NULL, 0,
- DRC_NA},
- [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server3_3_create, NULL, 0,
- DRC_NA},
- [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server3_3_ftruncate,
- NULL, 0, DRC_NA},
- [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server3_3_fstat, NULL, 0,
- DRC_NA},
- [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server3_3_lk, NULL, 0, DRC_NA},
- [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server3_3_lookup, NULL, 0,
- DRC_NA},
- [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server3_3_readdir, NULL, 0,
- DRC_NA},
- [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server3_3_inodelk, NULL, 0,
- DRC_NA},
- [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server3_3_finodelk,
- NULL, 0, DRC_NA},
- [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server3_3_entrylk, NULL, 0,
- DRC_NA},
- [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server3_3_fentrylk,
- NULL, 0, DRC_NA},
- [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server3_3_xattrop, NULL, 0,
- DRC_NA},
- [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server3_3_fxattrop,
- NULL, 0, DRC_NA},
- [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server3_3_fgetxattr,
- NULL, 0, DRC_NA},
- [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server3_3_fsetxattr,
- NULL, 0, DRC_NA},
- [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server3_3_rchecksum,
- NULL, 0, DRC_NA},
- [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server3_3_setattr, NULL, 0,
- DRC_NA},
- [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server3_3_fsetattr,
- NULL, 0, DRC_NA},
- [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server3_3_readdirp,
- NULL, 0, DRC_NA},
- [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server3_3_release, NULL, 0,
- DRC_NA},
- [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR,
- server3_3_releasedir, NULL, 0, DRC_NA},
- [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR,
- server3_3_fremovexattr, NULL, 0, DRC_NA},
- [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server3_3_fallocate,
- NULL, 0, DRC_NA},
- [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server3_3_discard, NULL, 0,
- DRC_NA},
- [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server3_3_zerofill,
- NULL, 0, DRC_NA},
- [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server3_3_ipc, NULL, 0, DRC_NA},
- [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server3_3_seek, NULL, 0, DRC_NA},
- [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server3_3_lease, NULL, 0,
- DRC_NA},
- [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK,
- server3_3_getactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK,
- server3_3_setactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server3_3_compound,
- NULL, 0, DRC_NA},
+static rpcsvc_actor_t glusterfs3_3_fop_actors[GLUSTER_FOP_PROCCNT] = {
+ [GFS3_OP_NULL] = {"NULL", server_null, NULL, GFS3_OP_NULL, DRC_NA, 0},
+ [GFS3_OP_STAT] = {"STAT", server3_3_stat, NULL, GFS3_OP_STAT, DRC_NA, 0},
+ [GFS3_OP_READLINK] = {"READLINK", server3_3_readlink, NULL,
+ GFS3_OP_READLINK, DRC_NA, 0},
+ [GFS3_OP_MKNOD] = {"MKNOD", server3_3_mknod, NULL, GFS3_OP_MKNOD, DRC_NA,
+ 0},
+ [GFS3_OP_MKDIR] = {"MKDIR", server3_3_mkdir, NULL, GFS3_OP_MKDIR, DRC_NA,
+ 0},
+ [GFS3_OP_UNLINK] = {"UNLINK", server3_3_unlink, NULL, GFS3_OP_UNLINK,
+ DRC_NA, 0},
+ [GFS3_OP_RMDIR] = {"RMDIR", server3_3_rmdir, NULL, GFS3_OP_RMDIR, DRC_NA,
+ 0},
+ [GFS3_OP_SYMLINK] = {"SYMLINK", server3_3_symlink, NULL, GFS3_OP_SYMLINK,
+ DRC_NA, 0},
+ [GFS3_OP_RENAME] = {"RENAME", server3_3_rename, NULL, GFS3_OP_RENAME,
+ DRC_NA, 0},
+ [GFS3_OP_LINK] = {"LINK", server3_3_link, NULL, GFS3_OP_LINK, DRC_NA, 0},
+ [GFS3_OP_TRUNCATE] = {"TRUNCATE", server3_3_truncate, NULL,
+ GFS3_OP_TRUNCATE, DRC_NA, 0},
+ [GFS3_OP_OPEN] = {"OPEN", server3_3_open, NULL, GFS3_OP_OPEN, DRC_NA, 0},
+ [GFS3_OP_READ] = {"READ", server3_3_readv, NULL, GFS3_OP_READ, DRC_NA, 0},
+ [GFS3_OP_WRITE] = {"WRITE", server3_3_writev, server3_3_writev_vecsizer,
+ GFS3_OP_WRITE, DRC_NA, 0},
+ [GFS3_OP_STATFS] = {"STATFS", server3_3_statfs, NULL, GFS3_OP_STATFS,
+ DRC_NA, 0},
+ [GFS3_OP_FLUSH] = {"FLUSH", server3_3_flush, NULL, GFS3_OP_FLUSH, DRC_NA,
+ 0},
+ [GFS3_OP_FSYNC] = {"FSYNC", server3_3_fsync, NULL, GFS3_OP_FSYNC, DRC_NA,
+ 0},
+ [GFS3_OP_SETXATTR] = {"SETXATTR", server3_3_setxattr, NULL,
+ GFS3_OP_SETXATTR, DRC_NA, 0},
+ [GFS3_OP_GETXATTR] = {"GETXATTR", server3_3_getxattr, NULL,
+ GFS3_OP_GETXATTR, DRC_NA, 0},
+ [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", server3_3_removexattr, NULL,
+ GFS3_OP_REMOVEXATTR, DRC_NA, 0},
+ [GFS3_OP_OPENDIR] = {"OPENDIR", server3_3_opendir, NULL, GFS3_OP_OPENDIR,
+ DRC_NA, 0},
+ [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", server3_3_fsyncdir, NULL,
+ GFS3_OP_FSYNCDIR, DRC_NA, 0},
+ [GFS3_OP_ACCESS] = {"ACCESS", server3_3_access, NULL, DRC_NA, 0},
+ [GFS3_OP_CREATE] = {"CREATE", server3_3_create, NULL, GFS3_OP_ACCESS,
+ DRC_NA, 0},
+ [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", server3_3_ftruncate, NULL,
+ GFS3_OP_FTRUNCATE, DRC_NA, 0},
+ [GFS3_OP_FSTAT] = {"FSTAT", server3_3_fstat, NULL, GFS3_OP_FSTAT, DRC_NA,
+ 0},
+ [GFS3_OP_LK] = {"LK", server3_3_lk, NULL, GFS3_OP_LK, DRC_NA, 0},
+ [GFS3_OP_LOOKUP] = {"LOOKUP", server3_3_lookup, NULL, GFS3_OP_LOOKUP,
+ DRC_NA, 0},
+ [GFS3_OP_READDIR] = {"READDIR", server3_3_readdir, NULL, GFS3_OP_READDIR,
+ DRC_NA, 0},
+ [GFS3_OP_INODELK] = {"INODELK", server3_3_inodelk, NULL, GFS3_OP_INODELK,
+ DRC_NA, 0},
+ [GFS3_OP_FINODELK] = {"FINODELK", server3_3_finodelk, NULL,
+ GFS3_OP_FINODELK, DRC_NA, 0},
+ [GFS3_OP_ENTRYLK] = {"ENTRYLK", server3_3_entrylk, NULL, GFS3_OP_ENTRYLK,
+ DRC_NA, 0},
+ [GFS3_OP_FENTRYLK] = {"FENTRYLK", server3_3_fentrylk, NULL,
+ GFS3_OP_FENTRYLK, DRC_NA, 0},
+ [GFS3_OP_XATTROP] = {"XATTROP", server3_3_xattrop, NULL, GFS3_OP_XATTROP,
+ DRC_NA, 0},
+ [GFS3_OP_FXATTROP] = {"FXATTROP", server3_3_fxattrop, NULL,
+ GFS3_OP_FXATTROP, DRC_NA, 0},
+ [GFS3_OP_FGETXATTR] = {"FGETXATTR", server3_3_fgetxattr, NULL,
+ GFS3_OP_FGETXATTR, DRC_NA, 0},
+ [GFS3_OP_FSETXATTR] = {"FSETXATTR", server3_3_fsetxattr, NULL,
+ GFS3_OP_FSETXATTR, DRC_NA, 0},
+ [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", server3_3_rchecksum, NULL,
+ GFS3_OP_RCHECKSUM, DRC_NA, 0},
+ [GFS3_OP_SETATTR] = {"SETATTR", server3_3_setattr, NULL, GFS3_OP_SETATTR,
+ DRC_NA, 0},
+ [GFS3_OP_FSETATTR] = {"FSETATTR", server3_3_fsetattr, NULL,
+ GFS3_OP_FSETATTR, DRC_NA, 0},
+ [GFS3_OP_READDIRP] = {"READDIRP", server3_3_readdirp, NULL,
+ GFS3_OP_READDIRP, DRC_NA, 0},
+ [GFS3_OP_RELEASE] = {"RELEASE", server3_3_release, NULL, GFS3_OP_RELEASE,
+ DRC_NA, 0},
+ [GFS3_OP_RELEASEDIR] =
+ {
+ "RELEASEDIR",
+ server3_3_releasedir,
+ NULL,
+ GFS3_OP_RELEASEDIR,
+ DRC_NA,
+ 0,
+ },
+ [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", server3_3_fremovexattr, NULL,
+ GFS3_OP_FREMOVEXATTR, DRC_NA, 0},
+ [GFS3_OP_FALLOCATE] = {"FALLOCATE", server3_3_fallocate, NULL,
+ GFS3_OP_FALLOCATE, DRC_NA, 0},
+ [GFS3_OP_DISCARD] = {"DISCARD", server3_3_discard, NULL, GFS3_OP_DISCARD,
+ DRC_NA, 0},
+ [GFS3_OP_ZEROFILL] = {"ZEROFILL", server3_3_zerofill, NULL,
+ GFS3_OP_ZEROFILL, DRC_NA, 0},
+ [GFS3_OP_IPC] = {"IPC", server3_3_ipc, NULL, GFS3_OP_IPC, DRC_NA, 0},
+ [GFS3_OP_SEEK] = {"SEEK", server3_3_seek, NULL, GFS3_OP_SEEK, DRC_NA, 0},
+ [GFS3_OP_LEASE] = {"LEASE", server3_3_lease, NULL, GFS3_OP_LEASE, DRC_NA,
+ 0},
+ [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", server3_3_getactivelk, NULL,
+ GFS3_OP_GETACTIVELK, DRC_NA, 0},
+ [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", server3_3_setactivelk, NULL,
+ GFS3_OP_SETACTIVELK, DRC_NA, 0},
+ [GFS3_OP_COMPOUND] = {"COMPOUND", server3_3_compound, NULL,
+ GFS3_OP_COMPOUND, DRC_NA, 0},
};
struct rpcsvc_program glusterfs3_3_fop_prog = {
diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c
index 21df9021c66..c267f8f7832 100644
--- a/xlators/protocol/server/src/server-rpc-fops_v2.c
+++ b/xlators/protocol/server/src/server-rpc-fops_v2.c
@@ -15,13 +15,12 @@
#include "rpc-common-xdr.h"
#include "glusterfs4-xdr.h"
#include "glusterfs3.h"
-#include "compat-errno.h"
+#include <glusterfs/compat-errno.h>
#include "server-messages.h"
-#include "defaults.h"
-#include "default-args.h"
+#include <glusterfs/defaults.h>
+#include <glusterfs/default-args.h>
#include "server-common.h"
-#include "xlator.h"
-#include "compound-fop-utils.h"
+#include <glusterfs/xlator.h>
#include "xdr-nfs3.h"
@@ -57,10 +56,10 @@ server4_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
dict_to_xdr(xdata, &rsp.xdata);
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
- "%" PRId64 ": STATFS, client: %s, error-xlator: %s",
- frame->root->unique, STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_WARNING, op_errno, PS_MSG_STATFS,
+ "frame=%" PRId64, frame->root->unique, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -147,25 +146,20 @@ out:
if (op_ret) {
if (state->resolve.bname) {
- gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
- PS_MSG_LOOKUP_INFO,
- "%" PRId64
- ": LOOKUP %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno),
+ op_errno, PS_MSG_LOOKUP_INFO, "frame=%" PRId64,
+ frame->root->unique, "path=%s", state->loc.path,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.pargfid),
+ "bname=%s", state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
} else {
- gf_msg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno), op_errno,
- PS_MSG_LOOKUP_INFO,
- "%" PRId64
- ": LOOKUP %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid),
- STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_LOOKUP, op_errno),
+ op_errno, PS_MSG_LOOKUP_INFO, "frame=%" PRId64,
+ frame->root->unique, "path=%s", state->loc.path,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
}
}
@@ -193,12 +187,12 @@ server4_lease_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_LEASE, op_errno), op_errno,
- PS_MSG_LK_INFO,
- "%" PRId64 ": LEASE %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_LEASE, op_errno), op_errno,
+ PS_MSG_LK_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
}
server4_post_lease(&rsp, lease);
@@ -229,14 +223,12 @@ server4_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_LK, op_errno), op_errno,
- PS_MSG_LK_INFO,
- "%" PRId64 ": LK %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_LK, op_errno), op_errno,
+ PS_MSG_LK_INFO, "frame=%" PRId64, frame->root->unique,
+ "fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -269,14 +261,12 @@ server4_inodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_INODELK, op_errno), op_errno,
- PS_MSG_INODELK_INFO,
- "%" PRId64
- ": INODELK %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_INODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -308,14 +298,12 @@ server4_finodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_FINODELK, op_errno), op_errno,
- PS_MSG_INODELK_INFO,
- "%" PRId64 ": FINODELK %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FINODELK, op_errno), op_errno,
+ PS_MSG_INODELK_INFO, "frame=%" PRId64, frame->root->unique,
+ "FINODELK_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -347,14 +335,12 @@ server4_entrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_ENTRYLK, op_errno), op_errno,
- PS_MSG_ENTRYLK_INFO,
- "%" PRId64
- ": ENTRYLK %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_ENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -386,14 +372,12 @@ server4_fentrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_FENTRYLK, op_errno), op_errno,
- PS_MSG_ENTRYLK_INFO,
- "%" PRId64 ": FENTRYLK %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FENTRYLK, op_errno), op_errno,
+ PS_MSG_ENTRYLK_INFO, "frame=%" PRId64, frame->root->unique,
+ "FENTRYLK_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -424,13 +408,12 @@ server4_access_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_ACCESS_INFO,
- "%" PRId64
- ": ACCESS %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_ACCESS_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s",
+ (state->loc.path) ? state->loc.path : "", "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -463,13 +446,13 @@ server4_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
- "%" PRId64
- ": RMDIR %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
+ "frame=%" PRId64, frame->root->unique, "RMDIR_pat=%s",
+ (state->loc.path) ? state->loc.path : "", "uuid_utoa=%s",
+ uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -505,14 +488,13 @@ server4_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_MKDIR, op_errno), op_errno,
- PS_MSG_DIR_INFO,
- "%" PRId64
- ": MKDIR %s (%s/%s) client: %s, "
- "error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_MKDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO, "frame=%" PRId64, frame->root->unique,
+ "MKDIR_path=%s", (state->loc.path) ? state->loc.path : "",
+ "uuid_utoa=%s", uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -547,14 +529,13 @@ server4_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, fop_log_level(GF_FOP_MKNOD, op_errno), op_errno,
- PS_MSG_MKNOD_INFO,
- "%" PRId64
- ": MKNOD %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_MKNOD, op_errno), op_errno,
+ PS_MSG_MKNOD_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -586,14 +567,12 @@ server4_fsyncdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FSYNCDIR, op_errno), op_errno,
- PS_MSG_DIR_INFO,
- "%" PRId64 ": FSYNCDIR %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FSYNCDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO, "frame=%" PRId64, frame->root->unique,
+ "FSYNCDIR_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -626,14 +605,12 @@ server4_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_READDIR, op_errno), op_errno,
- PS_MSG_DIR_INFO,
- "%" PRId64 ": READDIR %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_READDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO, "frame=%" PRId64, frame->root->unique,
+ "READDIR_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -677,14 +654,12 @@ server4_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_OPENDIR, op_errno), op_errno,
- PS_MSG_DIR_INFO,
- "%" PRId64
- ": OPENDIR %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_OPENDIR, op_errno), op_errno,
+ PS_MSG_DIR_INFO, "frame=%" PRId64, frame->root->unique,
+ "OPENDIR_path=%s", (state->loc.path) ? state->loc.path : "",
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -726,13 +701,12 @@ server4_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
else
loglevel = GF_LOG_INFO;
- gf_msg(this->name, loglevel, op_errno, PS_MSG_REMOVEXATTR_INFO,
- "%" PRId64
- ": REMOVEXATTR %s (%s) of key %s, client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), state->name,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, loglevel, op_errno, PS_MSG_REMOVEXATTR_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s",
+ state->loc.path, "uuid_utoa=%s", uuid_utoa(state->resolve.gfid),
+ "name=%s", state->name, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -763,14 +737,13 @@ server4_fremovexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FREMOVEXATTR, op_errno),
- op_errno, PS_MSG_REMOVEXATTR_INFO,
- "%" PRId64 ": FREMOVEXATTR %" PRId64
- " (%s) (%s), "
- "client: %s, error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), state->name,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FREMOVEXATTR, op_errno),
+ op_errno, PS_MSG_REMOVEXATTR_INFO, "frame=%" PRId64,
+ frame->root->unique, "FREMOVEXATTR_fd_no%" PRId64,
+ state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "name=%s", state->name,
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -802,14 +775,12 @@ server4_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_GETXATTR, op_errno), op_errno,
- PS_MSG_GETXATTR_INFO,
- "%" PRId64
- ": GETXATTR %s (%s) (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), state->name,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_GETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "name=%s", state->name,
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -844,14 +815,12 @@ server4_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FGETXATTR, op_errno), op_errno,
- PS_MSG_GETXATTR_INFO,
- "%" PRId64 ": FGETXATTR %" PRId64
- " (%s) (%s), "
- "client: %s, error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), state->name,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FGETXATTR, op_errno), op_errno,
+ PS_MSG_GETXATTR_INFO, "frame=%" PRId64, frame->root->unique,
+ "FGETXATTR_fd_no=%" PRId64, state->resolve.fd_no,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "name=%s",
+ state->name, "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -891,11 +860,9 @@ server4_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_errno == ENOTSUP) {
gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
} else {
- gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
- "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
}
goto out;
}
@@ -933,11 +900,9 @@ server4_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_errno == ENOTSUP) {
gf_msg_debug(THIS->name, 0, "%s", strerror(op_errno));
} else {
- gf_msg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
- "client: %s, "
- "error-xlator: %s",
- STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(THIS->name, GF_LOG_INFO, op_errno, PS_MSG_SETXATTR_INFO,
+ "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
}
goto out;
}
@@ -981,14 +946,14 @@ server4_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
uuid_utoa_r(state->resolve.pargfid, oldpar_str);
uuid_utoa_r(state->resolve2.pargfid, newpar_str);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
- "%" PRId64
- ": RENAME %s (%s/%s) -> %s (%s/%s), "
- "client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path, oldpar_str,
- state->resolve.bname, state->loc2.path, newpar_str,
- state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
+ "frame=%" PRId64, frame->root->unique, "loc.path=%s",
+ state->loc.path, "oldpar_str=%s", oldpar_str, "resolve-name=%s",
+ state->resolve.bname, "loc2.path=%s", state->loc2.path,
+ "newpar_str=%s", newpar_str, "resolve2=%s",
+ state->resolve2.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1023,14 +988,13 @@ server4_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_UNLINK, op_errno), op_errno,
- PS_MSG_LINK_INFO,
- "%" PRId64
- ": UNLINK %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_UNLINK, op_errno), op_errno,
+ PS_MSG_LINK_INFO, "frame=%" PRId64, frame->root->unique,
+ "UNLINK_path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1073,13 +1037,13 @@ server4_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%" PRId64
- ": SYMLINK %s (%s/%s), client: %s, "
- "error-xlator:%s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "frame=%" PRId64, frame->root->unique, "SYMLINK_path= %s",
+ (state->loc.path) ? state->loc.path : "", "uuid_utoa=%s",
+ uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1124,13 +1088,12 @@ server4_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa_r(state->resolve.gfid, gfid_str);
uuid_utoa_r(state->resolve2.pargfid, newpar_str);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%" PRId64
- ": LINK %s (%s) -> %s/%s, client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path, gfid_str, newpar_str,
- state->resolve2.bname, STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "frame=%" PRId64, frame->root->unique, "LINK_path=%s",
+ state->loc.path, "gfid_str=%s", gfid_str, "newpar_str=%s",
+ newpar_str, "resolve2.bname=%s", state->resolve2.bname,
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1164,13 +1127,11 @@ server4_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_TRUNCATE_INFO,
- "%" PRId64
- ": TRUNCATE %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_TRUNCATE_INFO,
+ "frame=%" PRId64, frame->root->unique, "TRUNCATE_path=%s",
+ state->loc.path, "uuid_utoa=%s", uuid_utoa(state->resolve.gfid),
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1204,14 +1165,12 @@ server4_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_FSTAT, op_errno), op_errno,
- PS_MSG_STAT_INFO,
- "%" PRId64 ": FSTAT %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FSTAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO, "frame=%" PRId64, frame->root->unique,
+ "FSTAT_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1243,14 +1202,12 @@ server4_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FTRUNCATE, op_errno), op_errno,
- PS_MSG_TRUNCATE_INFO,
- "%" PRId64 ": FTRUNCATE %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FTRUNCATE, op_errno), op_errno,
+ PS_MSG_TRUNCATE_INFO, "frame=%" PRId64, frame->root->unique,
+ "FTRUNCATE_fd_no=%" PRId64, state->resolve.fd_no,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1283,14 +1240,12 @@ server4_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FLUSH, op_errno), op_errno,
- PS_MSG_FLUSH_INFO,
- "%" PRId64 ": FLUSH %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FLUSH, op_errno), op_errno,
+ PS_MSG_FLUSH_INFO, "frame=%" PRId64, frame->root->unique,
+ "FLUSH_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1322,14 +1277,12 @@ server4_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FSYNC, op_errno), op_errno,
- PS_MSG_SYNC_INFO,
- "%" PRId64 ": FSYNC %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FSYNC, op_errno), op_errno,
+ PS_MSG_SYNC_INFO, "frame=%" PRId64, frame->root->unique,
+ "FSYNC_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1363,14 +1316,12 @@ server4_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_WRITE, op_errno), op_errno,
- PS_MSG_WRITE_INFO,
- "%" PRId64 ": WRITEV %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_WRITE, op_errno), op_errno,
+ PS_MSG_WRITE_INFO, "frame=%" PRId64, frame->root->unique,
+ "WRITEV_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1415,14 +1366,12 @@ server4_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_READ, op_errno), op_errno,
- PS_MSG_READ_INFO,
- "%" PRId64 ": READV %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_READ, op_errno), op_errno,
+ PS_MSG_READ_INFO, "frame=%" PRId64, frame->root->unique,
+ "READV_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1456,14 +1405,12 @@ server4_rchecksum_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_RCHECKSUM, op_errno), op_errno,
- PS_MSG_CHKSUM_INFO,
- "%" PRId64 ": RCHECKSUM %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_RCHECKSUM, op_errno), op_errno,
+ PS_MSG_CHKSUM_INFO, "frame=%" PRId64, frame->root->unique,
+ "RCHECKSUM_fd_no=%" PRId64, state->resolve.fd_no,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1495,12 +1442,12 @@ server4_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_OPEN, op_errno), op_errno,
- PS_MSG_OPEN_INFO,
- "%" PRId64 ": OPEN %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_OPEN, op_errno), op_errno,
+ PS_MSG_OPEN_INFO, "frame=%" PRId64, frame->root->unique,
+ "OPEN_path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1537,13 +1484,12 @@ server4_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
- "%" PRId64
- ": CREATE %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(
+ this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s", state->loc.path,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1593,13 +1539,11 @@ server4_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
- "%" PRId64
- ": READLINK %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
+ "frame=%" PRId64, frame->root->unique, "READLINK_path=%s",
+ state->loc.path, "uuid_utoa=%s", uuid_utoa(state->resolve.gfid),
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1634,12 +1578,12 @@ server4_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_STAT, op_errno), op_errno,
- PS_MSG_STAT_INFO,
- "%" PRId64 ": STAT %s (%s), client: %s, error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_STAT, op_errno), op_errno,
+ PS_MSG_STAT_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", (state->loc.path) ? state->loc.path : "",
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1672,13 +1616,12 @@ server4_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
- "%" PRId64
- ": SETATTR %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, (state->loc.path) ? state->loc.path : "",
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s",
+ (state->loc.path) ? state->loc.path : "", "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1712,14 +1655,12 @@ server4_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FSETATTR, op_errno), op_errno,
- PS_MSG_SETATTR_INFO,
- "%" PRId64 ": FSETATTR %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FSETATTR, op_errno), op_errno,
+ PS_MSG_SETATTR_INFO, "frame=%" PRId64,
+ "FSETATTR_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1753,14 +1694,12 @@ server4_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), op_errno,
- PS_MSG_XATTROP_INFO,
- "%" PRId64
- ": XATTROP %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO, "frame=%" PRId64, frame->root->unique,
+ "path=%s", state->loc.path, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1795,14 +1734,12 @@ server4_fxattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FXATTROP, op_errno), op_errno,
- PS_MSG_XATTROP_INFO,
- "%" PRId64 ": FXATTROP %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FXATTROP, op_errno), op_errno,
+ PS_MSG_XATTROP_INFO, "frame=%" PRId64, frame->root->unique,
+ "FXATTROP_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1841,14 +1778,12 @@ server4_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_READDIRP, op_errno), op_errno,
- PS_MSG_DIR_INFO,
- "%" PRId64 ": READDIRP %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_READDIRP, op_errno), op_errno,
+ PS_MSG_DIR_INFO, "frame=%" PRId64, frame->root->unique,
+ "READDIRP_fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1894,14 +1829,12 @@ server4_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_FALLOCATE, op_errno), op_errno,
- PS_MSG_ALLOC_INFO,
- "%" PRId64 ": FALLOCATE %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_FALLOCATE, op_errno), op_errno,
+ PS_MSG_ALLOC_INFO, "frame=%" PRId64, frame->root->unique,
+ "FALLOCATE_fd_no=%" PRId64, state->resolve.fd_no,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1935,14 +1868,12 @@ server4_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE(frame);
- gf_msg(this->name, fop_log_level(GF_FOP_DISCARD, op_errno), op_errno,
- PS_MSG_DISCARD_INFO,
- "%" PRId64 ": DISCARD %" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_DISCARD, op_errno), op_errno,
+ PS_MSG_DISCARD_INFO, "frame=%" PRId64, frame->root->unique,
+ "fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator: %s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -1978,14 +1909,12 @@ server4_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
dict_to_xdr(xdata, &rsp.xdata);
if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_ZEROFILL, op_errno), op_errno,
- PS_MSG_ZEROFILL_INFO,
- "%" PRId64 ": ZEROFILL%" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_ZEROFILL, op_errno), op_errno,
+ PS_MSG_ZEROFILL_INFO, "frame=%" PRId64, frame->root->unique,
+ "fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -2019,13 +1948,12 @@ server4_ipc_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
dict_to_xdr(xdata, &rsp.xdata);
if (op_ret) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_IPC_INFO,
- "%" PRId64 ": IPC%" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_IPC_INFO,
+ "frame=%" PRId64, frame->root->unique, "IPC=%" PRId64,
+ state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -2057,14 +1985,12 @@ server4_seek_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
dict_to_xdr(xdata, &rsp.xdata);
if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_SEEK, op_errno), op_errno,
- PS_MSG_SEEK_INFO,
- "%" PRId64 ": SEEK%" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, fop_log_level(GF_FOP_SEEK, op_errno), op_errno,
+ PS_MSG_SEEK_INFO, "frame=%" PRId64, frame->root->unique,
+ "fd_no=%" PRId64, state->resolve.fd_no, "uuid_utoa=%s",
+ uuid_utoa(state->resolve.gfid), "client=%s",
+ STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -2097,13 +2023,11 @@ server4_setactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
- "%" PRId64
- ": SETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_SETACTIVELK_INFO,
+ "frame=%" PRId64, frame->root->unique, "path==%s",
+ state->loc.path, "uuid_utoa=%s", uuid_utoa(state->resolve.gfid),
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -2172,9 +2096,10 @@ server4_icreate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
- "%" PRId64 ": ICREATE [%s] ==> (%s)", frame->root->unique,
- uuid_utoa(state->resolve.gfid), strerror(op_errno));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
+ "frame=%" PRId64, uuid_utoa(state->resolve.gfid),
+ "ICREATE_gfid=%s", uuid_utoa(state->resolve.gfid),
+ "op_errno=%s", strerror(op_errno), NULL);
goto out;
}
@@ -2227,13 +2152,12 @@ server4_put_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret < 0) {
- gf_msg(this->name, GF_LOG_INFO, op_errno, PS_MSG_PUT_INFO,
- "%" PRId64
- ": PUT %s (%s/%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.pargfid), state->resolve.bname,
- STACK_CLIENT_NAME(frame->root), STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(
+ this->name, GF_LOG_INFO, op_errno, PS_MSG_PUT_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s", state->loc.path,
+ "uuid_utoa=%s", uuid_utoa(state->resolve.pargfid), "bname=%s",
+ state->resolve.bname, "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -2259,6 +2183,63 @@ out:
return 0;
}
+int
+server4_copy_file_range_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *stbuf, struct iatt *prebuf_dst,
+ struct iatt *postbuf_dst, dict_t *xdata)
+{
+ gfx_common_3iatt_rsp rsp = {
+ 0,
+ };
+ server_state_t *state = NULL;
+ rpcsvc_request_t *req = NULL;
+ char in_gfid[GF_UUID_BUF_SIZE] = {0};
+ char out_gfid[GF_UUID_BUF_SIZE] = {0};
+
+ dict_to_xdr(xdata, &rsp.xdata);
+
+ if (op_ret < 0) {
+ state = CALL_STATE(frame);
+
+ uuid_utoa_r(state->resolve.gfid, in_gfid);
+ uuid_utoa_r(state->resolve2.gfid, out_gfid);
+
+ gf_smsg(this->name, fop_log_level(GF_FOP_COPY_FILE_RANGE, op_errno),
+ op_errno, PS_MSG_WRITE_INFO, "frame=%" PRId64,
+ frame->root->unique, "COPY_FILE_RANGE_fd_no=%" PRId64,
+ state->resolve.fd_no, "in_gfid=%s", in_gfid,
+ "resolve2_fd_no=%" PRId64, state->resolve2.fd_no, "out_gfid=%s",
+ out_gfid, "client=%s", STACK_CLIENT_NAME(frame->root),
+ "error-xlator=%s", STACK_ERR_XL_NAME(frame->root), NULL);
+ goto out;
+ }
+
+ /*
+ * server4_post_common_3iatt (ex: used by server4_put_cbk and some
+ * other cbks) also performs inode linking along with copying of 3
+ * iatt structures to the response. But, for copy_file_range, linking
+ * of inode is not needed. Therefore a new function is used to
+ * construct the response using 3 iatt structures.
+ * @stbuf: iatt or stat of the source file (or fd)
+ * @prebuf_dst: iatt or stat of destination file (or fd) before the fop
+ * @postbuf_dst: iatt or stat of destination file (or fd) after the fop
+ */
+ server4_post_common_3iatt_noinode(&rsp, stbuf, prebuf_dst, postbuf_dst);
+
+out:
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error(op_errno);
+
+ req = frame->local;
+ server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_common_3iatt_rsp);
+
+ GF_FREE(rsp.xdata.pairs.pairs_val);
+
+ return 0;
+}
+
/* Resume function section */
int
@@ -2716,8 +2697,7 @@ server4_opendir_resume(call_frame_t *frame, xlator_t *bound_xl)
state->fd = fd_create(state->loc.inode, frame->root->pid);
if (!state->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "could not create the fd");
+ gf_smsg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED, NULL);
goto err;
}
@@ -3080,9 +3060,9 @@ server4_create_resume(call_frame_t *frame, xlator_t *bound_xl)
state->fd = fd_create(state->loc.inode, frame->root->pid);
if (!state->fd) {
- gf_msg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
- "fd creation for the inode %s failed",
- state->loc.inode ? uuid_utoa(state->loc.inode->gfid) : NULL);
+ gf_smsg("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED, "inode=%s",
+ state->loc.inode ? uuid_utoa(state->loc.inode->gfid) : NULL,
+ NULL);
state->resolve.op_ret = -1;
state->resolve.op_errno = ENOMEM;
goto err;
@@ -3328,13 +3308,11 @@ server4_getactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE(frame);
- gf_msg(this->name, GF_LOG_INFO, op_errno, 0,
- "%" PRId64
- ": GETACTIVELK %s (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->loc.path,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
+ gf_smsg(this->name, GF_LOG_INFO, op_errno, PS_MSG_GETACTIVELK_INFO,
+ "frame=%" PRId64, frame->root->unique, "path=%s",
+ state->loc.path, "gfid=%s", uuid_utoa(state->resolve.gfid),
+ "client=%s", STACK_CLIENT_NAME(frame->root), "error-xlator=%s",
+ STACK_ERR_XL_NAME(frame->root), NULL);
goto out;
}
@@ -3448,6 +3426,29 @@ err:
}
int
+server4_copy_file_range_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, server4_copy_file_range_cbk, bound_xl,
+ bound_xl->fops->copy_file_range, state->fd, state->off_in,
+ state->fd_out, state->off_out, state->size, state->flags,
+ state->xdata);
+
+ return 0;
+err:
+ server4_copy_file_range_cbk(frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno, NULL, NULL, NULL,
+ NULL);
+ return 0;
+}
+
+int
server4_0_stat(rpcsvc_request_t *req)
{
server_state_t *state = NULL;
@@ -3458,7 +3459,6 @@ server4_0_stat(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return 0;
@@ -3473,16 +3473,16 @@ server4_0_stat(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_stat_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3497,7 +3497,6 @@ server4_0_setattr(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return 0;
@@ -3514,14 +3513,15 @@ server4_0_setattr(rpcsvc_request_t *req)
gfx_stat_to_iattx(&args.stbuf, &state->stbuf);
state->valid = args.valid;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_setattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
return ret;
}
@@ -3535,7 +3535,6 @@ server4_0_fallocate(rpcsvc_request_t *req)
{0},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3554,16 +3553,16 @@ server4_0_fallocate(rpcsvc_request_t *req)
state->size = args.size;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fallocate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3576,7 +3575,6 @@ server4_0_discard(rpcsvc_request_t *req)
{0},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3594,16 +3592,16 @@ server4_0_discard(rpcsvc_request_t *req)
state->size = args.size;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_discard_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3635,7 +3633,10 @@ server4_0_zerofill(rpcsvc_request_t *req)
state->size = args.size;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_zerofill_resume);
@@ -3655,7 +3656,6 @@ server4_0_ipc(rpcsvc_request_t *req)
0,
};
int ret = -1;
- int op_errno = 0;
xlator_t *bound_xl = NULL;
if (!req)
@@ -3664,21 +3664,20 @@ server4_0_ipc(rpcsvc_request_t *req)
ret = rpc_receive_common(req, &frame, &state, NULL, &args, xdr_gfx_ipc_req,
GF_FOP_IPC);
if (ret != 0) {
- op_errno = -1;
goto out;
}
bound_xl = frame->root->client->bound_xl;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
STACK_WIND(frame, server4_ipc_cbk, bound_xl, bound_xl->fops->ipc, args.op,
state->xdata);
out:
- if (op_errno)
- req->rpc_err = GARBAGE_ARGS;
-
return ret;
}
@@ -3693,7 +3692,6 @@ server4_0_seek(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3711,15 +3709,15 @@ server4_0_seek(rpcsvc_request_t *req)
state->what = args.what;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_seek_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3734,7 +3732,6 @@ server4_0_readlink(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3750,16 +3747,16 @@ server4_0_readlink(rpcsvc_request_t *req)
state->size = args.size;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_readlink_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3774,7 +3771,6 @@ server4_0_create(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3798,7 +3794,10 @@ server4_0_create(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_DONTCARE;
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_create_resume);
@@ -3806,9 +3805,6 @@ server4_0_create(rpcsvc_request_t *req)
out:
free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3823,7 +3819,6 @@ server4_0_open(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3839,14 +3834,14 @@ server4_0_open(rpcsvc_request_t *req)
state->flags = gf_flags_to_flags(args.flags);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_open_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3861,7 +3856,6 @@ server4_0_readv(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
goto out;
@@ -3880,14 +3874,14 @@ server4_0_readv(rpcsvc_request_t *req)
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_readv_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3904,7 +3898,6 @@ server4_0_writev(rpcsvc_request_t *req)
ssize_t len = 0;
int i = 0;
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -3937,7 +3930,10 @@ server4_0_writev(rpcsvc_request_t *req)
GF_ASSERT(state->size == len);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
#ifdef GF_TESTING_IO_XDATA
dict_dump_to_log(state->xdata);
@@ -3947,9 +3943,6 @@ server4_0_writev(rpcsvc_request_t *req)
resolve_and_resume(frame, server4_writev_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -3988,7 +3981,7 @@ server4_0_writev_vecsizer(int state, ssize_t *readsize, char *base_addr,
/* need to round off to proper roof (%4), as XDR packing pads
the end of opaque object with '0' */
- size = roof(write_req.xdata.xdr_size, 4);
+ size = gf_roof(write_req.xdata.xdr_size, 4);
*readsize = size;
@@ -4040,9 +4033,8 @@ server4_0_release(rpcsvc_request_t *req)
serv_ctx = server_ctx_get(client, client->this);
if (serv_ctx == NULL) {
- gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
- "server_ctx_get() "
- "failed");
+ gf_smsg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ NULL);
req->rpc_err = SYSTEM_ERR;
goto out;
}
@@ -4086,9 +4078,8 @@ server4_0_releasedir(rpcsvc_request_t *req)
serv_ctx = server_ctx_get(client, client->this);
if (serv_ctx == NULL) {
- gf_msg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
- "server_ctx_get() "
- "failed");
+ gf_smsg(req->trans->name, GF_LOG_INFO, 0, PS_MSG_SERVER_CTX_GET_FAILED,
+ NULL);
req->rpc_err = SYSTEM_ERR;
goto out;
}
@@ -4114,7 +4105,6 @@ server4_0_fsync(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4130,15 +4120,15 @@ server4_0_fsync(rpcsvc_request_t *req)
state->flags = args.data;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fsync_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4153,7 +4143,6 @@ server4_0_flush(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4168,15 +4157,15 @@ server4_0_flush(rpcsvc_request_t *req)
state->resolve.fd_no = args.fd;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_flush_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4191,7 +4180,6 @@ server4_0_ftruncate(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4207,15 +4195,15 @@ server4_0_ftruncate(rpcsvc_request_t *req)
state->offset = args.offset;
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_ftruncate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4230,7 +4218,6 @@ server4_0_fstat(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4245,15 +4232,15 @@ server4_0_fstat(rpcsvc_request_t *req)
state->resolve.fd_no = args.fd;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fstat_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4268,7 +4255,6 @@ server4_0_truncate(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4283,15 +4269,15 @@ server4_0_truncate(rpcsvc_request_t *req)
memcpy(state->resolve.gfid, args.gfid, 16);
state->offset = args.offset;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_truncate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4306,7 +4292,6 @@ server4_0_unlink(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4324,16 +4309,16 @@ server4_0_unlink(rpcsvc_request_t *req)
state->flags = args.xflags;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_unlink_resume);
out:
free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4348,7 +4333,6 @@ server4_0_setxattr(rpcsvc_request_t *req)
},
};
int32_t ret = -1;
- int32_t op_errno = 0;
if (!req)
return ret;
@@ -4363,22 +4347,23 @@ server4_0_setxattr(rpcsvc_request_t *req)
state->flags = args.flags;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict(&args.dict, &state->dict);
- if (ret)
- gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
+ if (xdr_to_dict(&args.dict, &state->dict)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
/* There can be some commands hidden in key, check and proceed */
gf_server_check_setxattr_cmd(frame, state->dict);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_setxattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4393,7 +4378,6 @@ server4_0_fsetxattr(rpcsvc_request_t *req)
},
};
int32_t ret = -1;
- int32_t op_errno = 0;
if (!req)
return ret;
@@ -4409,19 +4393,20 @@ server4_0_fsetxattr(rpcsvc_request_t *req)
state->flags = args.flags;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict(&args.dict, &state->dict);
- if (ret)
- gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
+ if (xdr_to_dict(&args.dict, &state->dict)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fsetxattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4436,7 +4421,6 @@ server4_0_fxattrop(rpcsvc_request_t *req)
},
};
int32_t ret = -1;
- int32_t op_errno = 0;
if (!req)
return ret;
@@ -4452,19 +4436,20 @@ server4_0_fxattrop(rpcsvc_request_t *req)
state->flags = args.flags;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict(&args.dict, &state->dict);
- if (ret)
- gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
+ if (xdr_to_dict(&args.dict, &state->dict)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fxattrop_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4479,7 +4464,6 @@ server4_0_xattrop(rpcsvc_request_t *req)
},
};
int32_t ret = -1;
- int32_t op_errno = 0;
if (!req)
return ret;
@@ -4494,19 +4478,20 @@ server4_0_xattrop(rpcsvc_request_t *req)
state->flags = args.flags;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- ret = xdr_to_dict(&args.dict, &state->dict);
- if (ret)
- gf_msg_debug(THIS->name, EINVAL, "dictionary not received");
+ if (xdr_to_dict(&args.dict, &state->dict)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_xattrop_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4521,7 +4506,6 @@ server4_0_getxattr(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4541,16 +4525,16 @@ server4_0_getxattr(rpcsvc_request_t *req)
gf_server_check_getxattr_cmd(frame, state->name);
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_getxattr_resume);
out:
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4565,7 +4549,6 @@ server4_0_fgetxattr(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4582,16 +4565,16 @@ server4_0_fgetxattr(rpcsvc_request_t *req)
if (args.namelen)
state->name = gf_strdup(args.name);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fgetxattr_resume);
out:
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4606,7 +4589,6 @@ server4_0_removexattr(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4621,16 +4603,16 @@ server4_0_removexattr(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
state->name = gf_strdup(args.name);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_removexattr_resume);
out:
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4645,7 +4627,6 @@ server4_0_fremovexattr(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4661,16 +4642,16 @@ server4_0_fremovexattr(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
state->name = gf_strdup(args.name);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fremovexattr_resume);
out:
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4685,7 +4666,6 @@ server4_0_opendir(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4699,15 +4679,15 @@ server4_0_opendir(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_opendir_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4723,7 +4703,6 @@ server4_0_readdirp(rpcsvc_request_t *req)
};
size_t headers_size = 0;
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4751,14 +4730,14 @@ server4_0_readdirp(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
/* here, dict itself works as xdata */
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_readdirp_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4774,7 +4753,6 @@ server4_0_readdir(rpcsvc_request_t *req)
};
size_t headers_size = 0;
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4801,15 +4779,15 @@ server4_0_readdir(rpcsvc_request_t *req)
state->offset = args.offset;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_readdir_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4824,7 +4802,6 @@ server4_0_fsyncdir(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4840,15 +4817,15 @@ server4_0_fsyncdir(rpcsvc_request_t *req)
state->flags = args.data;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fsyncdir_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4863,7 +4840,6 @@ server4_0_mknod(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4883,7 +4859,10 @@ server4_0_mknod(rpcsvc_request_t *req)
state->dev = args.dev;
state->umask = args.umask;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_mknod_resume);
@@ -4891,9 +4870,6 @@ server4_0_mknod(rpcsvc_request_t *req)
out:
free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4908,7 +4884,6 @@ server4_0_mkdir(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4926,7 +4901,10 @@ server4_0_mkdir(rpcsvc_request_t *req)
state->mode = args.mode;
state->umask = args.umask;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_mkdir_resume);
@@ -4934,9 +4912,6 @@ server4_0_mkdir(rpcsvc_request_t *req)
out:
free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4951,7 +4926,6 @@ server4_0_rmdir(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -4968,16 +4942,16 @@ server4_0_rmdir(rpcsvc_request_t *req)
state->flags = args.xflags;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_rmdir_resume);
out:
free(args.bname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -4993,7 +4967,6 @@ server4_0_inodelk(rpcsvc_request_t *req)
};
int cmd = 0;
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5037,7 +5010,10 @@ server4_0_inodelk(rpcsvc_request_t *req)
break;
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_inodelk_resume);
@@ -5046,9 +5022,6 @@ out:
free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5063,7 +5036,6 @@ server4_0_finodelk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5108,7 +5080,10 @@ server4_0_finodelk(rpcsvc_request_t *req)
break;
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_finodelk_resume);
@@ -5117,9 +5092,6 @@ out:
free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5134,7 +5106,6 @@ server4_0_entrylk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5155,7 +5126,10 @@ server4_0_entrylk(rpcsvc_request_t *req)
state->cmd = args.cmd;
state->type = args.type;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_entrylk_resume);
@@ -5163,9 +5137,6 @@ out:
free(args.volume);
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5180,7 +5151,6 @@ server4_0_fentrylk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5201,7 +5171,10 @@ server4_0_fentrylk(rpcsvc_request_t *req)
state->name = gf_strdup(args.name);
state->volume = gf_strdup(args.volume);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fentrylk_resume);
@@ -5209,9 +5182,6 @@ out:
free(args.volume);
free(args.name);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5226,7 +5196,6 @@ server4_0_access(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5241,15 +5210,15 @@ server4_0_access(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
state->mask = args.mask;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_access_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5264,7 +5233,6 @@ server4_0_symlink(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5281,7 +5249,10 @@ server4_0_symlink(rpcsvc_request_t *req)
state->name = gf_strdup(args.linkname);
state->umask = args.umask;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_symlink_resume);
@@ -5290,9 +5261,6 @@ out:
free(args.bname);
free(args.linkname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5307,7 +5275,6 @@ server4_0_link(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5326,16 +5293,16 @@ server4_0_link(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
args.newgfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_link_resume);
out:
free(args.newbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5350,7 +5317,6 @@ server4_0_rename(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5370,7 +5336,10 @@ server4_0_rename(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve2.pargfid,
args.newgfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_rename_resume);
@@ -5378,9 +5347,6 @@ out:
free(args.oldbname);
free(args.newbname);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5395,7 +5361,6 @@ server4_0_lease(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5410,15 +5375,15 @@ server4_0_lease(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
gf_proto_lease_to_lease(&args.lease, &state->lease);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_lease_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5433,7 +5398,6 @@ server4_0_lk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5486,17 +5450,17 @@ server4_0_lk(rpcsvc_request_t *req)
state->flock.l_type = F_UNLCK;
break;
default:
- gf_msg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
- PS_MSG_LOCK_ERROR,
- "fd - %" PRId64
- " (%s): Unknown "
- "lock type: %" PRId32 "!",
- state->resolve.fd_no, uuid_utoa(state->fd->inode->gfid),
- state->type);
+ gf_smsg(frame->root->client->bound_xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_LOCK_ERROR, "fd=%" PRId64, state->resolve.fd_no,
+ "uuid_utoa=%s", uuid_utoa(state->fd->inode->gfid),
+ "lock type=" PRId32, state->type, NULL);
break;
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_lk_resume);
@@ -5504,9 +5468,6 @@ out:
free(args.flock.lk_owner.lk_owner_val);
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5556,7 +5517,10 @@ server4_0_lookup(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
}
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto err;
+ }
ret = 0;
resolve_and_resume(frame, server4_lookup_resume);
@@ -5578,7 +5542,6 @@ server4_0_statfs(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5592,15 +5555,15 @@ server4_0_statfs(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_statfs_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5615,7 +5578,6 @@ server4_0_getactivelk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5630,15 +5592,15 @@ server4_0_getactivelk(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
/* here, dict itself works as xdata */
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_getactivelk_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5653,7 +5615,6 @@ server4_0_setactivelk(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5668,7 +5629,10 @@ server4_0_setactivelk(rpcsvc_request_t *req)
set_resolve_gfid(frame->root->client, state->resolve.gfid, args.gfid);
/* here, dict itself works as xdata */
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = unserialize_req_locklist_v2(&args, &state->locklist);
if (ret)
@@ -5678,9 +5642,6 @@ server4_0_setactivelk(rpcsvc_request_t *req)
resolve_and_resume(frame, server4_setactivelk_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5695,7 +5656,6 @@ server4_0_namelink(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5711,14 +5671,14 @@ server4_0_namelink(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_NOT;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_namelink_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5733,7 +5693,6 @@ server4_0_icreate(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
uuid_t gfid = {
0,
};
@@ -5758,14 +5717,14 @@ server4_0_icreate(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_NOT;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_icreate_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5778,7 +5737,6 @@ server4_0_fsetattr(rpcsvc_request_t *req)
{0},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5796,14 +5754,14 @@ server4_0_fsetattr(rpcsvc_request_t *req)
gfx_stat_to_iattx(&args.stbuf, &state->stbuf);
state->valid = args.valid;
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_fsetattr_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5816,7 +5774,6 @@ server4_0_rchecksum(rpcsvc_request_t *req)
{0},
};
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
@@ -5834,13 +5791,13 @@ server4_0_rchecksum(rpcsvc_request_t *req)
memcpy(state->resolve.gfid, args.gfid, 16);
- xdr_to_dict(&args.xdata, &state->xdata);
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
+ goto out;
+ }
ret = 0;
resolve_and_resume(frame, server4_rchecksum_resume);
out:
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
@@ -5855,7 +5812,6 @@ server4_0_put(rpcsvc_request_t *req)
},
};
int ret = -1;
- int op_errno = 0;
ssize_t len = 0;
int i = 0;
@@ -5898,298 +5854,171 @@ server4_0_put(rpcsvc_request_t *req)
state->resolve.type = RESOLVE_DONTCARE;
}
- xdr_to_dict(&args.xattr, &state->dict);
- xdr_to_dict(&args.xdata, &state->xdata);
-
- ret = 0;
- resolve_and_resume(frame, server4_put_resume);
-
-out:
- free(args.bname);
-
- if (op_errno)
+ if (xdr_to_dict(&args.xattr, &state->dict)) {
SERVER_REQ_SET_ERROR(req, ret);
-
- return ret;
-}
-
-int
-server4_compound_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, void *data,
- dict_t *xdata)
-{
- struct gfx_compound_rsp rsp = {
- 0,
- };
- server_state_t *state = NULL;
- rpcsvc_request_t *req = NULL;
- compound_args_cbk_t *args_cbk = data;
- int i = 0;
-
- req = frame->local;
- state = CALL_STATE(frame);
-
- dict_to_xdr(xdata, &rsp.xdata);
-
- if (op_ret) {
- gf_msg(this->name, fop_log_level(GF_FOP_COMPOUND, op_errno), op_errno,
- PS_MSG_COMPOUND_INFO,
- "%" PRId64 ": COMPOUND%" PRId64
- " (%s), client: %s, "
- "error-xlator: %s",
- frame->root->unique, state->resolve.fd_no,
- uuid_utoa(state->resolve.gfid), STACK_CLIENT_NAME(frame->root),
- STACK_ERR_XL_NAME(frame->root));
- }
-
- /* TODO: I assume a single 10MB payload is large, if not, we need to
- agree to valid payload */
- if ((args_cbk->fop_length <= 0) ||
- ((args_cbk->fop_length > (10 * 1024 * 1024)))) {
- op_ret = -1;
- op_errno = EINVAL;
goto out;
}
-
- rsp.compound_rsp_array.compound_rsp_array_val = GF_CALLOC(
- args_cbk->fop_length, sizeof(compound_rsp_v2),
- gf_server_mt_compound_rsp_t);
-
- if (!rsp.compound_rsp_array.compound_rsp_array_val) {
- op_ret = -1;
- op_errno = ENOMEM;
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
+ SERVER_REQ_SET_ERROR(req, ret);
goto out;
}
- rsp.compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
- for (i = 0; i < args_cbk->fop_length; i++) {
- op_ret = server_populate_compound_response_v2(this, &rsp, frame,
- args_cbk, i);
+ ret = 0;
+ resolve_and_resume(frame, server4_put_resume);
- if (op_ret) {
- op_errno = op_ret;
- op_ret = -1;
- goto out;
- }
- }
out:
- rsp.op_ret = op_ret;
- rsp.op_errno = gf_errno_to_error(op_errno);
-
- server_submit_reply(frame, req, &rsp, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_compound_rsp);
-
- server_compound_rsp_cleanup_v2(&rsp, args_cbk);
- GF_FREE(rsp.xdata.pairs.pairs_val);
+ free(args.bname);
- return 0;
+ return ret;
}
int
-server4_compound_resume(call_frame_t *frame, xlator_t *bound_xl)
+server4_0_compound(rpcsvc_request_t *req)
{
- server_state_t *state = NULL;
- gfx_compound_req *req = NULL;
- compound_args_t *args = NULL;
- int i = 0;
int ret = -1;
- int length = 0;
- int op_errno = ENOMEM;
- compound_req_v2 *c_req = NULL;
-
- state = CALL_STATE(frame);
-
- if (state->resolve.op_ret != 0) {
- ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
-
- req = &state->req_v2;
-
- length = req->compound_req_array.compound_req_array_len;
- state->args = compound_fop_alloc(length, req->compound_fop_enum,
- state->xdata);
- args = state->args;
-
- if (!args)
- goto err;
-
- for (i = 0; i < length; i++) {
- c_req = &req->compound_req_array.compound_req_array_val[i];
- args->enum_list[i] = c_req->fop_enum;
-
- ret = server_populate_compound_request_v2(req, frame,
- &args->req_list[i], i);
-
- if (ret) {
- op_errno = ret;
- ret = -1;
- goto err;
- }
- }
-
- STACK_WIND(frame, server4_compound_cbk, bound_xl, bound_xl->fops->compound,
- args, state->xdata);
-
- return 0;
-err:
- server4_compound_cbk(frame, NULL, frame->this, ret, op_errno, NULL, NULL);
-
+ SERVER_REQ_SET_ERROR(req, ret);
return ret;
}
+
int
-server4_0_compound(rpcsvc_request_t *req)
+server4_0_copy_file_range(rpcsvc_request_t *req)
{
server_state_t *state = NULL;
call_frame_t *frame = NULL;
- gfx_compound_req args = {
- 0,
+ gfx_copy_file_range_req args = {
+ {
+ 0,
+ },
};
ssize_t len = 0;
- int length = 0;
- int i = 0;
int ret = -1;
- int op_errno = 0;
if (!req)
return ret;
ret = rpc_receive_common(req, &frame, &state, &len, &args,
- xdr_gfx_compound_req, GF_FOP_COMPOUND);
+ xdr_gfx_copy_file_range_req,
+ GF_FOP_COPY_FILE_RANGE);
if (ret != 0) {
goto out;
}
- state->req_v2 = args;
- state->iobref = iobref_ref(req->iobref);
-
- if (len < req->msg[0].iov_len) {
- state->payload_vector[0].iov_base = (req->msg[0].iov_base + len);
- state->payload_vector[0].iov_len = req->msg[0].iov_len - len;
- state->payload_count = 1;
- }
-
- for (i = 1; i < req->count; i++) {
- state->payload_vector[state->payload_count++] = req->msg[i];
- }
-
- state->size = iov_length(state->payload_vector, state->payload_count);
-
- ret = server_get_compound_resolve_v2(state, &args);
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd_in;
+ state->resolve2.type = RESOLVE_MUST; /*making this resolve must */
+ state->resolve2.fd_no = args.fd_out;
+ state->off_in = args.off_in;
+ state->off_out = args.off_out;
+ state->size = args.size;
+ state->flags = args.flag;
+ memcpy(state->resolve.gfid, args.gfid1, 16);
+ memcpy(state->resolve2.gfid, args.gfid2, 16);
- if (ret) {
+ if (xdr_to_dict(&args.xdata, &state->xdata)) {
SERVER_REQ_SET_ERROR(req, ret);
goto out;
}
- xdr_to_dict(&args.xdata, &state->xdata);
-
ret = 0;
- resolve_and_resume(frame, server4_compound_resume);
+ resolve_and_resume(frame, server4_copy_file_range_resume);
out:
- length = args.compound_req_array.compound_req_array_len;
- server_compound_req_cleanup_v2(&args, length);
- free(args.compound_req_array.compound_req_array_val);
-
- if (op_errno)
- SERVER_REQ_SET_ERROR(req, ret);
-
return ret;
}
-rpcsvc_actor_t glusterfs4_0_fop_actors[] = {
- [GFS3_OP_NULL] = {"NULL", GFS3_OP_NULL, server_null, NULL, 0},
- [GFS3_OP_STAT] = {"STAT", GFS3_OP_STAT, server4_0_stat, NULL, 0},
- [GFS3_OP_READLINK] = {"READLINK", GFS3_OP_READLINK, server4_0_readlink,
- NULL, 0},
- [GFS3_OP_MKNOD] = {"MKNOD", GFS3_OP_MKNOD, server4_0_mknod, NULL, 0},
- [GFS3_OP_MKDIR] = {"MKDIR", GFS3_OP_MKDIR, server4_0_mkdir, NULL, 0},
- [GFS3_OP_UNLINK] = {"UNLINK", GFS3_OP_UNLINK, server4_0_unlink, NULL, 0},
- [GFS3_OP_RMDIR] = {"RMDIR", GFS3_OP_RMDIR, server4_0_rmdir, NULL, 0},
- [GFS3_OP_SYMLINK] = {"SYMLINK", GFS3_OP_SYMLINK, server4_0_symlink, NULL,
+static rpcsvc_actor_t glusterfs4_0_fop_actors[] = {
+ [GFS3_OP_NULL] = {"NULL", server_null, NULL, GFS3_OP_NULL, 0},
+ [GFS3_OP_STAT] = {"STAT", server4_0_stat, NULL, GFS3_OP_STAT, 0},
+ [GFS3_OP_READLINK] = {"READLINK", server4_0_readlink, NULL,
+ GFS3_OP_READLINK, 0},
+ [GFS3_OP_MKNOD] = {"MKNOD", server4_0_mknod, NULL, GFS3_OP_MKNOD, 0},
+ [GFS3_OP_MKDIR] = {"MKDIR", server4_0_mkdir, NULL, GFS3_OP_MKDIR, 0},
+ [GFS3_OP_UNLINK] = {"UNLINK", server4_0_unlink, NULL, GFS3_OP_UNLINK, 0},
+ [GFS3_OP_RMDIR] = {"RMDIR", server4_0_rmdir, NULL, GFS3_OP_RMDIR, 0},
+ [GFS3_OP_SYMLINK] = {"SYMLINK", server4_0_symlink, NULL, GFS3_OP_SYMLINK,
0},
- [GFS3_OP_RENAME] = {"RENAME", GFS3_OP_RENAME, server4_0_rename, NULL, 0},
- [GFS3_OP_LINK] = {"LINK", GFS3_OP_LINK, server4_0_link, NULL, 0},
- [GFS3_OP_TRUNCATE] = {"TRUNCATE", GFS3_OP_TRUNCATE, server4_0_truncate,
- NULL, 0},
- [GFS3_OP_OPEN] = {"OPEN", GFS3_OP_OPEN, server4_0_open, NULL, 0},
- [GFS3_OP_READ] = {"READ", GFS3_OP_READ, server4_0_readv, NULL, 0},
- [GFS3_OP_WRITE] = {"WRITE", GFS3_OP_WRITE, server4_0_writev,
- server4_0_writev_vecsizer, 0},
- [GFS3_OP_STATFS] = {"STATFS", GFS3_OP_STATFS, server4_0_statfs, NULL, 0},
- [GFS3_OP_FLUSH] = {"FLUSH", GFS3_OP_FLUSH, server4_0_flush, NULL, 0},
- [GFS3_OP_FSYNC] = {"FSYNC", GFS3_OP_FSYNC, server4_0_fsync, NULL, 0},
- [GFS3_OP_GETXATTR] = {"GETXATTR", GFS3_OP_GETXATTR, server4_0_getxattr,
- NULL, 0},
- [GFS3_OP_SETXATTR] = {"SETXATTR", GFS3_OP_SETXATTR, server4_0_setxattr,
- NULL, 0},
- [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", GFS3_OP_REMOVEXATTR,
- server4_0_removexattr, NULL, 0},
- [GFS3_OP_OPENDIR] = {"OPENDIR", GFS3_OP_OPENDIR, server4_0_opendir, NULL,
+ [GFS3_OP_RENAME] = {"RENAME", server4_0_rename, NULL, GFS3_OP_RENAME, 0},
+ [GFS3_OP_LINK] = {"LINK", server4_0_link, NULL, GFS3_OP_LINK, 0},
+ [GFS3_OP_TRUNCATE] = {"TRUNCATE", server4_0_truncate, NULL,
+ GFS3_OP_TRUNCATE, 0},
+ [GFS3_OP_OPEN] = {"OPEN", server4_0_open, NULL, GFS3_OP_OPEN, 0},
+ [GFS3_OP_READ] = {"READ", server4_0_readv, NULL, GFS3_OP_READ, 0},
+ [GFS3_OP_WRITE] = {"WRITE", server4_0_writev, server4_0_writev_vecsizer,
+ GFS3_OP_WRITE, 0},
+ [GFS3_OP_STATFS] = {"STATFS", server4_0_statfs, NULL, GFS3_OP_STATFS, 0},
+ [GFS3_OP_FLUSH] = {"FLUSH", server4_0_flush, NULL, GFS3_OP_FLUSH, 0},
+ [GFS3_OP_FSYNC] = {"FSYNC", server4_0_fsync, NULL, GFS3_OP_FSYNC, 0},
+ [GFS3_OP_GETXATTR] = {"GETXATTR", server4_0_getxattr, NULL,
+ GFS3_OP_GETXATTR, 0},
+ [GFS3_OP_SETXATTR] = {"SETXATTR", server4_0_setxattr, NULL,
+ GFS3_OP_SETXATTR, 0},
+ [GFS3_OP_REMOVEXATTR] = {"REMOVEXATTR", server4_0_removexattr, NULL,
+ GFS3_OP_REMOVEXATTR, 0},
+ [GFS3_OP_OPENDIR] = {"OPENDIR", server4_0_opendir, NULL, GFS3_OP_OPENDIR,
0},
- [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", GFS3_OP_FSYNCDIR, server4_0_fsyncdir,
- NULL, 0},
- [GFS3_OP_ACCESS] = {"ACCESS", GFS3_OP_ACCESS, server4_0_access, NULL, 0},
- [GFS3_OP_CREATE] = {"CREATE", GFS3_OP_CREATE, server4_0_create, NULL, 0},
- [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", GFS3_OP_FTRUNCATE, server4_0_ftruncate,
- NULL, 0},
- [GFS3_OP_FSTAT] = {"FSTAT", GFS3_OP_FSTAT, server4_0_fstat, NULL, 0},
- [GFS3_OP_LK] = {"LK", GFS3_OP_LK, server4_0_lk, NULL, 0},
- [GFS3_OP_LOOKUP] = {"LOOKUP", GFS3_OP_LOOKUP, server4_0_lookup, NULL, 0},
- [GFS3_OP_READDIR] = {"READDIR", GFS3_OP_READDIR, server4_0_readdir, NULL,
+ [GFS3_OP_FSYNCDIR] = {"FSYNCDIR", server4_0_fsyncdir, NULL,
+ GFS3_OP_FSYNCDIR, 0},
+ [GFS3_OP_ACCESS] = {"ACCESS", server4_0_access, NULL, GFS3_OP_ACCESS, 0},
+ [GFS3_OP_CREATE] = {"CREATE", server4_0_create, NULL, GFS3_OP_CREATE, 0},
+ [GFS3_OP_FTRUNCATE] = {"FTRUNCATE", server4_0_ftruncate, NULL,
+ GFS3_OP_FTRUNCATE, 0},
+ [GFS3_OP_FSTAT] = {"FSTAT", server4_0_fstat, NULL, GFS3_OP_FSTAT, 0},
+ [GFS3_OP_LK] = {"LK", server4_0_lk, NULL, GFS3_OP_LK, 0},
+ [GFS3_OP_LOOKUP] = {"LOOKUP", server4_0_lookup, NULL, GFS3_OP_LOOKUP, 0},
+ [GFS3_OP_READDIR] = {"READDIR", server4_0_readdir, NULL, GFS3_OP_READDIR,
0},
- [GFS3_OP_INODELK] = {"INODELK", GFS3_OP_INODELK, server4_0_inodelk, NULL,
+ [GFS3_OP_INODELK] = {"INODELK", server4_0_inodelk, NULL, GFS3_OP_INODELK,
0},
- [GFS3_OP_FINODELK] = {"FINODELK", GFS3_OP_FINODELK, server4_0_finodelk,
- NULL, 0},
- [GFS3_OP_ENTRYLK] = {"ENTRYLK", GFS3_OP_ENTRYLK, server4_0_entrylk, NULL,
+ [GFS3_OP_FINODELK] = {"FINODELK", server4_0_finodelk, NULL,
+ GFS3_OP_FINODELK, 0},
+ [GFS3_OP_ENTRYLK] = {"ENTRYLK", server4_0_entrylk, NULL, GFS3_OP_ENTRYLK,
0},
- [GFS3_OP_FENTRYLK] = {"FENTRYLK", GFS3_OP_FENTRYLK, server4_0_fentrylk,
- NULL, 0},
- [GFS3_OP_XATTROP] = {"XATTROP", GFS3_OP_XATTROP, server4_0_xattrop, NULL,
+ [GFS3_OP_FENTRYLK] = {"FENTRYLK", server4_0_fentrylk, NULL,
+ GFS3_OP_FENTRYLK, 0},
+ [GFS3_OP_XATTROP] = {"XATTROP", server4_0_xattrop, NULL, GFS3_OP_XATTROP,
0},
- [GFS3_OP_FXATTROP] = {"FXATTROP", GFS3_OP_FXATTROP, server4_0_fxattrop,
- NULL, 0},
- [GFS3_OP_FGETXATTR] = {"FGETXATTR", GFS3_OP_FGETXATTR, server4_0_fgetxattr,
- NULL, 0},
- [GFS3_OP_FSETXATTR] = {"FSETXATTR", GFS3_OP_FSETXATTR, server4_0_fsetxattr,
- NULL, 0},
- [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", GFS3_OP_RCHECKSUM, server4_0_rchecksum,
- NULL, 0},
- [GFS3_OP_SETATTR] = {"SETATTR", GFS3_OP_SETATTR, server4_0_setattr, NULL,
+ [GFS3_OP_FXATTROP] = {"FXATTROP", server4_0_fxattrop, NULL,
+ GFS3_OP_FXATTROP, 0},
+ [GFS3_OP_FGETXATTR] = {"FGETXATTR", server4_0_fgetxattr, NULL,
+ GFS3_OP_FGETXATTR, 0},
+ [GFS3_OP_FSETXATTR] = {"FSETXATTR", server4_0_fsetxattr, NULL,
+ GFS3_OP_FSETXATTR, 0},
+ [GFS3_OP_RCHECKSUM] = {"RCHECKSUM", server4_0_rchecksum, NULL,
+ GFS3_OP_RCHECKSUM, 0},
+ [GFS3_OP_SETATTR] = {"SETATTR", server4_0_setattr, NULL, GFS3_OP_SETATTR,
0},
- [GFS3_OP_FSETATTR] = {"FSETATTR", GFS3_OP_FSETATTR, server4_0_fsetattr,
- NULL, 0},
- [GFS3_OP_READDIRP] = {"READDIRP", GFS3_OP_READDIRP, server4_0_readdirp,
- NULL, 0},
- [GFS3_OP_RELEASE] = {"RELEASE", GFS3_OP_RELEASE, server4_0_release, NULL,
+ [GFS3_OP_FSETATTR] = {"FSETATTR", server4_0_fsetattr, NULL,
+ GFS3_OP_FSETATTR, 0},
+ [GFS3_OP_READDIRP] = {"READDIRP", server4_0_readdirp, NULL,
+ GFS3_OP_READDIRP, 0},
+ [GFS3_OP_RELEASE] = {"RELEASE", server4_0_release, NULL, GFS3_OP_RELEASE,
0},
- [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", GFS3_OP_RELEASEDIR,
- server4_0_releasedir, NULL, 0},
- [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", GFS3_OP_FREMOVEXATTR,
- server4_0_fremovexattr, NULL, 0},
- [GFS3_OP_FALLOCATE] = {"FALLOCATE", GFS3_OP_FALLOCATE, server4_0_fallocate,
- NULL, 0, DRC_NA},
- [GFS3_OP_DISCARD] = {"DISCARD", GFS3_OP_DISCARD, server4_0_discard, NULL, 0,
- DRC_NA},
- [GFS3_OP_ZEROFILL] = {"ZEROFILL", GFS3_OP_ZEROFILL, server4_0_zerofill,
- NULL, 0, DRC_NA},
- [GFS3_OP_IPC] = {"IPC", GFS3_OP_IPC, server4_0_ipc, NULL, 0, DRC_NA},
- [GFS3_OP_SEEK] = {"SEEK", GFS3_OP_SEEK, server4_0_seek, NULL, 0, DRC_NA},
- [GFS3_OP_LEASE] = {"LEASE", GFS3_OP_LEASE, server4_0_lease, NULL, 0,
- DRC_NA},
- [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", GFS3_OP_GETACTIVELK,
- server4_0_getactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", GFS3_OP_SETACTIVELK,
- server4_0_setactivelk, NULL, 0, DRC_NA},
- [GFS3_OP_COMPOUND] = {"COMPOUND", GFS3_OP_COMPOUND, server4_0_compound,
- NULL, 0, DRC_NA},
- [GFS3_OP_ICREATE] = {"ICREATE", GFS3_OP_ICREATE, server4_0_icreate, NULL, 0,
- DRC_NA},
- [GFS3_OP_NAMELINK] = {"NAMELINK", GFS3_OP_NAMELINK, server4_0_namelink,
- NULL, 0, DRC_NA},
+ [GFS3_OP_RELEASEDIR] = {"RELEASEDIR", server4_0_releasedir, NULL,
+ GFS3_OP_RELEASEDIR, 0},
+ [GFS3_OP_FREMOVEXATTR] = {"FREMOVEXATTR", server4_0_fremovexattr, NULL,
+ GFS3_OP_FREMOVEXATTR, 0},
+ [GFS3_OP_FALLOCATE] = {"FALLOCATE", server4_0_fallocate, NULL, DRC_NA,
+ GFS3_OP_FALLOCATE, 0},
+ [GFS3_OP_DISCARD] = {"DISCARD", server4_0_discard, NULL, DRC_NA,
+ GFS3_OP_DISCARD, 0},
+ [GFS3_OP_ZEROFILL] = {"ZEROFILL", server4_0_zerofill, NULL, DRC_NA,
+ GFS3_OP_ZEROFILL, 0},
+ [GFS3_OP_IPC] = {"IPC", server4_0_ipc, NULL, DRC_NA, GFS3_OP_IPC, 0},
+ [GFS3_OP_SEEK] = {"SEEK", server4_0_seek, NULL, DRC_NA, GFS3_OP_SEEK, 0},
+ [GFS3_OP_LEASE] = {"LEASE", server4_0_lease, NULL, DRC_NA, GFS3_OP_LEASE,
+ 0},
+ [GFS3_OP_GETACTIVELK] = {"GETACTIVELK", server4_0_getactivelk, NULL, DRC_NA,
+ GFS3_OP_GETACTIVELK, 0},
+ [GFS3_OP_SETACTIVELK] = {"SETACTIVELK", server4_0_setactivelk, NULL, DRC_NA,
+ GFS3_OP_SETACTIVELK, 0},
+ [GFS3_OP_COMPOUND] = {"COMPOUND", server4_0_compound, NULL, DRC_NA,
+ GFS3_OP_COMPOUND, 0},
+ [GFS3_OP_ICREATE] = {"ICREATE", server4_0_icreate, NULL, DRC_NA,
+ GFS3_OP_ICREATE, 0},
+ [GFS3_OP_NAMELINK] = {"NAMELINK", server4_0_namelink, NULL, DRC_NA,
+ GFS3_OP_NAMELINK, 0},
+ [GFS3_OP_COPY_FILE_RANGE] = {"COPY-FILE-RANGE", server4_0_copy_file_range,
+ NULL, DRC_NA, GFS3_OP_COPY_FILE_RANGE, 0},
};
struct rpcsvc_program glusterfs4_0_fop_prog = {
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index a8664d7871e..721968004a0 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -14,15 +14,14 @@
#include "server.h"
#include "server-helpers.h"
#include "glusterfs3-xdr.h"
-#include "call-stub.h"
-#include "statedump.h"
-#include "defaults.h"
+#include <glusterfs/call-stub.h>
+#include <glusterfs/statedump.h>
+#include <glusterfs/defaults.h>
#include "authenticate.h"
-#include "gf-event.h"
-#include "events.h"
+#include <glusterfs/gf-event.h>
+#include <glusterfs/events.h>
#include "server-messages.h"
#include "rpc-clnt.h"
-#include "glusterfsd.h"
rpcsvc_cbk_program_t server_cbk_prog = {
.progname = "Gluster Callback",
@@ -109,8 +108,7 @@ server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg,
iob = gfs_serialize_reply(req, arg, &rsp, xdrproc);
if (!iob) {
- gf_msg("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED,
- "Failed to serialize reply");
+ gf_smsg("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED, NULL);
goto ret;
}
@@ -133,7 +131,7 @@ server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg,
"Reply submission failed");
if (frame && client) {
server_connection_cleanup(frame->this, client,
- INTERNAL_LOCKS | POSIX_LOCKS);
+ INTERNAL_LOCKS | POSIX_LOCKS, NULL);
} else {
gf_msg_callingfn("", GF_LOG_ERROR, 0, PS_MSG_REPLY_SUBMIT_FAILED,
"Reply submission failed");
@@ -169,6 +167,7 @@ server_priv_to_dict(xlator_t *this, dict_t *dict, char *brickname)
char key[32] = {
0,
};
+ int keylen;
int count = 0;
int ret = -1;
@@ -188,8 +187,8 @@ server_priv_to_dict(xlator_t *this, dict_t *dict, char *brickname)
(xprt->xl_private->bound_xl->name) && (brickname) &&
(!strcmp(brickname, xprt->xl_private->bound_xl->name))) {
peerinfo = &xprt->peerinfo;
- snprintf(key, sizeof(key), "client%d.hostname", count);
- ret = dict_set_str(dict, key, peerinfo->identifier);
+ keylen = snprintf(key, sizeof(key), "client%d.hostname", count);
+ ret = dict_set_strn(dict, key, keylen, peerinfo->identifier);
if (ret)
goto unlock;
@@ -208,8 +207,9 @@ server_priv_to_dict(xlator_t *this, dict_t *dict, char *brickname)
if (ret)
goto unlock;
- snprintf(key, sizeof(key), "client%d.name", count);
- ret = dict_set_str(dict, key, xprt->xl_private->client_name);
+ keylen = snprintf(key, sizeof(key), "client%d.name", count);
+ ret = dict_set_strn(dict, key, keylen,
+ xprt->xl_private->client_name);
if (ret)
goto unlock;
@@ -222,7 +222,7 @@ unlock:
if (ret)
goto out;
- ret = dict_set_int32(dict, "clientcount", count);
+ ret = dict_set_int32_sizen(dict, "clientcount", count);
out:
return ret;
@@ -267,6 +267,8 @@ server_priv(xlator_t *this)
gf_proc_dump_build_key(key, "server", "total-bytes-write");
gf_proc_dump_write(key, "%" PRIu64, total_write);
+ rpcsvc_statedump(conf->rpc);
+
ret = 0;
out:
if (ret)
@@ -302,8 +304,7 @@ get_auth_types(dict_t *this, char *key, data_t *value, void *data)
/* TODO: backward compatibility, remove when
newer versions are available */
tmp = "addr";
- gf_msg("server", GF_LOG_WARNING, 0, PS_MSG_AUTH_IP_ERROR,
- "assuming 'auth.ip' to be 'auth.addr'");
+ gf_smsg("server", GF_LOG_WARNING, 0, PS_MSG_AUTH_IP_ERROR, NULL);
}
ret = dict_set_dynptr(auth_dict, tmp, NULL, 0);
if (ret < 0) {
@@ -332,8 +333,8 @@ _check_for_auth_option(dict_t *d, char *k, data_t *v, void *tmp)
goto out;
if (strncmp(tail, "addr.", 5) != 0) {
- gf_msg(xl->name, GF_LOG_TRACE, 0, PS_MSG_SKIP_FORMAT_CHK,
- "skip format check for non-addr auth option %s", k);
+ gf_smsg(xl->name, GF_LOG_TRACE, 0, PS_MSG_SKIP_FORMAT_CHK, "option=%s",
+ k, NULL);
goto out;
}
@@ -355,10 +356,8 @@ _check_for_auth_option(dict_t *d, char *k, data_t *v, void *tmp)
ret = xlator_option_validate_addr_list(xl, "auth-*", v->data, NULL,
NULL);
if (ret)
- gf_msg(xl->name, GF_LOG_ERROR, 0, PS_MSG_INTERNET_ADDR_ERROR,
- "internet address '%s' does not conform "
- "to standards.",
- v->data);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, PS_MSG_INTERNET_ADDR_ERROR,
+ "data=%s", v->data, NULL);
}
out:
return ret;
@@ -378,11 +377,8 @@ validate_auth_options(xlator_t *this, dict_t *dict)
error = dict_foreach(dict, _check_for_auth_option, trav->xlator);
if (-1 == error) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
- "volume '%s' "
- "defined as subvolume, but no authentication "
- "defined for the same",
- trav->xlator->name);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR,
+ "name=%s", trav->xlator->name, NULL);
break;
}
trav = trav->next;
@@ -392,6 +388,43 @@ out:
return error;
}
+void
+server_call_xlator_mem_cleanup(xlator_t *this, char *victim_name)
+{
+ pthread_t th_id = {
+ 0,
+ };
+ int th_ret = -1;
+ server_cleanup_xprt_arg_t *arg = NULL;
+
+ if (!victim_name)
+ return;
+
+ gf_log(this->name, GF_LOG_INFO, "Create graph janitor thread for brick %s",
+ victim_name);
+
+ arg = calloc(1, sizeof(*arg));
+ arg->this = this;
+ arg->victim_name = strdup(victim_name);
+ if (!arg->victim_name) {
+ gf_smsg(this->name, GF_LOG_CRITICAL, ENOMEM, LG_MSG_NO_MEMORY,
+ "Memory allocation is failed");
+ free(arg);
+ return;
+ }
+
+ th_ret = gf_thread_create_detached(&th_id, server_graph_janitor_threads,
+ arg, "graphjanitor");
+ if (th_ret) {
+ gf_log(this->name, GF_LOG_ERROR,
+ "graph janitor Thread"
+ " creation is failed for brick %s",
+ victim_name);
+ free(arg->victim_name);
+ free(arg);
+ }
+}
+
int
server_rpc_notify(rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, void *data)
{
@@ -402,25 +435,20 @@ server_rpc_notify(rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, void *data)
client_t *client = NULL;
char *auth_path = NULL;
int ret = -1;
- gf_boolean_t victim_found = _gf_false;
char *xlator_name = NULL;
- glusterfs_ctx_t *ctx = NULL;
- xlator_t *top = NULL;
- xlator_list_t **trav_p = NULL;
- xlator_t *travxl = NULL;
uint64_t xprtrefcount = 0;
- struct _child_status *tmp = NULL;
+ gf_boolean_t fd_exist = _gf_false;
- if (!xl || !data) {
+ this = xl;
+ trans = data;
+
+ if (!this || !data || !this->ctx || !this->ctx->active) {
gf_msg_callingfn("server", GF_LOG_WARNING, 0, PS_MSG_RPC_NOTIFY_ERROR,
"Calling rpc_notify without initializing");
goto out;
}
- this = xl;
- trans = data;
conf = this->private;
- ctx = this->ctx;
switch (event) {
case RPCSVC_EVENT_ACCEPT: {
@@ -451,35 +479,38 @@ server_rpc_notify(rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, void *data)
break;
}
+ /* Set the disconnect_progress flag to 1 to avoid races
+ during brick detach while brick mux is enabled
+ */
+ GF_ATOMIC_INIT(trans->disconnect_progress, 1);
/* transport has to be removed from the list upon disconnect
* irrespective of whether lock self heal is off or on, since
* new transport will be created upon reconnect.
*/
pthread_mutex_lock(&conf->mutex);
client = trans->xl_private;
- list_del_init(&trans->list);
+ if (!client)
+ list_del_init(&trans->list);
pthread_mutex_unlock(&conf->mutex);
if (!client)
goto unref_transport;
- gf_msg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_DISCONNECTING,
- "disconnecting connection"
- " from %s",
- client->client_uid);
+ gf_smsg(this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_DISCONNECTING,
+ "client-uid=%s", client->client_uid, NULL);
- ret = dict_get_str(this->options, "auth-path", &auth_path);
+ ret = dict_get_str_sizen(this->options, "auth-path", &auth_path);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_DICT_GET_FAILED,
- "failed to get auth-path");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PS_MSG_DICT_GET_FAILED,
+ "type=auth-path", NULL);
auth_path = NULL;
}
gf_client_ref(client);
gf_client_put(client, &detached);
if (detached) {
- server_connection_cleanup(this, client,
- INTERNAL_LOCKS | POSIX_LOCKS);
+ server_connection_cleanup(
+ this, client, INTERNAL_LOCKS | POSIX_LOCKS, &fd_exist);
gf_event(EVENT_CLIENT_DISCONNECT,
"client_uid=%s;"
"client_identifier=%s;server_identifier=%s;"
@@ -496,53 +527,36 @@ server_rpc_notify(rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, void *data)
unref_transport:
/* rpc_transport_unref() causes a RPCSVC_EVENT_TRANSPORT_DESTROY
* to be called in blocking manner
- * So no code should ideally be after this unref
+ * So no code should ideally be after this unref, Call
+ * rpc_transport_unref only while cleanup_starting flag is not set
+ * otherwise transport_unref will be call by either
+ * server_connection_cleanup_flush_cbk or server_submit_reply at the
+ * time of freeing state
*/
- rpc_transport_unref(trans);
+ if (!client || !detached || !fd_exist)
+ rpc_transport_unref(trans);
break;
case RPCSVC_EVENT_TRANSPORT_DESTROY:
+ pthread_mutex_lock(&conf->mutex);
client = trans->xl_private;
+ list_del_init(&trans->list);
+ pthread_mutex_unlock(&conf->mutex);
if (!client)
break;
- pthread_mutex_lock(&conf->mutex);
- list_for_each_entry(tmp, &conf->child_status->status_list,
- status_list)
- {
- if (tmp->name && client->bound_xl &&
- client->bound_xl->cleanup_starting &&
- !strcmp(tmp->name, client->bound_xl->name)) {
- xprtrefcount = GF_ATOMIC_GET(tmp->xprtrefcnt);
- if (xprtrefcount > 0) {
- xprtrefcount = GF_ATOMIC_DEC(tmp->xprtrefcnt);
- if (xprtrefcount == 0)
- xlator_name = gf_strdup(client->bound_xl->name);
- }
- break;
+
+ if (client->bound_xl && client->bound_xl->cleanup_starting) {
+ xprtrefcount = GF_ATOMIC_GET(client->bound_xl->xprtrefcnt);
+ if (xprtrefcount > 0) {
+ xprtrefcount = GF_ATOMIC_DEC(client->bound_xl->xprtrefcnt);
+ if (xprtrefcount == 0)
+ xlator_name = gf_strdup(client->bound_xl->name);
}
}
- pthread_mutex_unlock(&conf->mutex);
gf_client_unref(client);
if (xlator_name) {
- if (this->ctx->active) {
- top = this->ctx->active->first;
- LOCK(&ctx->volfile_lock);
- for (trav_p = &top->children; *trav_p;
- trav_p = &(*trav_p)->next) {
- travxl = (*trav_p)->xlator;
- if (!travxl->call_cleanup &&
- strcmp(travxl->name, xlator_name) == 0) {
- victim_found = _gf_true;
- break;
- }
- }
- UNLOCK(&ctx->volfile_lock);
- if (victim_found) {
- xlator_mem_cleanup(travxl);
- rpcsvc_autoscale_threads(ctx, conf->rpc, -1);
- }
- }
+ server_call_xlator_mem_cleanup(this, xlator_name);
GF_FREE(xlator_name);
}
@@ -556,6 +570,71 @@ out:
return 0;
}
+void *
+server_graph_janitor_threads(void *data)
+{
+ xlator_t *victim = NULL;
+ xlator_t *this = NULL;
+ server_conf_t *conf = NULL;
+ glusterfs_ctx_t *ctx = NULL;
+ char *victim_name = NULL;
+ server_cleanup_xprt_arg_t *arg = NULL;
+ gf_boolean_t victim_found = _gf_false;
+ xlator_list_t **trav_p = NULL;
+ xlator_t *top = NULL;
+ uint32_t parent_down = 0;
+
+ GF_ASSERT(data);
+
+ arg = data;
+ this = arg->this;
+ victim_name = arg->victim_name;
+ THIS = arg->this;
+ conf = this->private;
+
+ ctx = THIS->ctx;
+ GF_VALIDATE_OR_GOTO(this->name, ctx, out);
+
+ top = this->ctx->active->first;
+ LOCK(&ctx->volfile_lock);
+ for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) {
+ victim = (*trav_p)->xlator;
+ if (victim->cleanup_starting &&
+ strcmp(victim->name, victim_name) == 0) {
+ parent_down = victim->parent_down;
+ victim->parent_down = 1;
+ if (!parent_down)
+ victim_found = _gf_true;
+ break;
+ }
+ }
+ if (victim_found)
+ glusterfs_delete_volfile_checksum(ctx, victim->volfile_id);
+ UNLOCK(&ctx->volfile_lock);
+ if (!victim_found) {
+ gf_log(this->name, GF_LOG_ERROR,
+ "victim brick %s is not"
+ " found in graph",
+ victim_name);
+ goto out;
+ }
+
+ default_notify(victim, GF_EVENT_PARENT_DOWN, victim);
+ if (victim->notify_down) {
+ gf_log(THIS->name, GF_LOG_INFO,
+ "Start call fini for brick"
+ " %s stack",
+ victim->name);
+ xlator_mem_cleanup(victim);
+ rpcsvc_autoscale_threads(ctx, conf->rpc, -1);
+ }
+
+out:
+ free(arg->victim_name);
+ free(arg);
+ return NULL;
+}
+
int32_t
server_mem_acct_init(xlator_t *this)
{
@@ -566,8 +645,7 @@ server_mem_acct_init(xlator_t *this)
ret = xlator_mem_acct_init(this, gf_server_mt_end + 1);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
- "Memory accounting init failed");
+ gf_smsg(this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY, NULL);
return ret;
}
out:
@@ -623,7 +701,7 @@ server_check_event_threads(xlator_t *this, server_conf_t *conf, int32_t new)
return 0;
}
- return event_reconfigure_threads(pool, target);
+ return gf_event_reconfigure_threads(pool, target);
}
int
@@ -669,14 +747,15 @@ server_reconfigure(xlator_t *this, dict_t *options)
* translator itself.
*/
kid = NULL;
- if (dict_get_str(options, "auth-path", &auth_path) == 0) {
+ if (dict_get_str_sizen(options, "auth-path", &auth_path) == 0) {
kid = get_xlator_by_name(this, auth_path);
}
if (!kid) {
kid = this;
}
- if (dict_get_int32(options, "inode-lru-limit", &inode_lru_limit) == 0) {
+ if (dict_get_int32_sizen(options, "inode-lru-limit", &inode_lru_limit) ==
+ 0) {
conf->inode_lru_limit = inode_lru_limit;
gf_msg_trace(this->name, 0,
"Reconfigured inode-lru-limit to "
@@ -691,13 +770,12 @@ server_reconfigure(xlator_t *this, dict_t *options)
xlator_foreach(this, xlator_set_inode_lru_limit, &inode_lru_limit);
}
- data = dict_get(options, "trace");
+ data = dict_get_sizen(options, "trace");
if (data) {
ret = gf_string2boolean(data->data, &trace);
if (ret != 0) {
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
- "'trace' takes on only "
- "boolean values. Neglecting option");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
+ NULL);
ret = -1;
goto out;
}
@@ -707,8 +785,7 @@ server_reconfigure(xlator_t *this, dict_t *options)
GF_OPTION_RECONF("statedump-path", statedump_path, options, path, do_auth);
if (!statedump_path) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_STATEDUMP_PATH_ERROR,
- "Error while reconfiguring statedump path");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_STATEDUMP_PATH_ERROR, NULL);
goto do_auth;
}
gf_path_strip_trailing_slashes(statedump_path);
@@ -741,16 +818,14 @@ do_auth:
GF_OPTION_RECONF("gid-timeout", conf->gid_cache_timeout, options, int32,
do_rpc);
if (gid_cache_reconf(&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
- "Failed to reconfigure group cache.");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR, NULL);
goto do_rpc;
}
do_rpc:
rpc_conf = conf->rpc;
if (!rpc_conf) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "No rpc_conf !!!!");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR, NULL);
goto out;
}
@@ -794,8 +869,8 @@ do_rpc:
* connections that are relevant to the brick
* we're reconfiguring.
*/
- if (dict_get_str(xprt->clnt_options, "remote-subvolume",
- &xprt_path) != 0) {
+ if (dict_get_str_sizen(xprt->clnt_options, "remote-subvolume",
+ &xprt_path) != 0) {
continue;
}
if (strcmp(xprt_path, auth_path) != 0) {
@@ -804,9 +879,8 @@ do_rpc:
ret = gf_authenticate(xprt->clnt_options, options,
conf->auth_modules);
if (ret == AUTH_ACCEPT) {
- gf_msg(kid->name, GF_LOG_TRACE, 0, PS_MSG_CLIENT_ACCEPTED,
- "authorized client, hence we "
- "continue with this connection");
+ gf_smsg(kid->name, GF_LOG_TRACE, 0, PS_MSG_CLIENT_ACCEPTED,
+ NULL);
} else {
gf_event(EVENT_CLIENT_AUTH_REJECT,
"client_uid=%s;"
@@ -816,11 +890,10 @@ do_rpc:
xprt->xl_private->client_uid,
xprt->peerinfo.identifier, xprt->myinfo.identifier,
auth_path);
- gf_msg(this->name, GF_LOG_INFO, EACCES,
- PS_MSG_AUTHENTICATE_ERROR,
- "unauthorized client, hence "
- "terminating the connection %s",
- xprt->peerinfo.identifier);
+ gf_smsg(this->name, GF_LOG_INFO, EACCES,
+ PS_MSG_UNAUTHORIZED_CLIENT,
+ "peerinfo-identifier=%s", xprt->peerinfo.identifier,
+ NULL);
rpc_transport_disconnect(xprt, _gf_false);
}
}
@@ -831,8 +904,7 @@ do_rpc:
ret = rpcsvc_set_outstanding_rpc_limit(
rpc_conf, options, RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "Failed to reconfigure outstanding-rpc-limit");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_RECONFIGURE_FAILED, NULL);
goto out;
}
@@ -842,9 +914,8 @@ do_rpc:
if (listeners->trans->reconfigure)
listeners->trans->reconfigure(listeners->trans, options);
else
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
- "Reconfigure "
- "not found for transport");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
+ NULL);
}
}
@@ -860,12 +931,6 @@ do_rpc:
if (ret)
goto out;
- /* rpcsvc thread reconfigure should be after events thread
- * reconfigure
- */
- new_nthread = ((struct event_pool *)(this->ctx->event_pool))
- ->eventthreadcount;
- ret = rpcsvc_ownthread_reconf(rpc_conf, new_nthread);
out:
THIS = oldTHIS;
gf_msg_debug("", 0, "returning %d", ret);
@@ -910,9 +975,9 @@ server_dump_metrics(xlator_t *this, int fd)
if (!client)
continue;
- dprintf(fd, "%s.total.rpc.%s.bytes_read %lu\n", this->name,
+ dprintf(fd, "%s.total.rpc.%s.bytes_read %" PRIu64 "\n", this->name,
client->client_uid, xprt->total_bytes_read);
- dprintf(fd, "%s.total.rpc.%s.bytes_write %lu\n", this->name,
+ dprintf(fd, "%s.total.rpc.%s.bytes_write %" PRIu64 "\n", this->name,
client->client_uid, xprt->total_bytes_write);
dprintf(fd, "%s.total.rpc.%s.outstanding %d\n", this->name,
client->client_uid, xprt->outstanding_rpc_count);
@@ -923,6 +988,49 @@ server_dump_metrics(xlator_t *this, int fd)
return 0;
}
+void
+server_cleanup(xlator_t *this, server_conf_t *conf)
+{
+ if (!this || !conf)
+ return;
+
+ LOCK_DESTROY(&conf->itable_lock);
+ pthread_mutex_destroy(&conf->mutex);
+
+ if (this->ctx->event_pool) {
+ /* Free the event pool */
+ (void)gf_event_pool_destroy(this->ctx->event_pool);
+ }
+
+ if (dict_get_sizen(this->options, "config-directory")) {
+ GF_FREE(conf->conf_dir);
+ conf->conf_dir = NULL;
+ }
+
+ if (conf->child_status) {
+ GF_FREE(conf->child_status);
+ conf->child_status = NULL;
+ }
+
+ if (this->ctx->statedump_path) {
+ GF_FREE(this->ctx->statedump_path);
+ this->ctx->statedump_path = NULL;
+ }
+
+ if (conf->auth_modules) {
+ gf_auth_fini(conf->auth_modules);
+ dict_unref(conf->auth_modules);
+ }
+
+ if (conf->rpc) {
+ (void)rpcsvc_destroy(conf->rpc);
+ conf->rpc = NULL;
+ }
+
+ GF_FREE(conf);
+ this->private = NULL;
+}
+
int
server_init(xlator_t *this)
{
@@ -935,14 +1043,12 @@ server_init(xlator_t *this)
GF_VALIDATE_OR_GOTO("init", this, out);
if (this->children == NULL) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL,
- "protocol/server should have subvolume");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL, NULL);
goto out;
}
if (this->parents != NULL) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR,
- "protocol/server should not have parent volumes");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR, NULL);
goto out;
}
@@ -965,27 +1071,22 @@ server_init(xlator_t *this)
if (ret)
goto out;
- ret = dict_get_str(this->options, "config-directory", &conf->conf_dir);
+ ret = dict_get_str_sizen(this->options, "config-directory",
+ &conf->conf_dir);
if (ret)
conf->conf_dir = CONFDIR;
conf->child_status = GF_CALLOC(1, sizeof(struct _child_status),
gf_server_mt_child_status);
INIT_LIST_HEAD(&conf->child_status->status_list);
- GF_ATOMIC_INIT(conf->child_status->xprtrefcnt, 0);
- /*ret = dict_get_str (this->options, "statedump-path", &statedump_path);
- if (!ret) {
- gf_path_strip_trailing_slashes (statedump_path);
- this->ctx->statedump_path = statedump_path;
- }*/
GF_OPTION_INIT("statedump-path", statedump_path, path, out);
if (statedump_path) {
gf_path_strip_trailing_slashes(statedump_path);
this->ctx->statedump_path = gf_strdup(statedump_path);
} else {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_STATEDUMP_PATH_ERROR,
- "Error setting statedump path");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_SET_STATEDUMP_PATH_ERROR,
+ NULL);
ret = -1;
goto out;
}
@@ -1004,6 +1105,7 @@ server_init(xlator_t *this)
ret = gf_auth_init(this, conf->auth_modules);
if (ret) {
dict_unref(conf->auth_modules);
+ conf->auth_modules = NULL;
goto out;
}
@@ -1015,8 +1117,7 @@ server_init(xlator_t *this)
GF_OPTION_INIT("gid-timeout", conf->gid_cache_timeout, int32, out);
if (gid_cache_init(&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
- "Failed to initialize group cache.");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_INIT_GRP_CACHE_ERROR, NULL);
goto out;
}
@@ -1035,9 +1136,7 @@ server_init(xlator_t *this)
/* RPC related */
conf->rpc = rpcsvc_init(this, this->ctx, this->options, 0);
if (conf->rpc == NULL) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPCSVC_CREATE_FAILED,
- "creation of rpcsvc "
- "failed");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPCSVC_CREATE_FAILED, NULL);
ret = -1;
goto out;
}
@@ -1045,8 +1144,7 @@ server_init(xlator_t *this)
ret = rpcsvc_set_outstanding_rpc_limit(
conf->rpc, this->options, RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
if (ret < 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
- "Failed to configure outstanding-rpc-limit");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONFIGURE_FAILED, NULL);
goto out;
}
@@ -1056,40 +1154,40 @@ server_init(xlator_t *this)
*/
this->ctx->secure_srvr = MGMT_SSL_COPY_IO;
- ret = dict_get_str(this->options, "transport-type", &transport_type);
+ ret = dict_get_str_sizen(this->options, "transport-type", &transport_type);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
- "option transport-type not set");
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_TYPE_NOT_SET,
+ NULL);
ret = -1;
goto out;
}
total_transport = rpc_transport_count(transport_type);
if (total_transport <= 0) {
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
- "failed to get total number of available tranpsorts");
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_GET_TOTAL_AVAIL_TRANSPORT_FAILED, NULL);
ret = -1;
goto out;
}
+
+ ret = dict_set_int32_sizen(this->options, "notify-poller-death", 1);
+
ret = rpcsvc_create_listeners(conf->rpc, this->options, this->name);
if (ret < 1) {
- gf_msg(this->name, GF_LOG_WARNING, 0,
- PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
- "creation of listener failed");
+ gf_smsg(this->name, GF_LOG_WARNING, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, NULL);
if (ret != -EADDRINUSE)
ret = -1;
goto out;
} else if (ret < total_transport) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
- PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
- "creation of %d listeners failed, continuing with "
- "succeeded transport",
- (total_transport - ret));
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED, "number=%d",
+ "continuing with succeeded transport", (total_transport - ret),
+ NULL);
}
ret = rpcsvc_register_notify(conf->rpc, server_rpc_notify, this);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY,
- "registration of notify with rpcsvc failed");
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY, NULL);
goto out;
}
@@ -1099,11 +1197,10 @@ server_init(xlator_t *this)
*/
ret = rpcsvc_program_register(conf->rpc, &glusterfs3_3_fop_prog, _gf_true);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
- "registration of program (name:%s, prognum:%d, "
- "progver:%d) failed",
- glusterfs3_3_fop_prog.progname, glusterfs3_3_fop_prog.prognum,
- glusterfs3_3_fop_prog.progver);
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED, "name=%s",
+ glusterfs3_3_fop_prog.progname, "prognum=%d",
+ glusterfs3_3_fop_prog.prognum, "progver=%d",
+ glusterfs3_3_fop_prog.progver, NULL);
goto out;
}
@@ -1123,11 +1220,10 @@ server_init(xlator_t *this)
ret = rpcsvc_program_register(conf->rpc, &gluster_handshake_prog,
_gf_false);
if (ret) {
- gf_msg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
- "registration of program (name:%s, prognum:%d, "
- "progver:%d) failed",
- gluster_handshake_prog.progname, gluster_handshake_prog.prognum,
- gluster_handshake_prog.progver);
+ gf_smsg(this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED, "name=%s",
+ gluster_handshake_prog.progname, "prognum=%d",
+ gluster_handshake_prog.prognum, "progver=%d",
+ gluster_handshake_prog.progver, NULL);
rpcsvc_program_unregister(conf->rpc, &glusterfs3_3_fop_prog);
rpcsvc_program_unregister(conf->rpc, &glusterfs4_0_fop_prog);
goto out;
@@ -1141,18 +1237,14 @@ server_init(xlator_t *this)
lim.rlim_max = 1048576;
if (setrlimit(RLIMIT_NOFILE, &lim) == -1) {
- gf_msg(this->name, GF_LOG_WARNING, errno, PS_MSG_ULIMIT_SET_FAILED,
- "WARNING: Failed to "
- "set 'ulimit -n 1M': %s",
- strerror(errno));
+ gf_smsg(this->name, GF_LOG_WARNING, errno, PS_MSG_ULIMIT_SET_FAILED,
+ "errno=%s", strerror(errno), NULL);
lim.rlim_cur = 65536;
lim.rlim_max = 65536;
if (setrlimit(RLIMIT_NOFILE, &lim) == -1) {
- gf_msg(this->name, GF_LOG_WARNING, errno, PS_MSG_FD_NOT_FOUND,
- "Failed to set "
- "max open fd to 64k: %s",
- strerror(errno));
+ gf_smsg(this->name, GF_LOG_WARNING, errno, PS_MSG_FD_NOT_FOUND,
+ "errno=%s", strerror(errno), NULL);
} else {
gf_msg_trace(this->name, 0,
"max open fd set "
@@ -1164,9 +1256,8 @@ server_init(xlator_t *this)
if (!this->ctx->cmd_args.volfile_id) {
/* In some use cases this is a valid case, but
document this to be annoying log in that case */
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_VOL_FILE_OPEN_FAILED,
- "volfile-id argument not given. "
- "This is mandatory argument, defaulting to 'gluster'");
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_VOL_FILE_OPEN_FAILED,
+ NULL);
this->ctx->cmd_args.volfile_id = gf_strdup("gluster");
}
FIRST_CHILD(this)->volfile_id = gf_strdup(this->ctx->cmd_args.volfile_id);
@@ -1179,15 +1270,7 @@ out:
if (this != NULL) {
this->fini(this);
}
-
- if (conf && conf->rpc) {
- rpcsvc_listener_t *listener, *next;
- list_for_each_entry_safe(listener, next, &conf->rpc->listeners,
- list)
- {
- rpcsvc_listener_destroy(listener);
- }
- }
+ server_cleanup(this, conf);
}
return ret;
@@ -1310,9 +1393,9 @@ server_process_event_upcall(xlator_t *this, void *data)
xdrproc = (xdrproc_t)xdr_gfs4_entrylk_contention_req;
break;
default:
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, PS_MSG_INVALID_ENTRY,
- "Received invalid upcall event(%d)",
- upcall_data->event_type);
+ gf_smsg(this->name, GF_LOG_WARNING, EINVAL,
+ PS_MSG_INVLAID_UPCALL_EVENT, "event-type=%d",
+ upcall_data->event_type, NULL);
goto out;
}
@@ -1386,6 +1469,8 @@ server_process_child_event(xlator_t *this, int32_t event, void *data,
INIT_LIST_HEAD(&tmp->status_list);
tmp->name = gf_strdup(victim->name);
tmp->child_up = _gf_true;
+ memcpy(tmp->volume_id, victim->graph->volume_id,
+ GF_UUID_BUF_SIZE);
list_add_tail(&tmp->status_list,
&conf->child_status->status_list);
}
@@ -1402,10 +1487,8 @@ server_process_child_event(xlator_t *this, int32_t event, void *data,
}
if (!tmp->name)
- gf_msg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
- "No xlator %s is found in "
- "child status list",
- victim->name);
+ gf_smsg(this->name, GF_LOG_ERROR, 0, PS_MSG_CHILD_STATUS_FAILED,
+ "name=%s", victim->name, NULL);
}
list_for_each_entry(xprt, &conf->xprt_list, list)
{
@@ -1440,6 +1523,7 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
glusterfs_ctx_t *ctx = NULL;
gf_boolean_t xprt_found = _gf_false;
uint64_t totxprt = 0;
+ uint64_t totdisconnect = 0;
GF_VALIDATE_OR_GOTO(THIS->name, this, out);
conf = this->private;
@@ -1453,9 +1537,8 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
ret = server_process_event_upcall(this, data);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_event_upcall failed");
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_EVENT_UPCALL_FAILED, NULL);
goto out;
}
break;
@@ -1474,9 +1557,8 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
ret = server_process_child_event(this, event, data,
GF_CBK_CHILD_UP);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_child_event failed");
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_CHILD_EVENT_FAILED, NULL);
goto out;
}
default_notify(this, event, data);
@@ -1484,12 +1566,17 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
}
case GF_EVENT_CHILD_DOWN: {
+ if (victim->cleanup_starting) {
+ victim->notify_down = 1;
+ gf_log(this->name, GF_LOG_INFO,
+ "Getting CHILD_DOWN event for brick %s", victim->name);
+ }
+
ret = server_process_child_event(this, event, data,
GF_CBK_CHILD_DOWN);
if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
- PS_MSG_SERVER_EVENT_UPCALL_FAILED,
- "server_process_child_event failed");
+ gf_smsg(this->name, GF_LOG_ERROR, 0,
+ PS_MSG_SERVER_CHILD_EVENT_FAILED, NULL);
goto out;
}
default_notify(this, event, data);
@@ -1507,6 +1594,10 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
if (!xprt->xl_private) {
continue;
}
+
+ if (GF_ATOMIC_GET(xprt->disconnect_progress))
+ continue;
+
if (xprt->xl_private->bound_xl == data) {
totxprt++;
}
@@ -1517,7 +1608,7 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
{
if (strcmp(tmp->name, victim->name) == 0) {
tmp->child_up = _gf_false;
- GF_ATOMIC_INIT(tmp->xprtrefcnt, totxprt);
+ GF_ATOMIC_INIT(victim->xprtrefcnt, totxprt);
break;
}
}
@@ -1533,14 +1624,22 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
if (!xprt->xl_private) {
continue;
}
+
+ if (GF_ATOMIC_GET(xprt->disconnect_progress))
+ continue;
+
if (xprt->xl_private->bound_xl == data) {
gf_log(this->name, GF_LOG_INFO, "disconnecting %s",
xprt->peerinfo.identifier);
xprt_found = _gf_true;
+ totdisconnect++;
rpc_transport_disconnect(xprt, _gf_false);
}
}
+ if (totxprt > totdisconnect)
+ GF_ATOMIC_SUB(victim->xprtrefcnt, (totxprt - totdisconnect));
+
pthread_mutex_unlock(&conf->mutex);
if (this->ctx->active) {
top = this->ctx->active->first;
@@ -1561,8 +1660,7 @@ server_notify(xlator_t *this, int32_t event, void *data, ...)
rpc_clnt_mgmt_pmap_signout(ctx, victim->name);
if (!xprt_found && victim_found) {
- xlator_mem_cleanup(victim);
- rpcsvc_autoscale_threads(ctx, conf->rpc, -1);
+ server_call_xlator_mem_cleanup(this, victim->name);
}
}
break;
@@ -1613,7 +1711,7 @@ struct volume_options server_options[] = {
.type = GF_OPTION_TYPE_TIME,
.min = 0,
.max = 1013,
- .default_value = "42", /* default like network.ping-timeout */
+ .default_value = TOSTRING(GF_NETWORK_TIMEOUT),
},
{
.key = {"transport.*"},
@@ -1647,13 +1745,22 @@ struct volume_options server_options[] = {
"as user bin or group staff.",
.op_version = {2},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
+ {.key = {"all-squash"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ .description = "Map requests from any uid/gid to the anonymous "
+ "uid/gid. Note that this does not apply to any other "
+ "uids or gids that might be equally sensitive, such "
+ "as user bin or group staff.",
+ .op_version = {GD_OP_VERSION_6_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
{.key = {"anonuid"},
.type = GF_OPTION_TYPE_INT,
.default_value = "65534", /* RPC_NOBODY_UID */
.min = 0,
.max = (uint32_t)-1,
.description = "value of the uid used for the anonymous "
- "user/nfsnobody when root-squash is enabled.",
+ "user/nfsnobody when root-squash/all-squash is enabled.",
.op_version = {3},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
{.key = {"anongid"},
@@ -1662,7 +1769,7 @@ struct volume_options server_options[] = {
.min = 0,
.max = (uint32_t)-1,
.description = "value of the gid used for the anonymous "
- "user/nfsnobody when root-squash is enabled.",
+ "user/nfsnobody when root-squash/all-squash is enabled.",
.op_version = {3},
.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC},
{.key = {"statedump-path"},
@@ -1739,7 +1846,7 @@ struct volume_options server_options[] = {
.type = GF_OPTION_TYPE_INT,
.min = 1,
.max = 1024,
- .default_value = "1",
+ .default_value = "2",
.description = "Specifies the number of event threads to execute "
"in parallel. Larger values would help process"
" responses faster, depending on available processing"
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index e6064af076e..821290b62d8 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -13,17 +13,17 @@
#include <pthread.h>
-#include "fd.h"
+#include <glusterfs/fd.h>
#include "rpcsvc.h"
-#include "fd.h"
+#include <glusterfs/fd.h>
#include "protocol-common.h"
#include "server-mem-types.h"
#include "glusterfs3.h"
-#include "timer.h"
-#include "client_t.h"
-#include "gidcache.h"
-#include "defaults.h"
+#include <glusterfs/timer.h>
+#include <glusterfs/client_t.h>
+#include <glusterfs/gidcache.h>
+#include <glusterfs/defaults.h>
#include "authenticate.h"
#define DEFAULT_BLOCK_SIZE 4194304 /* 4MB */
@@ -31,55 +31,6 @@
#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB)
#define GF_MIN_SOCKET_WINDOW_SIZE (0)
-#define CPD_REQ_FIELD(v, f) ((v)->compound_req_u.compound_##f##_req)
-#define CPD_RSP_FIELD(v, f) ((v)->compound_rsp_u.compound_##f##_rsp)
-
-#define SERVER_COMMON_RSP_CLEANUP(rsp, fop, i) \
- do { \
- compound_rsp *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gf_common_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \
- \
- GF_FREE(_this_rsp->xdata.xdata_val); \
- } while (0)
-
-#define SERVER_FOP_RSP_CLEANUP(rsp, fop, i) \
- do { \
- compound_rsp *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD(this_rsp, fop); \
- \
- GF_FREE(_this_rsp->xdata.xdata_val); \
- } while (0)
-
-#define SERVER_COMPOUND_FOP_CLEANUP(curr_req, fop) \
- do { \
- gfs3_##fop##_req *_req = &CPD_REQ_FIELD(curr_req, fop); \
- \
- free(_req->xdata.xdata_val); \
- } while (0)
-
-#define CPD4_REQ_FIELD(v, f) ((v)->compound_req_v2_u.compound_##f##_req)
-#define CPD4_RSP_FIELD(v, f) ((v)->compound_rsp_v2_u.compound_##f##_rsp)
-
-#define SERVER4_COMMON_RSP_CLEANUP(rsp, fop, i) \
- do { \
- compound_rsp_v2 *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gfx_common_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \
- \
- GF_FREE(_this_rsp->xdata.pairs.pairs_val); \
- } while (0)
-
-#define SERVER4_FOP_RSP_CLEANUP(rsp, fop, i, rsp_type) \
- do { \
- compound_rsp_v2 *this_rsp = NULL; \
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i]; \
- gfx_##rsp_type##_rsp *_this_rsp = &CPD4_RSP_FIELD(this_rsp, fop); \
- \
- GF_FREE(_this_rsp->xdata.pairs.pairs_val); \
- } while (0)
-
typedef enum {
INTERNAL_LOCKS = 1,
POSIX_LOCKS = 2,
@@ -99,8 +50,8 @@ struct _volfile_ctx {
struct _child_status {
struct list_head status_list;
char *name;
+ char volume_id[GF_UUID_BUF_SIZE];
gf_boolean_t child_up;
- gf_atomic_t xprtrefcnt;
};
struct server_conf {
rpcsvc_t *rpc;
@@ -181,7 +132,12 @@ struct _server_state {
struct iatt stbuf;
int valid;
+ /*
+ * this fd is used in all the fd based operations PLUS
+ * as a source fd in copy_file_range
+ */
fd_t *fd;
+ fd_t *fd_out; /* destination fd in copy_file_range */
dict_t *params;
int32_t flags;
int wbflags;
@@ -192,6 +148,15 @@ struct _server_state {
size_t size;
off_t offset;
+ /*
+ * According to the man page of copy_file_range,
+ * the offsets for source and destination file
+ * are of type loff_t. But the type loff_t is
+ * linux specific and is actual a typedef of
+ * off64_t.
+ */
+ off64_t off_in; /* source offset in copy_file_range */
+ off64_t off_out; /* destination offset in copy_file_range */
mode_t mode;
dev_t dev;
size_t nr_count;
@@ -212,21 +177,11 @@ struct _server_state {
mode_t umask;
struct gf_lease lease;
lock_migration_info_t locklist;
- /* required for compound fops */
- gfs3_compound_req req;
- /* TODO: having xdr definition here
- is not a good idea, but not taking
- up the functionality right now */
- gfx_compound_req req_v2;
-
- /* last length till which iovec for compound
- * writes was processed */
- int write_length;
+
struct iovec rsp_vector[MAX_IOVEC];
int rsp_count;
struct iobuf *rsp_iobuf;
struct iobref *rsp_iobref;
- compound_args_t *args;
/* subdir mount */
client_t *client;
@@ -241,6 +196,11 @@ typedef struct _server_ctx {
fdtable_t *fdtable;
} server_ctx_t;
+typedef struct server_cleanup_xprt_arg {
+ xlator_t *this;
+ char *victim_name;
+} server_cleanup_xprt_arg_t;
+
int
server_submit_reply(call_frame_t *frame, rpcsvc_request_t *req, void *arg,
struct iovec *payload, int payloadcount,
@@ -254,6 +214,9 @@ gf_server_check_getxattr_cmd(call_frame_t *frame, const char *name);
void
forget_inode_if_no_dentry(inode_t *inode);
+void *
+server_graph_janitor_threads(void *);
+
server_ctx_t *
server_ctx_get(client_t *client, xlator_t *xlator);
#endif /* !_SERVER_H */