summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client-callback.c447
-rw-r--r--xlators/protocol/client/src/client-common.c4530
-rw-r--r--xlators/protocol/client/src/client-handshake.c2809
-rw-r--r--xlators/protocol/client/src/client-helpers.c5463
-rw-r--r--xlators/protocol/client/src/client-lk.c701
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c10503
-rw-r--r--xlators/protocol/client/src/client-rpc-fops_v2.c10469
-rw-r--r--xlators/protocol/client/src/client.c4377
8 files changed, 19598 insertions, 19701 deletions
diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c
index b2f9a22..352a113 100644
--- a/xlators/protocol/client/src/client-callback.c
+++ b/xlators/protocol/client/src/client-callback.c
@@ -14,277 +14,312 @@
#include "client-messages.h"
int
-client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_null(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_fetchspec(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_ino_flush(struct rpc_clnt *rpc, void *mydata, void *data)
{
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
- "this function should not be called");
- return 0;
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
+ "this function should not be called");
+ return 0;
}
int
-client_cbk_recall_lease (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_recall_lease(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_recall_lease rl_data = {0,};
- gfs3_recall_lease_req recall_lease = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &recall_lease,
- (xdrproc_t)xdr_gfs3_recall_lease_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_RECALL_LEASE_FAIL,
- "XDR decode of recall lease failed.");
- goto out;
- }
-
- upcall_data.data = &rl_data;
- ret = gf_proto_recall_lease_to_upcall (&recall_lease, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_RECALL_LEASE;
-
- gf_msg_trace (THIS->name, 0, "Upcall gfid = %s, ret = %d",
- recall_lease.gfid, ret);
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_recall_lease rl_data = {
+ 0,
+ };
+ gfs3_recall_lease_req recall_lease = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &recall_lease,
+ (xdrproc_t)xdr_gfs3_recall_lease_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_RECALL_LEASE_FAIL,
+ "XDR decode of recall lease failed.");
+ goto out;
+ }
+
+ upcall_data.data = &rl_data;
+ ret = gf_proto_recall_lease_to_upcall(&recall_lease, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_RECALL_LEASE;
+
+ gf_msg_trace(THIS->name, 0, "Upcall gfid = %s, ret = %d", recall_lease.gfid,
+ ret);
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (recall_lease.xdata.xdata_val)
- free (recall_lease.xdata.xdata_val);
+ if (recall_lease.xdata.xdata_val)
+ free(recall_lease.xdata.xdata_val);
- if (rl_data.dict)
- dict_unref (rl_data.dict);
+ if (rl_data.dict)
+ dict_unref(rl_data.dict);
- return ret;
+ return ret;
}
-
int
-client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_cache_invalidation(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_cache_invalidation ca_data = {0,};
- gfs3_cbk_cache_invalidation_req ca_req = {0,};
-
- gf_msg_trace (THIS->name, 0, "Upcall callback is called");
-
- if (!rpc || !mydata || !data)
- goto out;
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &ca_req,
- (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_CACHE_INVALIDATION_FAIL,
- "XDR decode of cache_invalidation failed.");
- goto out;
- }
-
- upcall_data.data = &ca_data;
- ret = gf_proto_cache_invalidation_to_upcall (THIS, &ca_req,
- &upcall_data);
- if (ret < 0)
- goto out;
-
- gf_msg_trace (THIS->name, 0, "Cache invalidation cbk received for gfid:"
- " %s, ret = %d", ca_req.gfid, ret);
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_cache_invalidation ca_data = {
+ 0,
+ };
+ gfs3_cbk_cache_invalidation_req ca_req = {
+ 0,
+ };
+
+ gf_msg_trace(THIS->name, 0, "Upcall callback is called");
+
+ if (!rpc || !mydata || !data)
+ goto out;
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &ca_req,
+ (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_CACHE_INVALIDATION_FAIL,
+ "XDR decode of cache_invalidation failed.");
+ goto out;
+ }
+
+ upcall_data.data = &ca_data;
+ ret = gf_proto_cache_invalidation_to_upcall(THIS, &ca_req, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ gf_msg_trace(THIS->name, 0,
+ "Cache invalidation cbk received for gfid:"
+ " %s, ret = %d",
+ ca_req.gfid, ret);
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (ca_req.gfid)
- free (ca_req.gfid);
+ if (ca_req.gfid)
+ free(ca_req.gfid);
- if (ca_req.xdata.xdata_val)
- free (ca_req.xdata.xdata_val);
+ if (ca_req.xdata.xdata_val)
+ free(ca_req.xdata.xdata_val);
- if (ca_data.dict)
- dict_unref (ca_data.dict);
+ if (ca_data.dict)
+ dict_unref(ca_data.dict);
- return 0;
+ return 0;
}
int
-client_cbk_child_up (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_child_up(struct rpc_clnt *rpc, void *mydata, void *data)
{
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, rpc, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, rpc, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- gf_msg_debug (this->name, 0, "Received CHILD_UP");
- conf->child_up = _gf_true;
+ gf_msg_debug(this->name, 0, "Received CHILD_UP");
+ conf->child_up = _gf_true;
- this->notify (this, GF_EVENT_CHILD_UP, NULL);
+ this->notify(this, GF_EVENT_CHILD_UP, NULL);
out:
- return 0;
+ return 0;
}
int
-client_cbk_child_down (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_child_down(struct rpc_clnt *rpc, void *mydata, void *data)
{
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
- this = THIS;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, rpc, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ this = THIS;
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, rpc, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- gf_msg_debug (this->name, 0, "Received CHILD_DOWN");
- conf->child_up = _gf_false;
+ gf_msg_debug(this->name, 0, "Received CHILD_DOWN");
+ conf->child_up = _gf_false;
- this->notify (this, GF_EVENT_CHILD_DOWN, NULL);
+ this->notify(this, GF_EVENT_CHILD_DOWN, NULL);
out:
- return 0;
+ return 0;
}
int
-client_cbk_inodelk_contention (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_inodelk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_inodelk_contention lc = {{0,},};
- gfs4_inodelk_contention_req proto_lc = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &proto_lc,
- (xdrproc_t)xdr_gfs4_inodelk_contention_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_INODELK_CONTENTION_FAIL,
- "XDR decode of inodelk contention failed.");
- goto out;
- }
-
- upcall_data.data = &lc;
- ret = gf_proto_inodelk_contention_to_upcall (&proto_lc, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_INODELK_CONTENTION;
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_inodelk_contention lc = {
+ {
+ 0,
+ },
+ };
+ gfs4_inodelk_contention_req proto_lc = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &proto_lc,
+ (xdrproc_t)xdr_gfs4_inodelk_contention_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_INODELK_CONTENTION_FAIL,
+ "XDR decode of inodelk contention failed.");
+ goto out;
+ }
+
+ upcall_data.data = &lc;
+ ret = gf_proto_inodelk_contention_to_upcall(&proto_lc, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_INODELK_CONTENTION;
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (proto_lc.domain)
- free (proto_lc.domain);
+ if (proto_lc.domain)
+ free(proto_lc.domain);
- if (proto_lc.xdata.xdata_val)
- free (proto_lc.xdata.xdata_val);
+ if (proto_lc.xdata.xdata_val)
+ free(proto_lc.xdata.xdata_val);
- if (lc.xdata)
- dict_unref (lc.xdata);
+ if (lc.xdata)
+ dict_unref(lc.xdata);
- return ret;
+ return ret;
}
int
-client_cbk_entrylk_contention (struct rpc_clnt *rpc, void *mydata, void *data)
+client_cbk_entrylk_contention(struct rpc_clnt *rpc, void *mydata, void *data)
{
- int ret = -1;
- struct iovec *iov = NULL;
- struct gf_upcall upcall_data = {0,};
- struct gf_upcall_entrylk_contention lc = {0,};
- gfs4_entrylk_contention_req proto_lc = {{0,},};
-
- GF_VALIDATE_OR_GOTO ("client-callback", rpc, out);
- GF_VALIDATE_OR_GOTO ("client-callback", mydata, out);
- GF_VALIDATE_OR_GOTO ("client-callback", data, out);
-
- iov = (struct iovec *)data;
- ret = xdr_to_generic (*iov, &proto_lc,
- (xdrproc_t)xdr_gfs4_entrylk_contention_req);
-
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, -ret,
- PC_MSG_ENTRYLK_CONTENTION_FAIL,
- "XDR decode of entrylk contention failed.");
- goto out;
- }
-
- upcall_data.data = &lc;
- ret = gf_proto_entrylk_contention_to_upcall (&proto_lc, &upcall_data);
- if (ret < 0)
- goto out;
-
- upcall_data.event_type = GF_UPCALL_ENTRYLK_CONTENTION;
-
- default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
+ int ret = -1;
+ struct iovec *iov = NULL;
+ struct gf_upcall upcall_data = {
+ 0,
+ };
+ struct gf_upcall_entrylk_contention lc = {
+ 0,
+ };
+ gfs4_entrylk_contention_req proto_lc = {
+ {
+ 0,
+ },
+ };
+
+ GF_VALIDATE_OR_GOTO("client-callback", rpc, out);
+ GF_VALIDATE_OR_GOTO("client-callback", mydata, out);
+ GF_VALIDATE_OR_GOTO("client-callback", data, out);
+
+ iov = (struct iovec *)data;
+ ret = xdr_to_generic(*iov, &proto_lc,
+ (xdrproc_t)xdr_gfs4_entrylk_contention_req);
+
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, -ret, PC_MSG_ENTRYLK_CONTENTION_FAIL,
+ "XDR decode of entrylk contention failed.");
+ goto out;
+ }
+
+ upcall_data.data = &lc;
+ ret = gf_proto_entrylk_contention_to_upcall(&proto_lc, &upcall_data);
+ if (ret < 0)
+ goto out;
+
+ upcall_data.event_type = GF_UPCALL_ENTRYLK_CONTENTION;
+
+ default_notify(THIS, GF_EVENT_UPCALL, &upcall_data);
out:
- if (proto_lc.name)
- free (proto_lc.name);
+ if (proto_lc.name)
+ free(proto_lc.name);
- if (proto_lc.domain)
- free (proto_lc.domain);
+ if (proto_lc.domain)
+ free(proto_lc.domain);
- if (proto_lc.xdata.xdata_val)
- free (proto_lc.xdata.xdata_val);
+ if (proto_lc.xdata.xdata_val)
+ free(proto_lc.xdata.xdata_val);
- if (lc.xdata)
- dict_unref (lc.xdata);
+ if (lc.xdata)
+ dict_unref(lc.xdata);
- return ret;
+ return ret;
}
rpcclnt_cb_actor_t gluster_cbk_actors[GF_CBK_MAXVALUE] = {
- [GF_CBK_NULL] = {"NULL", GF_CBK_NULL, client_cbk_null },
- [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec },
- [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush },
- [GF_CBK_CACHE_INVALIDATION] = {"CACHE_INVALIDATION", GF_CBK_CACHE_INVALIDATION, client_cbk_cache_invalidation },
- [GF_CBK_CHILD_UP] = {"CHILD_UP", GF_CBK_CHILD_UP, client_cbk_child_up },
- [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", GF_CBK_CHILD_DOWN, client_cbk_child_down },
- [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", GF_CBK_RECALL_LEASE, client_cbk_recall_lease },
- [GF_CBK_INODELK_CONTENTION] = {"INODELK_CONTENTION", GF_CBK_INODELK_CONTENTION, client_cbk_inodelk_contention },
- [GF_CBK_ENTRYLK_CONTENTION] = {"ENTRYLK_CONTENTION", GF_CBK_ENTRYLK_CONTENTION, client_cbk_entrylk_contention },
+ [GF_CBK_NULL] = {"NULL", GF_CBK_NULL, client_cbk_null},
+ [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec},
+ [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush},
+ [GF_CBK_CACHE_INVALIDATION] = {"CACHE_INVALIDATION",
+ GF_CBK_CACHE_INVALIDATION,
+ client_cbk_cache_invalidation},
+ [GF_CBK_CHILD_UP] = {"CHILD_UP", GF_CBK_CHILD_UP, client_cbk_child_up},
+ [GF_CBK_CHILD_DOWN] = {"CHILD_DOWN", GF_CBK_CHILD_DOWN,
+ client_cbk_child_down},
+ [GF_CBK_RECALL_LEASE] = {"RECALL_LEASE", GF_CBK_RECALL_LEASE,
+ client_cbk_recall_lease},
+ [GF_CBK_INODELK_CONTENTION] = {"INODELK_CONTENTION",
+ GF_CBK_INODELK_CONTENTION,
+ client_cbk_inodelk_contention},
+ [GF_CBK_ENTRYLK_CONTENTION] = {"ENTRYLK_CONTENTION",
+ GF_CBK_ENTRYLK_CONTENTION,
+ client_cbk_entrylk_contention},
};
-
struct rpcclnt_cb_program gluster_cbk_prog = {
- .progname = "GlusterFS Callback",
- .prognum = GLUSTER_CBK_PROGRAM,
- .progver = GLUSTER_CBK_VERSION,
- .actors = gluster_cbk_actors,
- .numactors = GF_CBK_MAXVALUE,
+ .progname = "GlusterFS Callback",
+ .prognum = GLUSTER_CBK_PROGRAM,
+ .progver = GLUSTER_CBK_VERSION,
+ .actors = gluster_cbk_actors,
+ .numactors = GF_CBK_MAXVALUE,
};
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c
index c5b0322..3161551 100644
--- a/xlators/protocol/client/src/client-common.c
+++ b/xlators/protocol/client/src/client-common.c
@@ -18,3630 +18,3538 @@
/* processing to be done before fops are woudn down */
int
-client_pre_stat (xlator_t *this, gfs3_stat_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_stat(xlator_t *this, gfs3_stat_req *req, loc_t *loc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readlink (xlator_t *this, gfs3_readlink_req *req, loc_t *loc,
- size_t size, dict_t *xdata)
+client_pre_readlink(xlator_t *this, gfs3_readlink_req *req, loc_t *loc,
+ size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->size = size;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->size = size;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mknod (xlator_t *this, gfs3_mknod_req *req, loc_t *loc,
- mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
+client_pre_mknod(xlator_t *this, gfs3_mknod_req *req, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->dev = rdev;
- req->umask = umask;
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->dev = rdev;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mkdir (xlator_t *this, gfs3_mkdir_req *req, loc_t *loc,
- mode_t mode, mode_t umask, dict_t *xdata)
+client_pre_mkdir(xlator_t *this, gfs3_mkdir_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_unlink (xlator_t *this, gfs3_unlink_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_unlink(xlator_t *this, gfs3_unlink_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rmdir (xlator_t *this, gfs3_rmdir_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_rmdir(xlator_t *this, gfs3_rmdir_req *req, loc_t *loc, int32_t flags,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_symlink (xlator_t *this, gfs3_symlink_req *req, loc_t *loc,
- const char *linkname, mode_t umask, dict_t *xdata)
+client_pre_symlink(xlator_t *this, gfs3_symlink_req *req, loc_t *loc,
+ const char *linkname, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->linkname = (char *)linkname;
- req->bname = (char *)loc->name;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->linkname = (char *)linkname;
+ req->bname = (char *)loc->name;
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rename (xlator_t *this, gfs3_rename_req *req, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_pre_rename(xlator_t *this, gfs3_rename_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && newloc && oldloc->parent &&
- newloc->parent))
- goto out;
+ if (!(oldloc && newloc && oldloc->parent && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->parent->gfid))
- memcpy (req->oldgfid, oldloc->parent->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->pargfid, 16);
+ if (!gf_uuid_is_null(oldloc->parent->gfid))
+ memcpy(req->oldgfid, oldloc->parent->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->pargfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->oldbname = (char *)oldloc->name;
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->oldbname = (char *)oldloc->name;
+ req->newbname = (char *)newloc->name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_link (xlator_t *this,
- gfs3_link_req *req, loc_t *oldloc, loc_t *newloc,
- dict_t *xdata)
+client_pre_link(xlator_t *this, gfs3_link_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && oldloc->inode && newloc &&
- newloc->parent))
- goto out;
+ if (!(oldloc && oldloc->inode && newloc && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->inode->gfid))
- memcpy (req->oldgfid, oldloc->inode->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->gfid, 16);
+ if (!gf_uuid_is_null(oldloc->inode->gfid))
+ memcpy(req->oldgfid, oldloc->inode->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->gfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->newbname = (char *)newloc->name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_truncate (xlator_t *this, gfs3_truncate_req *req,
- loc_t *loc, off_t offset, dict_t *xdata)
+client_pre_truncate(xlator_t *this, gfs3_truncate_req *req, loc_t *loc,
+ off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->offset = offset;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_open (xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_open(xlator_t *this, gfs3_open_req *req, loc_t *loc, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->flags = gf_flags_from_flags (flags);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->flags = gf_flags_from_flags(flags);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readv (xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size,
- off_t offset, int32_t flags, dict_t *xdata)
+client_pre_readv(xlator_t *this, gfs3_read_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_writev (xlator_t *this, gfs3_write_req *req,
- fd_t *fd, size_t size, off_t offset, int32_t flags,
- dict_t **xdata)
+client_pre_writev(xlator_t *this, gfs3_write_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t **xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
#ifdef GF_TESTING_IO_XDATA
- if (!*xdata)
- *xdata = dict_new ();
+ if (!*xdata)
+ *xdata = dict_new();
- ret = dict_set_str (*xdata, "testing-the-xdata-key",
- "testing-the-xdata-value");
+ ret = dict_set_str(*xdata, "testing-the-xdata-key",
+ "testing-the-xdata-value");
#endif
- GF_PROTOCOL_DICT_SERIALIZE (this, *xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, *xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_statfs (xlator_t *this, gfs3_statfs_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_statfs(xlator_t *this, gfs3_statfs_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc)
- goto out;
+ if (!loc)
+ goto out;
- if (loc->inode) {
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
- } else {
- req->gfid[15] = 1;
- }
+ if (loc->inode) {
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
+ } else {
+ req->gfid[15] = 1;
+ }
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_flush (xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata)
+client_pre_flush(xlator_t *this, gfs3_flush_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsync (xlator_t *this, gfs3_fsync_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsync(xlator_t *this, gfs3_fsync_req *req, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = 0;
+ int64_t remote_fd = -1;
+ int op_errno = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setxattr (xlator_t *this, gfs3_setxattr_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_setxattr(xlator_t *this, gfs3_setxattr_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- req->flags = flags;
+ req->flags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_getxattr (xlator_t *this, gfs3_getxattr_req *req, loc_t *loc,
- const char *name, dict_t *xdata)
+client_pre_getxattr(xlator_t *this, gfs3_getxattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc) {
- op_errno = EINVAL;
- goto out;
- }
+ if (!loc) {
+ op_errno = EINVAL;
+ goto out;
+ }
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->namelen = 1; /* Use it as a flag */
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->namelen = 1; /* Use it as a flag */
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_removexattr (xlator_t *this, gfs3_removexattr_req *req,
- loc_t *loc, const char *name, dict_t *xdata)
+client_pre_removexattr(xlator_t *this, gfs3_removexattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->name = (char *)name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->name = (char *)name;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_opendir (xlator_t *this,
- gfs3_opendir_req *req, loc_t *loc,
- fd_t *fd, dict_t *xdata)
+client_pre_opendir(xlator_t *this, gfs3_opendir_req *req, loc_t *loc, fd_t *fd,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsyncdir (xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsyncdir(xlator_t *this, gfs3_fsyncdir_req *req, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int32_t op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int32_t op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_access (xlator_t *this, gfs3_access_req *req, loc_t *loc,
- int32_t mask, dict_t *xdata)
+client_pre_access(xlator_t *this, gfs3_access_req *req, loc_t *loc,
+ int32_t mask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->mask = mask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->mask = mask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_create (xlator_t *this, gfs3_create_req *req,
- loc_t *loc, fd_t *fd, mode_t mode,
- int32_t flags, mode_t umask, dict_t *xdata)
+client_pre_create(xlator_t *this, gfs3_create_req *req, loc_t *loc, fd_t *fd,
+ mode_t mode, int32_t flags, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->flags = gf_flags_from_flags (flags);
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->flags = gf_flags_from_flags(flags);
+ req->umask = umask;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ftruncate (xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd,
- off_t offset, dict_t *xdata)
+client_pre_ftruncate(xlator_t *this, gfs3_ftruncate_req *req, fd_t *fd,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = EINVAL;
+ int64_t remote_fd = -1;
+ int op_errno = EINVAL;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fstat (xlator_t *this, gfs3_fstat_req *req, fd_t *fd,
- dict_t *xdata)
+client_pre_fstat(xlator_t *this, gfs3_fstat_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lk (xlator_t *this, gfs3_lk_req *req,
- int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata)
+client_pre_lk(xlator_t *this, gfs3_lk_req *req, int32_t cmd,
+ struct gf_flock *flock, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
- int ret = 0;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
+ int ret = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- ret = client_cmd_to_gf_cmd (cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
+ ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
- switch (flock->l_type) {
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lookup (xlator_t *this, gfs3_lookup_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_lookup(xlator_t *this, gfs3_lookup_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if ((loc->parent) && (!gf_uuid_is_null (loc->parent->gfid)))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- if ((loc->inode) && (!gf_uuid_is_null (loc->inode->gfid)))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if ((loc->parent) && (!gf_uuid_is_null(loc->parent->gfid)))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ if ((loc->inode) && (!gf_uuid_is_null(loc->inode->gfid)))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- if (loc->name)
- req->bname = (char *)loc->name;
- else
- req->bname = "";
+ if (loc->name)
+ req->bname = (char *)loc->name;
+ else
+ req->bname = "";
- if (xdata) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata,
- (&req->xdata.xdata_val),
- req->xdata.xdata_len,
- op_errno, out);
- }
- return 0;
+ if (xdata) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ }
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdir (xlator_t *this, gfs3_readdir_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdir(xlator_t *this, gfs3_readdir_req *req, fd_t *fd, size_t size,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_inodelk (xlator_t *this, gfs3_inodelk_req *req, loc_t *loc,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_inodelk(xlator_t *this, gfs3_inodelk_req *req, loc_t *loc, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- op_errno = EINVAL;
- goto out;
- }
-
- switch (flock->l_type) {
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->volume = (char *)volume;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_finodelk (xlator_t *this, gfs3_finodelk_req *req, fd_t *fd,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_finodelk(xlator_t *this, gfs3_finodelk_req *req, fd_t *fd, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
- int32_t gf_type = 0;
- int32_t gf_cmd = 0;
-
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
-
- switch (flock->l_type) {
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int32_t gf_type = 0;
+ int32_t gf_cmd = 0;
+
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->volume = (char *)volume;
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_entrylk (xlator_t *this, gfs3_entrylk_req *req, loc_t *loc,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_entrylk(xlator_t *this, gfs3_entrylk_req *req, loc_t *loc,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fentrylk (xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_fentrylk(xlator_t *this, gfs3_fentrylk_req *req, fd_t *fd,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_xattrop (xlator_t *this, gfs3_xattrop_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_xattrop(xlator_t *this, gfs3_xattrop_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- req->flags = flags;
+ req->flags = flags;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fxattrop (xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd,
+client_pre_fxattrop(xlator_t *this, gfs3_fxattrop_req *req, fd_t *fd,
dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fgetxattr (xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fgetxattr(xlator_t *this, gfs3_fgetxattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->namelen = 1; /* Use it as a flag */
- req->fd = remote_fd;
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->namelen = 1; /* Use it as a flag */
+ req->fd = remote_fd;
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetxattr (xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd,
- int32_t flags, dict_t *xattr, dict_t *xdata)
+client_pre_fsetxattr(xlator_t *this, gfs3_fsetxattr_req *req, fd_t *fd,
+ int32_t flags, dict_t *xattr, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- GF_PROTOCOL_DICT_SERIALIZE (this, xattr,
- (&req->dict.dict_val),
- req->dict.dict_len,
- op_errno, out);
- }
+ if (xattr) {
+ GF_PROTOCOL_DICT_SERIALIZE(this, xattr, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
+ }
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rchecksum (xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd,
- int32_t len, off_t offset, dict_t *xdata)
+client_pre_rchecksum(xlator_t *this, gfs3_rchecksum_req *req, fd_t *fd,
+ int32_t len, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->len = len;
- req->offset = offset;
- req->fd = remote_fd;
+ req->len = len;
+ req->offset = offset;
+ req->fd = remote_fd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setattr (xlator_t *this, gfs3_setattr_req *req, loc_t *loc,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_setattr(xlator_t *this, gfs3_setattr_req *req, loc_t *loc,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- return -op_errno;
+ if (!(loc && loc->inode))
+ return -op_errno;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- req->valid = valid;
- gf_stat_from_iatt (&req->stbuf, stbuf);
+ req->valid = valid;
+ gf_stat_from_iatt(&req->stbuf, stbuf);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetattr (xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_fsetattr(xlator_t *this, gfs3_fsetattr_req *req, fd_t *fd,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->valid = valid;
- gf_stat_from_iatt (&req->stbuf, stbuf);
+ req->fd = remote_fd;
+ req->valid = valid;
+ gf_stat_from_iatt(&req->stbuf, stbuf);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdirp (xlator_t *this, gfs3_readdirp_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdirp(xlator_t *this, gfs3_readdirp_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- /* dict itself is 'xdata' here */
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->dict.dict_val),
- req->dict.dict_len, op_errno, out);
+ /* dict itself is 'xdata' here */
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->dict.dict_val),
+ req->dict.dict_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fremovexattr (xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fremovexattr(xlator_t *this, gfs3_fremovexattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- if (!(fd && fd->inode))
- goto out;
+ if (!(fd && fd->inode))
+ goto out;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->name = (char *)name;
- req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->name = (char *)name;
+ req->fd = remote_fd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fallocate (xlator_t *this, gfs3_fallocate_req *req, fd_t *fd,
- int32_t flags, off_t offset, size_t size, dict_t *xdata)
+client_pre_fallocate(xlator_t *this, gfs3_fallocate_req *req, fd_t *fd,
+ int32_t flags, off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_discard (xlator_t *this, gfs3_discard_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_discard(xlator_t *this, gfs3_discard_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_zerofill (xlator_t *this, gfs3_zerofill_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_zerofill(xlator_t *this, gfs3_zerofill_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ipc (xlator_t *this, gfs3_ipc_req *req, int32_t cmd,
- dict_t *xdata)
+client_pre_ipc(xlator_t *this, gfs3_ipc_req *req, int32_t cmd, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- req->op = cmd;
+ req->op = cmd;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
- return 0;
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_seek (xlator_t *this, gfs3_seek_req *req, fd_t *fd,
- off_t offset, gf_seek_what_t what, dict_t *xdata)
+client_pre_seek(xlator_t *this, gfs3_seek_req *req, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->offset = offset;
- req->what = what;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->what = what;
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lease (xlator_t *this, gfs3_lease_req *req, loc_t *loc,
- struct gf_lease *lease, dict_t *xdata)
+client_pre_lease(xlator_t *this, gfs3_lease_req *req, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- gf_proto_lease_from_lease (&req->lease, lease);
+ gf_proto_lease_from_lease(&req->lease, lease);
- GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&req->xdata.xdata_val),
- req->xdata.xdata_len, op_errno, out);
+ GF_PROTOCOL_DICT_SERIALIZE(this, xdata, (&req->xdata.xdata_val),
+ req->xdata.xdata_len, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
/* processing done after fop responses are obtained */
int
-client_post_stat (xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt,
- dict_t **xdata)
+client_post_stat(xlator_t *this, gfs3_stat_rsp *rsp, struct iatt *iatt,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, iatt);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readlink (xlator_t *this, gfs3_readlink_rsp *rsp,
- struct iatt *iatt, dict_t **xdata)
+client_post_readlink(xlator_t *this, gfs3_readlink_rsp *rsp, struct iatt *iatt,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->buf, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->buf, iatt);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_mknod (xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_mknod(xlator_t *this, gfs3_mknod_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_mkdir (xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_mkdir(xlator_t *this, gfs3_mkdir_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_unlink (xlator_t *this, gfs3_unlink_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_unlink(xlator_t *this, gfs3_unlink_rsp *rsp, struct iatt *preparent,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_rmdir (xlator_t *this, gfs3_rmdir_rsp *rsp,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_rmdir(xlator_t *this, gfs3_rmdir_rsp *rsp, struct iatt *preparent,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_symlink (xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_symlink(xlator_t *this, gfs3_symlink_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_rename (xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf,
+client_post_rename(xlator_t *this, gfs3_rename_rsp *rsp, struct iatt *stbuf,
struct iatt *preoldparent, struct iatt *postoldparent,
struct iatt *prenewparent, struct iatt *postnewparent,
dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preoldparent, preoldparent);
- gf_stat_to_iatt (&rsp->postoldparent, postoldparent);
+ gf_stat_to_iatt(&rsp->preoldparent, preoldparent);
+ gf_stat_to_iatt(&rsp->postoldparent, postoldparent);
- gf_stat_to_iatt (&rsp->prenewparent, prenewparent);
- gf_stat_to_iatt (&rsp->postnewparent, postnewparent);
- }
+ gf_stat_to_iatt(&rsp->prenewparent, prenewparent);
+ gf_stat_to_iatt(&rsp->postnewparent, postnewparent);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_link (xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t **xdata)
+client_post_link(xlator_t *this, gfs3_link_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_truncate (xlator_t *this, gfs3_truncate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_truncate(xlator_t *this, gfs3_truncate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_open (xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata)
+client_post_open(xlator_t *this, gfs3_open_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readv (xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref,
- struct iobref *rsp_iobref, struct iatt *stat,
- struct iovec *vector, struct iovec *rsp_vector,
- int *rspcount, dict_t **xdata)
+client_post_readv(xlator_t *this, gfs3_read_rsp *rsp, struct iobref **iobref,
+ struct iobref *rsp_iobref, struct iatt *stat,
+ struct iovec *vector, struct iovec *rsp_vector, int *rspcount,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret != -1) {
- *iobref = rsp_iobref;
- gf_stat_to_iatt (&rsp->stat, stat);
+ if (rsp->op_ret != -1) {
+ *iobref = rsp_iobref;
+ gf_stat_to_iatt(&rsp->stat, stat);
- vector[0].iov_len = rsp->op_ret;
- if (rsp->op_ret > 0)
- vector[0].iov_base = rsp_vector->iov_base;
- *rspcount = 1;
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ vector[0].iov_len = rsp->op_ret;
+ if (rsp->op_ret > 0)
+ vector[0].iov_base = rsp_vector->iov_base;
+ *rspcount = 1;
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (xdata);
+ dict_dump_to_log(xdata);
#endif
out:
- return ret;
+ return ret;
}
int
-client_post_writev (xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat,
- struct iatt *poststat, dict_t **xdata)
+client_post_writev(xlator_t *this, gfs3_write_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_statfs (xlator_t *this, gfs3_statfs_rsp *rsp,
- struct statvfs *statfs, dict_t **xdata)
+client_post_statfs(xlator_t *this, gfs3_statfs_rsp *rsp, struct statvfs *statfs,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_statfs_to_statfs (&rsp->statfs, statfs);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_statfs_to_statfs(&rsp->statfs, statfs);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_flush (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_flush(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsync (xlator_t *this, gfs3_fsync_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fsync(xlator_t *this, gfs3_fsync_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_setxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_setxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_getxattr (xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_getxattr(xlator_t *this, gfs3_getxattr_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_removexattr (xlator_t *this, gf_common_rsp *rsp,
- dict_t **xdata)
+client_post_removexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_opendir (xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata)
+client_post_opendir(xlator_t *this, gfs3_opendir_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsyncdir (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fsyncdir(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_access (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_access(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_create (xlator_t *this, gfs3_create_rsp *rsp,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent,
- clnt_local_t *local, dict_t **xdata)
+client_post_create(xlator_t *this, gfs3_create_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ clnt_local_t *local, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stbuf);
- gf_stat_to_iatt (&rsp->preparent, preparent);
- gf_stat_to_iatt (&rsp->postparent, postparent);
- gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ gf_stat_to_iatt(&rsp->preparent, preparent);
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ gf_uuid_copy(local->loc.gfid, stbuf->ia_gfid);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_ftruncate (xlator_t *this, gfs3_ftruncate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_ftruncate(xlator_t *this, gfs3_ftruncate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->prestat, prestat);
- gf_stat_to_iatt (&rsp->poststat, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->prestat, prestat);
+ gf_stat_to_iatt(&rsp->poststat, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fstat (xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat,
- dict_t **xdata)
+client_post_fstat(xlator_t *this, gfs3_fstat_rsp *rsp, struct iatt *stat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->stat, stat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->stat, stat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return -ret;
+ return -ret;
}
int
-client_post_lk (xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock,
- dict_t **xdata)
+client_post_lk(xlator_t *this, gfs3_lk_rsp *rsp, struct gf_flock *lock,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret >= 0) {
- gf_proto_flock_to_flock (&rsp->flock, lock);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (rsp->op_ret >= 0) {
+ gf_proto_flock_to_flock(&rsp->flock, lock);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_lookup (xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
- struct iatt *postparent, dict_t **xdata)
+client_post_lookup(xlator_t *this, gfs3_lookup_rsp *rsp, struct iatt *stbuf,
+ struct iatt *postparent, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->postparent, postparent);
- gf_stat_to_iatt (&rsp->stat, stbuf);
- }
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->postparent, postparent);
+ gf_stat_to_iatt(&rsp->stat, stbuf);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readdir (xlator_t *this, gfs3_readdir_rsp *rsp,
- gf_dirent_t *entries, dict_t **xdata)
+client_post_readdir(xlator_t *this, gfs3_readdir_rsp *rsp, gf_dirent_t *entries,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret > 0) {
- unserialize_rsp_dirent (this, rsp, entries);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_dirent(this, rsp, entries);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_inodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_inodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_finodelk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_finodelk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_entrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_entrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fentrylk (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fentrylk(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_xattrop (xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_xattrop(xlator_t *this, gfs3_xattrop_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fxattrop (xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_fxattrop(xlator_t *this, gfs3_fxattrop_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fgetxattr (xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict,
+client_post_fgetxattr(xlator_t *this, gfs3_fgetxattr_rsp *rsp, dict_t **dict,
dict_t **xdata)
{
- int op_errno = 0;
- int ret = 0;
+ int op_errno = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *dict,
- (rsp->dict.dict_val),
- (rsp->dict.dict_len), rsp->op_ret,
- op_errno, out);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- op_errno, out);
+ if (-1 != rsp->op_ret) {
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *dict, (rsp->dict.dict_val),
+ (rsp->dict.dict_len), rsp->op_ret,
+ op_errno, out);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, op_errno, out);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_fsetxattr (xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
+client_post_fsetxattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_rchecksum (xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata)
+client_post_rchecksum(xlator_t *this, gfs3_rchecksum_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_setattr (xlator_t *this, gfs3_setattr_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_setattr(xlator_t *this, gfs3_setattr_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fsetattr (xlator_t *this, gfs3_fsetattr_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fsetattr(xlator_t *this, gfs3_fsetattr_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_readdirp (xlator_t *this, gfs3_readdirp_rsp *rsp,
- fd_t *fd, gf_dirent_t *entries,
- dict_t **xdata)
+client_post_readdirp(xlator_t *this, gfs3_readdirp_rsp *rsp, fd_t *fd,
+ gf_dirent_t *entries, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret > 0) {
- unserialize_rsp_direntp (this, fd, rsp, entries);
- }
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_direntp(this, fd, rsp, entries);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_fremovexattr (xlator_t *this, gf_common_rsp *rsp,
- dict_t **xdata)
+client_post_fremovexattr(xlator_t *this, gf_common_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
- ret = gf_replace_new_iatt_in_dict (*xdata);
+ ret = gf_replace_new_iatt_in_dict(*xdata);
out:
- return ret;
+ return ret;
}
int
-client_post_fallocate (xlator_t *this, gfs3_fallocate_rsp *rsp,
- struct iatt *prestat, struct iatt *poststat,
- dict_t **xdata)
+client_post_fallocate(xlator_t *this, gfs3_fallocate_rsp *rsp,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_discard (xlator_t *this, gfs3_discard_rsp *rsp,
- struct iatt *prestat,
- struct iatt *poststat, dict_t **xdata)
+client_post_discard(xlator_t *this, gfs3_discard_rsp *rsp, struct iatt *prestat,
+ struct iatt *poststat, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_zerofill (xlator_t *this, gfs3_zerofill_rsp *rsp,
+client_post_zerofill(xlator_t *this, gfs3_zerofill_rsp *rsp,
struct iatt *prestat, struct iatt *poststat,
dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (-1 != rsp->op_ret) {
- gf_stat_to_iatt (&rsp->statpre, prestat);
- gf_stat_to_iatt (&rsp->statpost, poststat);
- }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ if (-1 != rsp->op_ret) {
+ gf_stat_to_iatt(&rsp->statpre, prestat);
+ gf_stat_to_iatt(&rsp->statpost, poststat);
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_ipc (xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata)
+client_post_ipc(xlator_t *this, gfs3_ipc_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_seek (xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata)
+client_post_seek(xlator_t *this, gfs3_seek_rsp *rsp, dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
int
-client_post_lease (xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease,
- dict_t **xdata)
+client_post_lease(xlator_t *this, gfs3_lease_rsp *rsp, struct gf_lease *lease,
+ dict_t **xdata)
{
- int ret = 0;
+ int ret = 0;
- if (rsp->op_ret >= 0) {
- gf_proto_lease_to_lease (&rsp->lease, lease);
- }
+ if (rsp->op_ret >= 0) {
+ gf_proto_lease_to_lease(&rsp->lease, lease);
+ }
- GF_PROTOCOL_DICT_UNSERIALIZE (this, *xdata, (rsp->xdata.xdata_val),
- (rsp->xdata.xdata_len), ret,
- rsp->op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE(this, *xdata, (rsp->xdata.xdata_val),
+ (rsp->xdata.xdata_len), ret, rsp->op_errno,
+ out);
out:
- return ret;
+ return ret;
}
-
/* New PRE and POST functions */
int
-client_post_common_iatt (xlator_t *this, gfx_common_iatt_rsp *rsp, struct iatt *iatt,
- dict_t **xdata)
+client_post_common_iatt(xlator_t *this, gfx_common_iatt_rsp *rsp,
+ struct iatt *iatt, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, iatt);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, iatt);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_2iatt (xlator_t *this, gfx_common_2iatt_rsp *rsp, struct iatt *iatt,
- struct iatt *iatt2, dict_t **xdata)
+client_post_common_2iatt(xlator_t *this, gfx_common_2iatt_rsp *rsp,
+ struct iatt *iatt, struct iatt *iatt2, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->prestat, iatt);
- gfx_stat_to_iattx (&rsp->poststat, iatt2);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->prestat, iatt);
+ gfx_stat_to_iattx(&rsp->poststat, iatt2);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_3iatt (xlator_t *this, gfx_common_3iatt_rsp *rsp, struct iatt *iatt,
- struct iatt *iatt2, struct iatt *iatt3, dict_t **xdata)
+client_post_common_3iatt(xlator_t *this, gfx_common_3iatt_rsp *rsp,
+ struct iatt *iatt, struct iatt *iatt2,
+ struct iatt *iatt3, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, iatt);
- gfx_stat_to_iattx (&rsp->preparent, iatt2);
- gfx_stat_to_iattx (&rsp->postparent, iatt3);
- }
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, iatt);
+ gfx_stat_to_iattx(&rsp->preparent, iatt2);
+ gfx_stat_to_iattx(&rsp->postparent, iatt3);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_common_dict (xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict,
- dict_t **xdata)
+client_post_common_dict(xlator_t *this, gfx_common_dict_rsp *rsp, dict_t **dict,
+ dict_t **xdata)
{
- int ret = 0;
- ret = xdr_to_dict (&rsp->dict, dict);
- if (ret)
- gf_msg_debug (this->name, EINVAL,
- "while decoding found empty dictionary");
- xdr_to_dict (&rsp->xdata, xdata);
+ int ret = 0;
+ ret = xdr_to_dict(&rsp->dict, dict);
+ if (ret)
+ gf_msg_debug(this->name, EINVAL,
+ "while decoding found empty dictionary");
+ xdr_to_dict(&rsp->xdata, xdata);
- return ret;
+ return ret;
}
int
-client_post_readv_v2 (xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref,
- struct iobref *rsp_iobref, struct iatt *stat,
- struct iovec *vector, struct iovec *rsp_vector,
- int *rspcount, dict_t **xdata)
+client_post_readv_v2(xlator_t *this, gfx_read_rsp *rsp, struct iobref **iobref,
+ struct iobref *rsp_iobref, struct iatt *stat,
+ struct iovec *vector, struct iovec *rsp_vector,
+ int *rspcount, dict_t **xdata)
{
- int ret = -1;
+ int ret = -1;
- if (rsp->op_ret != -1) {
- *iobref = rsp_iobref;
- gfx_stat_to_iattx (&rsp->stat, stat);
+ if (rsp->op_ret != -1) {
+ *iobref = rsp_iobref;
+ gfx_stat_to_iattx(&rsp->stat, stat);
- vector[0].iov_len = rsp->op_ret;
- if (rsp->op_ret > 0)
- vector[0].iov_base = rsp_vector->iov_base;
- *rspcount = 1;
- }
+ vector[0].iov_len = rsp->op_ret;
+ if (rsp->op_ret > 0)
+ vector[0].iov_base = rsp_vector->iov_base;
+ *rspcount = 1;
+ }
- ret = xdr_to_dict (&rsp->xdata, xdata);
+ ret = xdr_to_dict(&rsp->xdata, xdata);
#ifdef GF_TESTING_IO_XDATA
- dict_dump_to_log (xdata);
+ dict_dump_to_log(xdata);
#endif
- return ret;
+ return ret;
}
int
-client_pre_stat_v2 (xlator_t *this, gfx_stat_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_stat_v2(xlator_t *this, gfx_stat_req *req, loc_t *loc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readlink_v2 (xlator_t *this, gfx_readlink_req *req, loc_t *loc,
- size_t size, dict_t *xdata)
+client_pre_readlink_v2(xlator_t *this, gfx_readlink_req *req, loc_t *loc,
+ size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->size = size;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->size = size;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mknod_v2 (xlator_t *this, gfx_mknod_req *req, loc_t *loc,
- mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
+client_pre_mknod_v2(xlator_t *this, gfx_mknod_req *req, loc_t *loc, mode_t mode,
+ dev_t rdev, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->dev = rdev;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->dev = rdev;
+ req->umask = umask;
+ dict_to_xdr(xdata, &req->xdata);
- dict_to_xdr (xdata, &req->xdata);
-
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_mkdir_v2 (xlator_t *this, gfx_mkdir_req *req, loc_t *loc,
- mode_t mode, mode_t umask, dict_t *xdata)
+client_pre_mkdir_v2(xlator_t *this, gfx_mkdir_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_unlink_v2 (xlator_t *this, gfx_unlink_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_unlink_v2(xlator_t *this, gfx_unlink_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rmdir_v2 (xlator_t *this, gfx_rmdir_req *req, loc_t *loc,
- int32_t flags, dict_t *xdata)
+client_pre_rmdir_v2(xlator_t *this, gfx_rmdir_req *req, loc_t *loc,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->xflags = flags;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->xflags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_symlink_v2 (xlator_t *this, gfx_symlink_req *req, loc_t *loc,
- const char *linkname, mode_t umask, dict_t *xdata)
+client_pre_symlink_v2(xlator_t *this, gfx_symlink_req *req, loc_t *loc,
+ const char *linkname, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->linkname = (char *)linkname;
- req->bname = (char *)loc->name;
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->linkname = (char *)linkname;
+ req->bname = (char *)loc->name;
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rename_v2 (xlator_t *this, gfx_rename_req *req, loc_t *oldloc,
- loc_t *newloc, dict_t *xdata)
+client_pre_rename_v2(xlator_t *this, gfx_rename_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && newloc && oldloc->parent &&
- newloc->parent))
- goto out;
+ if (!(oldloc && newloc && oldloc->parent && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->parent->gfid))
- memcpy (req->oldgfid, oldloc->parent->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->pargfid, 16);
+ if (!gf_uuid_is_null(oldloc->parent->gfid))
+ memcpy(req->oldgfid, oldloc->parent->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->pargfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->oldbname = (char *)oldloc->name;
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->oldbname = (char *)oldloc->name;
+ req->newbname = (char *)newloc->name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_link_v2 (xlator_t *this,
- gfx_link_req *req, loc_t *oldloc, loc_t *newloc,
- dict_t *xdata)
+client_pre_link_v2(xlator_t *this, gfx_link_req *req, loc_t *oldloc,
+ loc_t *newloc, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(oldloc && oldloc->inode && newloc &&
- newloc->parent))
- goto out;
+ if (!(oldloc && oldloc->inode && newloc && newloc->parent))
+ goto out;
- if (!gf_uuid_is_null (oldloc->inode->gfid))
- memcpy (req->oldgfid, oldloc->inode->gfid, 16);
- else
- memcpy (req->oldgfid, oldloc->gfid, 16);
+ if (!gf_uuid_is_null(oldloc->inode->gfid))
+ memcpy(req->oldgfid, oldloc->inode->gfid, 16);
+ else
+ memcpy(req->oldgfid, oldloc->gfid, 16);
- if (!gf_uuid_is_null (newloc->parent->gfid))
- memcpy (req->newgfid, newloc->parent->gfid, 16);
- else
- memcpy (req->newgfid, newloc->pargfid, 16);
+ if (!gf_uuid_is_null(newloc->parent->gfid))
+ memcpy(req->newgfid, newloc->parent->gfid, 16);
+ else
+ memcpy(req->newgfid, newloc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->oldgfid)),
- out, op_errno, EINVAL);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->newgfid)),
- out, op_errno, EINVAL);
- req->newbname = (char *)newloc->name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->oldgfid)),
+ out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->newgfid)),
+ out, op_errno, EINVAL);
+ req->newbname = (char *)newloc->name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_truncate_v2 (xlator_t *this, gfx_truncate_req *req,
- loc_t *loc, off_t offset, dict_t *xdata)
+client_pre_truncate_v2(xlator_t *this, gfx_truncate_req *req, loc_t *loc,
+ off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->offset = offset;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_open_v2 (xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_open_v2(xlator_t *this, gfx_open_req *req, loc_t *loc, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->flags = gf_flags_from_flags (flags);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->flags = gf_flags_from_flags(flags);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readv_v2 (xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size,
- off_t offset, int32_t flags, dict_t *xdata)
+client_pre_readv_v2(xlator_t *this, gfx_read_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_writev_v2 (xlator_t *this, gfx_write_req *req,
- fd_t *fd, size_t size, off_t offset, int32_t flags,
- dict_t **xdata)
+client_pre_writev_v2(xlator_t *this, gfx_write_req *req, fd_t *fd, size_t size,
+ off_t offset, int32_t flags, dict_t **xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- req->flag = flags;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ req->flag = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
#ifdef GF_TESTING_IO_XDATA
- if (!*xdata)
- *xdata = dict_new ();
+ if (!*xdata)
+ *xdata = dict_new();
- ret = dict_set_str (*xdata, "testing-the-xdata-key",
- "testing-the-xdata-value");
+ ret = dict_set_str(*xdata, "testing-the-xdata-key",
+ "testing-the-xdata-value");
#endif
- dict_to_xdr (*xdata, &req->xdata);
+ dict_to_xdr(*xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_statfs_v2 (xlator_t *this, gfx_statfs_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_statfs_v2(xlator_t *this, gfx_statfs_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc)
- goto out;
+ if (!loc)
+ goto out;
- if (loc->inode) {
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
- } else {
- req->gfid[15] = 1;
- }
+ if (loc->inode) {
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
+ } else {
+ req->gfid[15] = 1;
+ }
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_flush_v2 (xlator_t *this, gfx_flush_req *req, fd_t *fd, dict_t *xdata)
+client_pre_flush_v2(xlator_t *this, gfx_flush_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsync_v2 (xlator_t *this, gfx_fsync_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsync_v2(xlator_t *this, gfx_fsync_req *req, fd_t *fd, int32_t flags,
+ dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = 0;
+ int64_t remote_fd = -1;
+ int op_errno = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setxattr_v2 (xlator_t *this, gfx_setxattr_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_setxattr_v2(xlator_t *this, gfx_setxattr_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (xattr) {
- dict_to_xdr (xattr, &req->dict);
- }
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (xattr) {
+ dict_to_xdr(xattr, &req->dict);
+ }
- req->flags = flags;
+ req->flags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_getxattr_v2 (xlator_t *this, gfx_getxattr_req *req, loc_t *loc,
- const char *name, dict_t *xdata)
+client_pre_getxattr_v2(xlator_t *this, gfx_getxattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!loc) {
- op_errno = EINVAL;
- goto out;
- }
+ if (!loc) {
+ op_errno = EINVAL;
+ goto out;
+ }
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->namelen = 1; /* Use it as a flag */
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->namelen = 1; /* Use it as a flag */
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_removexattr_v2 (xlator_t *this, gfx_removexattr_req *req,
- loc_t *loc, const char *name, dict_t *xdata)
+client_pre_removexattr_v2(xlator_t *this, gfx_removexattr_req *req, loc_t *loc,
+ const char *name, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->name = (char *)name;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->name = (char *)name;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_opendir_v2 (xlator_t *this,
- gfx_opendir_req *req, loc_t *loc,
- fd_t *fd, dict_t *xdata)
+client_pre_opendir_v2(xlator_t *this, gfx_opendir_req *req, loc_t *loc,
+ fd_t *fd, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsyncdir_v2 (xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd,
- int32_t flags, dict_t *xdata)
+client_pre_fsyncdir_v2(xlator_t *this, gfx_fsyncdir_req *req, fd_t *fd,
+ int32_t flags, dict_t *xdata)
{
- int32_t op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int32_t op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->data = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->data = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_access_v2 (xlator_t *this, gfx_access_req *req, loc_t *loc,
- int32_t mask, dict_t *xdata)
+client_pre_access_v2(xlator_t *this, gfx_access_req *req, loc_t *loc,
+ int32_t mask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->mask = mask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->mask = mask;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_create_v2 (xlator_t *this, gfx_create_req *req,
- loc_t *loc, fd_t *fd, mode_t mode,
- int32_t flags, mode_t umask, dict_t *xdata)
+client_pre_create_v2(xlator_t *this, gfx_create_req *req, loc_t *loc, fd_t *fd,
+ mode_t mode, int32_t flags, mode_t umask, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->flags = gf_flags_from_flags (flags);
- req->umask = umask;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->flags = gf_flags_from_flags(flags);
+ req->umask = umask;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ftruncate_v2 (xlator_t *this, gfx_ftruncate_req *req, fd_t *fd,
- off_t offset, dict_t *xdata)
+client_pre_ftruncate_v2(xlator_t *this, gfx_ftruncate_req *req, fd_t *fd,
+ off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = EINVAL;
+ int64_t remote_fd = -1;
+ int op_errno = EINVAL;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fstat_v2 (xlator_t *this, gfx_fstat_req *req, fd_t *fd,
- dict_t *xdata)
+client_pre_fstat_v2(xlator_t *this, gfx_fstat_req *req, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lk_v2 (xlator_t *this, gfx_lk_req *req,
- int32_t cmd, struct gf_flock *flock, fd_t *fd, dict_t *xdata)
+client_pre_lk_v2(xlator_t *this, gfx_lk_req *req, int32_t cmd,
+ struct gf_flock *flock, fd_t *fd, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
- int ret = 0;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
+ int ret = 0;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- ret = client_cmd_to_gf_cmd (cmd, &gf_cmd);
- if (ret) {
- op_errno = EINVAL;
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
+ ret = client_cmd_to_gf_cmd(cmd, &gf_cmd);
+ if (ret) {
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
- switch (flock->l_type) {
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lookup_v2 (xlator_t *this, gfx_lookup_req *req, loc_t *loc,
- dict_t *xdata)
+client_pre_lookup_v2(xlator_t *this, gfx_lookup_req *req, loc_t *loc,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if ((loc->parent) && (!gf_uuid_is_null (loc->parent->gfid)))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
-
- if ((loc->inode) && (!gf_uuid_is_null (loc->inode->gfid)))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if ((loc->parent) && (!gf_uuid_is_null(loc->parent->gfid)))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
+ if ((loc->inode) && (!gf_uuid_is_null(loc->inode->gfid)))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- if (loc->name)
- req->bname = (char *)loc->name;
- else
- req->bname = "";
+ if (loc->name)
+ req->bname = (char *)loc->name;
+ else
+ req->bname = "";
- if (xdata) {
- dict_to_xdr (xdata, &req->xdata);
- }
- return 0;
+ if (xdata) {
+ dict_to_xdr(xdata, &req->xdata);
+ }
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdir_v2 (xlator_t *this, gfx_readdir_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdir_v2(xlator_t *this, gfx_readdir_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_inodelk_v2 (xlator_t *this, gfx_inodelk_req *req, loc_t *loc,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_inodelk_v2(xlator_t *this, gfx_inodelk_req *req, loc_t *loc, int cmd,
+ struct gf_flock *flock, const char *volume, dict_t *xdata)
{
- int op_errno = ESTALE;
- int32_t gf_cmd = 0;
- int32_t gf_type = 0;
+ int op_errno = ESTALE;
+ int32_t gf_cmd = 0;
+ int32_t gf_type = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- op_errno = EINVAL;
- goto out;
- }
-
- switch (flock->l_type) {
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
+ req->volume = (char *)volume;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_finodelk_v2 (xlator_t *this, gfx_finodelk_req *req, fd_t *fd,
- int cmd, struct gf_flock *flock, const char *volume,
- dict_t *xdata)
+client_pre_finodelk_v2(xlator_t *this, gfx_finodelk_req *req, fd_t *fd, int cmd,
+ struct gf_flock *flock, const char *volume,
+ dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
- int32_t gf_type = 0;
- int32_t gf_cmd = 0;
-
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- gf_cmd = GF_LK_SETLKW;
- else {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
- goto out;
- }
-
- switch (flock->l_type) {
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int32_t gf_type = 0;
+ int32_t gf_cmd = 0;
+
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ gf_cmd = GF_LK_SETLKW;
+ else {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "Unknown cmd (%d)!", gf_cmd);
+ goto out;
+ }
+
+ switch (flock->l_type) {
case F_RDLCK:
- gf_type = GF_LK_F_RDLCK;
- break;
+ gf_type = GF_LK_F_RDLCK;
+ break;
case F_WRLCK:
- gf_type = GF_LK_F_WRLCK;
- break;
+ gf_type = GF_LK_F_WRLCK;
+ break;
case F_UNLCK:
- gf_type = GF_LK_F_UNLCK;
- break;
- }
+ gf_type = GF_LK_F_UNLCK;
+ break;
+ }
- req->volume = (char *)volume;
- req->fd = remote_fd;
- req->cmd = gf_cmd;
- req->type = gf_type;
- gf_proto_flock_from_flock (&req->flock, flock);
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->volume = (char *)volume;
+ req->fd = remote_fd;
+ req->cmd = gf_cmd;
+ req->type = gf_type;
+ gf_proto_flock_from_flock(&req->flock, flock);
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_entrylk_v2 (xlator_t *this, gfx_entrylk_req *req, loc_t *loc,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_entrylk_v2(xlator_t *this, gfx_entrylk_req *req, loc_t *loc,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->gfid))
- memcpy (req->gfid, loc->gfid, 16);
- else
- memcpy (req->gfid, loc->inode->gfid, 16);
-
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
+ if (!gf_uuid_is_null(loc->gfid))
+ memcpy(req->gfid, loc->gfid, 16);
+ else
+ memcpy(req->gfid, loc->inode->gfid, 16);
+
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fentrylk_v2 (xlator_t *this, gfx_fentrylk_req *req, fd_t *fd,
- entrylk_cmd cmd_entrylk, entrylk_type type,
- const char *volume, const char *basename, dict_t *xdata)
+client_pre_fentrylk_v2(xlator_t *this, gfx_fentrylk_req *req, fd_t *fd,
+ entrylk_cmd cmd_entrylk, entrylk_type type,
+ const char *volume, const char *basename, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->cmd = cmd_entrylk;
- req->type = type;
- req->volume = (char *)volume;
- req->name = "";
- if (basename) {
- req->name = (char *)basename;
- req->namelen = 1;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->cmd = cmd_entrylk;
+ req->type = type;
+ req->volume = (char *)volume;
+ req->name = "";
+ if (basename) {
+ req->name = (char *)basename;
+ req->namelen = 1;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_xattrop_v2 (xlator_t *this, gfx_xattrop_req *req, loc_t *loc,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_xattrop_v2(xlator_t *this, gfx_xattrop_req *req, loc_t *loc,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
- dict_to_xdr (xattr, &req->dict);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
+ dict_to_xdr(xattr, &req->dict);
- req->flags = flags;
+ req->flags = flags;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fxattrop_v2 (xlator_t *this, gfx_fxattrop_req *req, fd_t *fd,
- dict_t *xattr, int32_t flags, dict_t *xdata)
+client_pre_fxattrop_v2(xlator_t *this, gfx_fxattrop_req *req, fd_t *fd,
+ dict_t *xattr, int32_t flags, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, FALLBACK_TO_ANON_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, FALLBACK_TO_ANON_FD, remote_fd, op_errno,
+ out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xattr, &req->dict);
+ dict_to_xdr(xattr, &req->dict);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fgetxattr_v2 (xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fgetxattr_v2(xlator_t *this, gfx_fgetxattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->namelen = 1; /* Use it as a flag */
- req->fd = remote_fd;
- req->name = (char *)name;
- if (!req->name) {
- req->name = "";
- req->namelen = 0;
- }
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->namelen = 1; /* Use it as a flag */
+ req->fd = remote_fd;
+ req->name = (char *)name;
+ if (!req->name) {
+ req->name = "";
+ req->namelen = 0;
+ }
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetxattr_v2 (xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd,
- int32_t flags, dict_t *xattr, dict_t *xdata)
+client_pre_fsetxattr_v2(xlator_t *this, gfx_fsetxattr_req *req, fd_t *fd,
+ int32_t flags, dict_t *xattr, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- if (xattr) {
- dict_to_xdr (xattr, &req->dict);
- }
+ if (xattr) {
+ dict_to_xdr(xattr, &req->dict);
+ }
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_rchecksum_v2 (xlator_t *this, gfx_rchecksum_req *req, fd_t *fd,
- int32_t len, off_t offset, dict_t *xdata)
+client_pre_rchecksum_v2(xlator_t *this, gfx_rchecksum_req *req, fd_t *fd,
+ int32_t len, off_t offset, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->len = len;
- req->offset = offset;
- req->fd = remote_fd;
+ req->len = len;
+ req->offset = offset;
+ req->fd = remote_fd;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_setattr_v2 (xlator_t *this, gfx_setattr_req *req, loc_t *loc,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_setattr_v2(xlator_t *this, gfx_setattr_req *req, loc_t *loc,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->inode))
- return -op_errno;
+ if (!(loc && loc->inode))
+ return -op_errno;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- req->valid = valid;
- gfx_stat_from_iattx (&req->stbuf, stbuf);
+ req->valid = valid;
+ gfx_stat_from_iattx(&req->stbuf, stbuf);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fsetattr_v2 (xlator_t *this, gfx_fsetattr_req *req, fd_t *fd,
- int32_t valid, struct iatt *stbuf, dict_t *xdata)
+client_pre_fsetattr_v2(xlator_t *this, gfx_fsetattr_req *req, fd_t *fd,
+ int32_t valid, struct iatt *stbuf, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->valid = valid;
- gfx_stat_from_iattx (&req->stbuf, stbuf);
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->valid = valid;
+ gfx_stat_from_iattx(&req->stbuf, stbuf);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_readdirp_v2 (xlator_t *this, gfx_readdirp_req *req, fd_t *fd,
- size_t size, off_t offset, dict_t *xdata)
+client_pre_readdirp_v2(xlator_t *this, gfx_readdirp_req *req, fd_t *fd,
+ size_t size, off_t offset, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->size = size;
- req->offset = offset;
- req->fd = remote_fd;
- memcpy (req->gfid, fd->inode->gfid, 16);
+ req->size = size;
+ req->offset = offset;
+ req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- /* dict itself is 'xdata' here */
- dict_to_xdr (xdata, &req->xdata);
+ /* dict itself is 'xdata' here */
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fremovexattr_v2 (xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd,
- const char *name, dict_t *xdata)
+client_pre_fremovexattr_v2(xlator_t *this, gfx_fremovexattr_req *req, fd_t *fd,
+ const char *name, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- if (!(fd && fd->inode))
- goto out;
+ if (!(fd && fd->inode))
+ goto out;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->name = (char *)name;
- req->fd = remote_fd;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->name = (char *)name;
+ req->fd = remote_fd;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_fallocate_v2 (xlator_t *this, gfx_fallocate_req *req, fd_t *fd,
- int32_t flags, off_t offset, size_t size, dict_t *xdata)
+client_pre_fallocate_v2(xlator_t *this, gfx_fallocate_req *req, fd_t *fd,
+ int32_t flags, off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->flags = flags;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->flags = flags;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_discard_v2 (xlator_t *this, gfx_discard_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_discard_v2(xlator_t *this, gfx_discard_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_zerofill_v2 (xlator_t *this, gfx_zerofill_req *req, fd_t *fd,
- off_t offset, size_t size, dict_t *xdata)
+client_pre_zerofill_v2(xlator_t *this, gfx_zerofill_req *req, fd_t *fd,
+ off_t offset, size_t size, dict_t *xdata)
{
- int op_errno = ESTALE;
- int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+ int64_t remote_fd = -1;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- req->fd = remote_fd;
- req->offset = offset;
- req->size = size;
- memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->size = size;
+ memcpy(req->gfid, fd->inode->gfid, 16);
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_ipc_v2 (xlator_t *this, gfx_ipc_req *req, int32_t cmd,
- dict_t *xdata)
+client_pre_ipc_v2(xlator_t *this, gfx_ipc_req *req, int32_t cmd, dict_t *xdata)
{
- req->op = cmd;
+ req->op = cmd;
- dict_to_xdr (xdata, &req->xdata);
- return 0;
+ dict_to_xdr(xdata, &req->xdata);
+ return 0;
}
int
-client_pre_seek_v2 (xlator_t *this, gfx_seek_req *req, fd_t *fd,
- off_t offset, gf_seek_what_t what, dict_t *xdata)
+client_pre_seek_v2(xlator_t *this, gfx_seek_req *req, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
{
- int64_t remote_fd = -1;
- int op_errno = ESTALE;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
- CLIENT_GET_REMOTE_FD (this, fd, DEFAULT_REMOTE_FD,
- remote_fd, op_errno, out);
+ CLIENT_GET_REMOTE_FD(this, fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, out);
- memcpy (req->gfid, fd->inode->gfid, 16);
- req->fd = remote_fd;
- req->offset = offset;
- req->what = what;
+ memcpy(req->gfid, fd->inode->gfid, 16);
+ req->fd = remote_fd;
+ req->offset = offset;
+ req->what = what;
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_lease_v2 (xlator_t *this, gfx_lease_req *req, loc_t *loc,
- struct gf_lease *lease, dict_t *xdata)
+client_pre_lease_v2(xlator_t *this, gfx_lease_req *req, loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata)
{
- int op_errno = 0;
+ int op_errno = 0;
- if (!(loc && loc->inode))
- goto out;
+ if (!(loc && loc->inode))
+ goto out;
- if (!gf_uuid_is_null (loc->inode->gfid))
- memcpy (req->gfid, loc->inode->gfid, 16);
- else
- memcpy (req->gfid, loc->gfid, 16);
+ if (!gf_uuid_is_null(loc->inode->gfid))
+ memcpy(req->gfid, loc->inode->gfid, 16);
+ else
+ memcpy(req->gfid, loc->gfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->gfid)),
- out, op_errno, EINVAL);
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->gfid)), out,
+ op_errno, EINVAL);
- gf_proto_lease_from_lease (&req->lease, lease);
+ gf_proto_lease_from_lease(&req->lease, lease);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_pre_put_v2 (xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode,
- mode_t umask, int32_t flags, size_t size, off_t offset,
- dict_t *xattr, dict_t *xdata)
+client_pre_put_v2(xlator_t *this, gfx_put_req *req, loc_t *loc, mode_t mode,
+ mode_t umask, int32_t flags, size_t size, off_t offset,
+ dict_t *xattr, dict_t *xdata)
{
- int op_errno = ESTALE;
+ int op_errno = ESTALE;
- if (!(loc && loc->parent))
- goto out;
+ if (!(loc && loc->parent))
+ goto out;
- if (!gf_uuid_is_null (loc->parent->gfid))
- memcpy (req->pargfid, loc->parent->gfid, 16);
- else
- memcpy (req->pargfid, loc->pargfid, 16);
+ if (!gf_uuid_is_null(loc->parent->gfid))
+ memcpy(req->pargfid, loc->parent->gfid, 16);
+ else
+ memcpy(req->pargfid, loc->pargfid, 16);
- GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,
- !gf_uuid_is_null (*((uuid_t *)req->pargfid)),
- out, op_errno, EINVAL);
- req->bname = (char *)loc->name;
- req->mode = mode;
- req->umask = umask;
- req->flag = gf_flags_from_flags (flags);
- req->size = size;
- req->offset = offset;
+ GF_ASSERT_AND_GOTO_WITH_ERROR(this->name,
+ !gf_uuid_is_null(*((uuid_t *)req->pargfid)),
+ out, op_errno, EINVAL);
+ req->bname = (char *)loc->name;
+ req->mode = mode;
+ req->umask = umask;
+ req->flag = gf_flags_from_flags(flags);
+ req->size = size;
+ req->offset = offset;
- if (xattr)
- dict_to_xdr (xattr, &req->xattr);
+ if (xattr)
+ dict_to_xdr(xattr, &req->xattr);
- dict_to_xdr (xdata, &req->xdata);
+ dict_to_xdr(xdata, &req->xdata);
- return 0;
+ return 0;
out:
- return -op_errno;
+ return -op_errno;
}
int
-client_post_create_v2 (xlator_t *this, gfx_create_rsp *rsp,
- struct iatt *stbuf, struct iatt *preparent,
- struct iatt *postparent,
- clnt_local_t *local, dict_t **xdata)
+client_post_create_v2(xlator_t *this, gfx_create_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preparent, struct iatt *postparent,
+ clnt_local_t *local, dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, stbuf);
- gfx_stat_to_iattx (&rsp->preparent, preparent);
- gfx_stat_to_iattx (&rsp->postparent, postparent);
- gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ gfx_stat_to_iattx(&rsp->preparent, preparent);
+ gfx_stat_to_iattx(&rsp->postparent, postparent);
+ gf_uuid_copy(local->loc.gfid, stbuf->ia_gfid);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_lease_v2 (xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease,
- dict_t **xdata)
+client_post_lease_v2(xlator_t *this, gfx_lease_rsp *rsp, struct gf_lease *lease,
+ dict_t **xdata)
{
- if (rsp->op_ret >= 0) {
- gf_proto_lease_to_lease (&rsp->lease, lease);
- }
+ if (rsp->op_ret >= 0) {
+ gf_proto_lease_to_lease(&rsp->lease, lease);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_lk_v2 (xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock,
- dict_t **xdata)
+client_post_lk_v2(xlator_t *this, gfx_lk_rsp *rsp, struct gf_flock *lock,
+ dict_t **xdata)
{
- if (rsp->op_ret >= 0) {
- gf_proto_flock_to_flock (&rsp->flock, lock);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret >= 0) {
+ gf_proto_flock_to_flock(&rsp->flock, lock);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_readdir_v2 (xlator_t *this, gfx_readdir_rsp *rsp,
- gf_dirent_t *entries, dict_t **xdata)
+client_post_readdir_v2(xlator_t *this, gfx_readdir_rsp *rsp,
+ gf_dirent_t *entries, dict_t **xdata)
{
- if (rsp->op_ret > 0) {
- unserialize_rsp_dirent_v2 (this, rsp, entries);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_dirent_v2(this, rsp, entries);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
int
-client_post_readdirp_v2 (xlator_t *this, gfx_readdirp_rsp *rsp,
- fd_t *fd, gf_dirent_t *entries,
- dict_t **xdata)
+client_post_readdirp_v2(xlator_t *this, gfx_readdirp_rsp *rsp, fd_t *fd,
+ gf_dirent_t *entries, dict_t **xdata)
{
- if (rsp->op_ret > 0) {
- unserialize_rsp_direntp_v2 (this, fd, rsp, entries);
- }
- return xdr_to_dict (&rsp->xdata, xdata);
+ if (rsp->op_ret > 0) {
+ unserialize_rsp_direntp_v2(this, fd, rsp, entries);
+ }
+ return xdr_to_dict(&rsp->xdata, xdata);
}
-
-
int
-client_post_rename_v2 (xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf,
- struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent,
- dict_t **xdata)
+client_post_rename_v2(xlator_t *this, gfx_rename_rsp *rsp, struct iatt *stbuf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent,
+ dict_t **xdata)
{
- if (-1 != rsp->op_ret) {
- gfx_stat_to_iattx (&rsp->stat, stbuf);
+ if (-1 != rsp->op_ret) {
+ gfx_stat_to_iattx(&rsp->stat, stbuf);
- gfx_stat_to_iattx (&rsp->preoldparent, preoldparent);
- gfx_stat_to_iattx (&rsp->postoldparent, postoldparent);
+ gfx_stat_to_iattx(&rsp->preoldparent, preoldparent);
+ gfx_stat_to_iattx(&rsp->postoldparent, postoldparent);
- gfx_stat_to_iattx (&rsp->prenewparent, prenewparent);
- gfx_stat_to_iattx (&rsp->postnewparent, postnewparent);
- }
+ gfx_stat_to_iattx(&rsp->prenewparent, prenewparent);
+ gfx_stat_to_iattx(&rsp->postnewparent, postnewparent);
+ }
- return xdr_to_dict (&rsp->xdata, xdata);
+ return xdr_to_dict(&rsp->xdata, xdata);
}
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 0025fb5..5feeca5 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -28,1706 +28,1725 @@ extern rpc_clnt_prog_t clnt4_0_fop_prog;
extern rpc_clnt_prog_t clnt_pmap_prog;
typedef struct client_fd_lk_local {
- gf_atomic_t ref;
- gf_boolean_t error;
- gf_lock_t lock;
- clnt_fd_ctx_t *fdctx;
-}clnt_fd_lk_local_t;
+ gf_atomic_t ref;
+ gf_boolean_t error;
+ gf_lock_t lock;
+ clnt_fd_ctx_t *fdctx;
+} clnt_fd_lk_local_t;
int
-client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_getspec_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gf_getspec_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- int ret = 0;
-
- frame = myframe;
-
- if (!frame || !frame->this) {
- gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
- "frame not found with the request, returning EINVAL");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED,
- "XDR decoding failed, returning EINVAL");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_VOL_FILE_NOT_FOUND, "failed to get the 'volume "
- "file' from server");
- goto out;
- }
+ gf_getspec_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ int ret = 0;
+
+ frame = myframe;
+
+ if (!frame || !frame->this) {
+ gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
+ "frame not found with the request, returning EINVAL");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed, returning EINVAL");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VOL_FILE_NOT_FOUND,
+ "failed to get the 'volume "
+ "file' from server");
+ goto out;
+ }
out:
- CLIENT_STACK_UNWIND (getspec, frame, rsp.op_ret, rsp.op_errno,
- rsp.spec);
+ CLIENT_STACK_UNWIND(getspec, frame, rsp.op_ret, rsp.op_errno, rsp.spec);
- /* Don't use 'GF_FREE', this is allocated by libc */
- free (rsp.spec);
- free (rsp.xdata.xdata_val);
+ /* Don't use 'GF_FREE', this is allocated by libc */
+ free(rsp.spec);
+ free(rsp.xdata.xdata_val);
- return 0;
+ return 0;
}
-int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data)
+int32_t
+client3_getspec(call_frame_t *frame, xlator_t *this, void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gf_getspec_req req = {0,};
- int op_errno = ESTALE;
- int ret = 0;
-
- if (!frame || !this || !data)
- goto unwind;
-
- args = data;
- conf = this->private;
- req.flags = args->flags;
- req.key = (char *)args->name;
-
- ret = client_submit_request (this, &req, frame, conf->handshake,
- GF_HNDSK_GETSPEC, client3_getspec_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_getspec_req);
-
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL,
- "failed to send the request");
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gf_getspec_req req = {
+ 0,
+ };
+ int op_errno = ESTALE;
+ int ret = 0;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+ conf = this->private;
+ req.flags = args->flags;
+ req.key = (char *)args->name;
+
+ ret = client_submit_request(this, &req, frame, conf->handshake,
+ GF_HNDSK_GETSPEC, client3_getspec_cbk, NULL,
+ NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_getspec_req);
+
+ if (ret) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL,
+ "failed to send the request");
+ }
+
+ return 0;
unwind:
- CLIENT_STACK_UNWIND (getspec, frame, -1, op_errno, NULL);
- return 0;
-
+ CLIENT_STACK_UNWIND(getspec, frame, -1, op_errno, NULL);
+ return 0;
}
int
-client_notify_parents_child_up (xlator_t *this)
+client_notify_parents_child_up(xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- int ret = 0;
-
- GF_VALIDATE_OR_GOTO("client", this, out);
- conf = this->private;
- GF_VALIDATE_OR_GOTO(this->name, conf, out);
-
- if (conf->child_up) {
- ret = client_notify_dispatch_uniq (this, GF_EVENT_CHILD_UP,
- NULL);
- if (ret) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_UP_NOTIFY_FAILED,
- "notify of CHILD_UP failed");
- goto out;
- }
- } else {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS,
- "Defering sending CHILD_UP message as the client "
- "translators are not yet ready to serve.");
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+
+ if (conf->child_up) {
+ ret = client_notify_dispatch_uniq(this, GF_EVENT_CHILD_UP, NULL);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_FAILED,
+ "notify of CHILD_UP failed");
+ goto out;
}
+ } else {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_STATUS,
+ "Defering sending CHILD_UP message as the client "
+ "translators are not yet ready to serve.");
+ }
out:
- return 0;
+ return 0;
}
int
-clnt_fd_lk_reacquire_failed (xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
+clnt_fd_lk_reacquire_failed(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ clnt_conf_t *conf)
{
- int ret = -1;
+ int ret = -1;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx->remote_fd = -1;
- }
- pthread_spin_unlock (&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx->remote_fd = -1;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-client_fd_lk_count (fd_lk_ctx_t *lk_ctx)
+client_fd_lk_count(fd_lk_ctx_t *lk_ctx)
{
- int count = 0;
- fd_lk_ctx_node_t *fd_lk = NULL;
+ int count = 0;
+ fd_lk_ctx_node_t *fd_lk = NULL;
- GF_VALIDATE_OR_GOTO ("client", lk_ctx, err);
+ GF_VALIDATE_OR_GOTO("client", lk_ctx, err);
- LOCK (&lk_ctx->lock);
- {
- list_for_each_entry (fd_lk, &lk_ctx->lk_list, next)
- count++;
- }
- UNLOCK (&lk_ctx->lock);
+ LOCK(&lk_ctx->lock);
+ {
+ list_for_each_entry(fd_lk, &lk_ctx->lk_list, next) count++;
+ }
+ UNLOCK(&lk_ctx->lock);
- return count;
+ return count;
err:
- return -1;
+ return -1;
}
clnt_fd_lk_local_t *
-clnt_fd_lk_local_ref (xlator_t *this, clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_ref(xlator_t *this, clnt_fd_lk_local_t *local)
{
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- GF_ATOMIC_INC (local->ref);
+ GF_ATOMIC_INC(local->ref);
out:
- return local;
+ return local;
}
int
-clnt_fd_lk_local_unref (xlator_t *this, clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_unref(xlator_t *this, clnt_fd_lk_local_t *local)
{
- int ref = -1;
+ int ref = -1;
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- ref = GF_ATOMIC_DEC (local->ref);
+ ref = GF_ATOMIC_DEC(local->ref);
- if (ref == 0) {
- LOCK_DESTROY (&local->lock);
- GF_FREE (local);
- }
+ if (ref == 0) {
+ LOCK_DESTROY(&local->lock);
+ GF_FREE(local);
+ }
out:
- return ref;
+ return ref;
}
clnt_fd_lk_local_t *
-clnt_fd_lk_local_create (clnt_fd_ctx_t *fdctx)
+clnt_fd_lk_local_create(clnt_fd_ctx_t *fdctx)
{
- clnt_fd_lk_local_t *local = NULL;
+ clnt_fd_lk_local_t *local = NULL;
- local = GF_CALLOC (1, sizeof (clnt_fd_lk_local_t),
- gf_client_mt_clnt_fd_lk_local_t);
- if (!local)
- goto out;
+ local = GF_CALLOC(1, sizeof(clnt_fd_lk_local_t),
+ gf_client_mt_clnt_fd_lk_local_t);
+ if (!local)
+ goto out;
- GF_ATOMIC_INIT (local->ref, 1);
- local->error = _gf_false;
- local->fdctx = fdctx;
+ GF_ATOMIC_INIT(local->ref, 1);
+ local->error = _gf_false;
+ local->fdctx = fdctx;
- LOCK_INIT (&local->lock);
+ LOCK_INIT(&local->lock);
out:
- return local;
+ return local;
}
int
-clnt_release_reopen_fd_cbk (struct rpc_req *req, struct iovec *iov,
- int count, void *myframe)
+clnt_release_reopen_fd_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- xlator_t *this = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
+ xlator_t *this = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
- frame = myframe;
- this = frame->this;
- fdctx = (clnt_fd_ctx_t *) frame->local;
- conf = (clnt_conf_t *) this->private;
+ frame = myframe;
+ this = frame->this;
+ fdctx = (clnt_fd_ctx_t *)frame->local;
+ conf = (clnt_conf_t *)this->private;
- clnt_fd_lk_reacquire_failed (this, fdctx, conf);
+ clnt_fd_lk_reacquire_failed(this, fdctx, conf);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- return 0;
+ return 0;
}
int
-clnt_release_reopen_fd (xlator_t *this, clnt_fd_ctx_t *fdctx)
+clnt_release_reopen_fd(xlator_t *this, clnt_fd_ctx_t *fdctx)
{
- int ret = -1;
- clnt_conf_t *conf = NULL;
- call_frame_t *frame = NULL;
- gfs3_release_req req = {{0,},};
-
- conf = (clnt_conf_t *) this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame)
- goto out;
-
- frame->local = (void *) fdctx;
- req.fd = fdctx->remote_fd;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_RELEASE,
- clnt_release_reopen_fd_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
- out:
- if (ret) {
- clnt_fd_lk_reacquire_failed (this, fdctx, conf);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
- }
- return 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_release_req req = {
+ {
+ 0,
+ },
+ };
+
+ conf = (clnt_conf_t *)this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame)
+ goto out;
+
+ frame->local = (void *)fdctx;
+ req.fd = fdctx->remote_fd;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RELEASE,
+ clnt_release_reopen_fd_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfs3_releasedir_req);
+out:
+ if (ret) {
+ clnt_fd_lk_reacquire_failed(this, fdctx, conf);
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ }
+ return 0;
}
int
-clnt_reacquire_lock_error (xlator_t *this, clnt_fd_ctx_t *fdctx,
- clnt_conf_t *conf)
+clnt_reacquire_lock_error(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ clnt_conf_t *conf)
{
- int32_t ret = -1;
+ int32_t ret = -1;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
- clnt_release_reopen_fd (this, fdctx);
+ clnt_release_reopen_fd(this, fdctx);
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
gf_boolean_t
-clnt_fd_lk_local_error_status (xlator_t *this,
- clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_error_status(xlator_t *this, clnt_fd_lk_local_t *local)
{
- gf_boolean_t error = _gf_false;
+ gf_boolean_t error = _gf_false;
- LOCK (&local->lock);
- {
- error = local->error;
- }
- UNLOCK (&local->lock);
+ LOCK(&local->lock);
+ {
+ error = local->error;
+ }
+ UNLOCK(&local->lock);
- return error;
+ return error;
}
int
-clnt_fd_lk_local_mark_error (xlator_t *this,
- clnt_fd_lk_local_t *local)
+clnt_fd_lk_local_mark_error(xlator_t *this, clnt_fd_lk_local_t *local)
{
- int32_t ret = -1;
- clnt_conf_t *conf = NULL;
- gf_boolean_t error = _gf_false;
+ int32_t ret = -1;
+ clnt_conf_t *conf = NULL;
+ gf_boolean_t error = _gf_false;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, local, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, local, out);
- conf = (clnt_conf_t *) this->private;
+ conf = (clnt_conf_t *)this->private;
- LOCK (&local->lock);
- {
- error = local->error;
- local->error = _gf_true;
- }
- UNLOCK (&local->lock);
+ LOCK(&local->lock);
+ {
+ error = local->error;
+ local->error = _gf_true;
+ }
+ UNLOCK(&local->lock);
- if (!error)
- clnt_reacquire_lock_error (this, local->fdctx, conf);
- ret = 0;
+ if (!error)
+ clnt_reacquire_lock_error(this, local->fdctx, conf);
+ ret = 0;
out:
- return ret;
+ return ret;
}
void
-client_default_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_default_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- gf_log_callingfn (this->name, GF_LOG_WARNING,
- "This function should never be called");
+ gf_log_callingfn(this->name, GF_LOG_WARNING,
+ "This function should never be called");
}
void
-client_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- gf_boolean_t destroy = _gf_false;
-
- conf = this->private;
-
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx->remote_fd = rfd;
- fdctx->reopen_attempts = 0;
- fdctx->reopen_done = client_default_reopen_done;
- if (!fdctx->released)
- list_add_tail (&fdctx->sfd_pos, &conf->saved_fds);
- else
- destroy = _gf_true;
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- if (destroy)
- client_fdctx_destroy (this, fdctx);
+ clnt_conf_t *conf = NULL;
+ gf_boolean_t destroy = _gf_false;
+
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx->remote_fd = rfd;
+ fdctx->reopen_attempts = 0;
+ fdctx->reopen_done = client_default_reopen_done;
+ if (!fdctx->released)
+ list_add_tail(&fdctx->sfd_pos, &conf->saved_fds);
+ else
+ destroy = _gf_true;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+ if (destroy)
+ client_fdctx_destroy(this, fdctx);
}
void
-client_child_up_reopen_done (clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
+client_child_up_reopen_done(clnt_fd_ctx_t *fdctx, int64_t rfd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- uint64_t fd_count = 0;
-
- conf = this->private;
-
- LOCK (&conf->rec_lock);
- {
- fd_count = --(conf->reopen_fd_count);
- }
- UNLOCK (&conf->rec_lock);
-
- client_reopen_done (fdctx, rfd, this);
- if (fd_count == 0) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
- "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
- client_notify_parents_child_up (this);
- }
+ clnt_conf_t *conf = NULL;
+ uint64_t fd_count = 0;
+
+ conf = this->private;
+
+ LOCK(&conf->rec_lock);
+ {
+ fd_count = --(conf->reopen_fd_count);
+ }
+ UNLOCK(&conf->rec_lock);
+
+ client_reopen_done(fdctx, rfd, this);
+ if (fd_count == 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
+ "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
+ client_notify_parents_child_up(this);
+ }
}
int
-client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfs3_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.",
- local->loc.path);
- } else {
- gf_msg_debug (frame->this->name, 0,
- "reopen on %s succeeded (remote-fd = %"PRId64")",
- local->loc.path, rsp.fd);
- }
-
- if (rsp.op_ret == -1) {
- ret = -1;
- goto out;
- }
-
- ret = 0;
+ int32_t ret = -1;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ } else {
+ gf_msg_debug(frame->this->name, 0,
+ "reopen on %s succeeded (remote-fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (rsp.op_ret == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- client_local_wipe (local);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
int
-client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfs3_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
-
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed",
- local->loc.path);
- } else {
- gf_msg (frame->this->name, GF_LOG_INFO, 0,
- PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded "
- "(fd = %"PRId64")", local->loc.path, rsp.fd);
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- goto out;
- }
+ int32_t ret = -1;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+
+ frame = myframe;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ } else {
+ gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "reopendir on %s succeeded "
+ "(fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ goto out;
+ }
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- client_local_wipe (local);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
static int
-protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopendir(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfs3_opendir_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
- local->fdctx = fdctx;
-
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- memcpy (req.gfid, fdctx->gfid, 16);
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- frame->local = local;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR,
- client3_3_reopendir_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
- }
-
- return 0;
+ int ret = -1;
+ gfs3_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+ local->fdctx = fdctx;
+
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ frame->local = local;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client3_3_reopendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-opendir request");
+ }
+
+ return 0;
out:
- if (local)
- client_local_wipe (local);
+ if (local)
+ client_local_wipe(local);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
-
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static int
-protocol_client_reopenfile (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopenfile(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfs3_open_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
-
- local->fdctx = fdctx;
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame->local = local;
-
- memcpy (req.gfid, fdctx->gfid, 16);
- req.flags = gf_flags_from_flags (fdctx->flags);
- req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL));
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client3_3_reopen_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
- }
-
- return 0;
+ int ret = -1;
+ gfs3_open_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+
+ local->fdctx = fdctx;
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame->local = local;
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.flags = gf_flags_from_flags(fdctx->flags);
+ req.flags = req.flags & (~(O_TRUNC | O_CREAT | O_EXCL));
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client3_3_reopen_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfs3_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-open request");
+ }
+
+ return 0;
out:
- if (frame) {
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- }
-
- if (local)
- client_local_wipe (local);
+ if (frame) {
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ }
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ if (local)
+ client_local_wipe(local);
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static void
-protocol_client_reopen (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopen(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- if (fdctx->is_dir)
- protocol_client_reopendir (fdctx, this);
- else
- protocol_client_reopenfile (fdctx, this);
+ if (fdctx->is_dir)
+ protocol_client_reopendir(fdctx, this);
+ else
+ protocol_client_reopenfile(fdctx, this);
}
/* v4.x + */
int
-client4_0_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_reopen_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfx_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
- xlator_t *this = NULL;
-
- frame = myframe;
- this = frame->this;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.",
- local->loc.path);
- } else {
- gf_msg_debug (frame->this->name, 0,
- "reopen on %s succeeded (remote-fd = %"PRId64")",
- local->loc.path, rsp.fd);
- }
-
- if (rsp.op_ret == -1) {
- ret = -1;
- goto out;
- }
-
- ret = 0;
+ int32_t ret = -1;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed.", local->loc.path);
+ } else {
+ gf_msg_debug(frame->this->name, 0,
+ "reopen on %s succeeded (remote-fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (rsp.op_ret == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = 0;
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
- client_local_wipe (local);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
int
-client4_0_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client4_0_reopendir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- int32_t ret = -1;
- gfx_open_rsp rsp = {0,};
- clnt_local_t *local = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- call_frame_t *frame = NULL;
-
- frame = myframe;
- local = frame->local;
- fdctx = local->fdctx;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "returning ENOTCONN");
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (rsp.op_ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, rsp.op_errno,
- PC_MSG_DIR_OP_FAILED, "reopendir on %s failed",
- local->loc.path);
- } else {
- gf_msg (frame->this->name, GF_LOG_INFO, 0,
- PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded "
- "(fd = %"PRId64")", local->loc.path, rsp.fd);
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- goto out;
- }
+ int32_t ret = -1;
+ gfx_open_rsp rsp = {
+ 0,
+ };
+ clnt_local_t *local = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ call_frame_t *frame = NULL;
+
+ frame = myframe;
+ local = frame->local;
+ fdctx = local->fdctx;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "returning ENOTCONN");
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (rsp.op_ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, rsp.op_errno,
+ PC_MSG_DIR_OP_FAILED, "reopendir on %s failed", local->loc.path);
+ } else {
+ gf_msg(frame->this->name, GF_LOG_INFO, 0, PC_MSG_DIR_OP_SUCCESS,
+ "reopendir on %s succeeded "
+ "(fd = %" PRId64 ")",
+ local->loc.path, rsp.fd);
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ goto out;
+ }
out:
- fdctx->reopen_done (fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
+ fdctx->reopen_done(fdctx, (rsp.op_ret) ? -1 : rsp.fd, frame->this);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- client_local_wipe (local);
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ client_local_wipe(local);
- return 0;
+ return 0;
}
static int
-protocol_client_reopendir_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopendir_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfx_opendir_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
- local->fdctx = fdctx;
-
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- memcpy (req.gfid, fdctx->gfid, 16);
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- frame->local = local;
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPENDIR,
- client4_0_reopendir_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_opendir_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-opendir request");
- }
-
- return 0;
+ int ret = -1;
+ gfx_opendir_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+ local->fdctx = fdctx;
+
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ frame->local = local;
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR,
+ client4_0_reopendir_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_opendir_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-opendir request");
+ }
+
+ return 0;
out:
- if (local)
- client_local_wipe (local);
+ if (local)
+ client_local_wipe(local);
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
-
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static int
-protocol_client_reopenfile_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopenfile_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- int ret = -1;
- gfx_open_req req = {{0,},};
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
-
- conf = this->private;
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame) {
- ret = -1;
- goto out;
- }
-
- local = mem_get0 (this->local_pool);
- if (!local) {
- ret = -1;
- goto out;
- }
-
- local->fdctx = fdctx;
- gf_uuid_copy (local->loc.gfid, fdctx->gfid);
- ret = loc_path (&local->loc, NULL);
- if (ret < 0)
- goto out;
-
- frame->local = local;
-
- memcpy (req.gfid, fdctx->gfid, 16);
- req.flags = gf_flags_from_flags (fdctx->flags);
- req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL));
-
- gf_msg_debug (frame->this->name, 0,
- "attempting reopen on %s", local->loc.path);
-
- ret = client_submit_request (this, &req, frame, conf->fops,
- GFS3_OP_OPEN, client4_0_reopen_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_open_req);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
- "failed to send the re-open request");
- }
-
- return 0;
+ int ret = -1;
+ gfx_open_req req = {
+ {
+ 0,
+ },
+ };
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+
+ conf = this->private;
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
+ local = mem_get0(this->local_pool);
+ if (!local) {
+ ret = -1;
+ goto out;
+ }
+
+ local->fdctx = fdctx;
+ gf_uuid_copy(local->loc.gfid, fdctx->gfid);
+ ret = loc_path(&local->loc, NULL);
+ if (ret < 0)
+ goto out;
+
+ frame->local = local;
+
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.flags = gf_flags_from_flags(fdctx->flags);
+ req.flags = req.flags & (~(O_TRUNC | O_CREAT | O_EXCL));
+
+ gf_msg_debug(frame->this->name, 0, "attempting reopen on %s",
+ local->loc.path);
+
+ ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN,
+ client4_0_reopen_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gfx_open_req);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
+ "failed to send the re-open request");
+ }
+
+ return 0;
out:
- if (frame) {
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- }
-
- if (local)
- client_local_wipe (local);
+ if (frame) {
+ frame->local = NULL;
+ STACK_DESTROY(frame->root);
+ }
- fdctx->reopen_done (fdctx, fdctx->remote_fd, this);
+ if (local)
+ client_local_wipe(local);
- return 0;
+ fdctx->reopen_done(fdctx, fdctx->remote_fd, this);
+ return 0;
}
static void
-protocol_client_reopen_v2 (clnt_fd_ctx_t *fdctx, xlator_t *this)
+protocol_client_reopen_v2(clnt_fd_ctx_t *fdctx, xlator_t *this)
{
- if (fdctx->is_dir)
- protocol_client_reopendir_v2 (fdctx, this);
- else
- protocol_client_reopenfile_v2 (fdctx, this);
+ if (fdctx->is_dir)
+ protocol_client_reopendir_v2(fdctx, this);
+ else
+ protocol_client_reopenfile_v2(fdctx, this);
}
gf_boolean_t
-__is_fd_reopen_in_progress (clnt_fd_ctx_t *fdctx)
+__is_fd_reopen_in_progress(clnt_fd_ctx_t *fdctx)
{
- if (fdctx->reopen_done == client_default_reopen_done)
- return _gf_false;
- return _gf_true;
+ if (fdctx->reopen_done == client_default_reopen_done)
+ return _gf_false;
+ return _gf_true;
}
void
-client_attempt_reopen (fd_t *fd, xlator_t *this)
+client_attempt_reopen(fd_t *fd, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- gf_boolean_t reopen = _gf_false;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ gf_boolean_t reopen = _gf_false;
- if (!fd || !this)
- goto out;
+ if (!fd || !this)
+ goto out;
- conf = this->private;
+ conf = this->private;
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
- goto out;
- }
-
- if (__is_fd_reopen_in_progress (fdctx))
- goto unlock;
- if (fdctx->remote_fd != -1)
- goto unlock;
-
- if (fdctx->reopen_attempts == CLIENT_REOPEN_MAX_ATTEMPTS) {
- reopen = _gf_true;
- fdctx->reopen_done = client_reopen_done;
- list_del_init (&fdctx->sfd_pos);
- } else {
- fdctx->reopen_attempts++;
- }
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ pthread_spin_unlock(&conf->fd_lock);
+ goto out;
}
-unlock:
- pthread_spin_unlock (&conf->fd_lock);
- if (reopen) {
- if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
- protocol_client_reopen_v2 (fdctx, this);
- else
- protocol_client_reopen (fdctx, this);
+
+ if (__is_fd_reopen_in_progress(fdctx))
+ goto unlock;
+ if (fdctx->remote_fd != -1)
+ goto unlock;
+
+ if (fdctx->reopen_attempts == CLIENT_REOPEN_MAX_ATTEMPTS) {
+ reopen = _gf_true;
+ fdctx->reopen_done = client_reopen_done;
+ list_del_init(&fdctx->sfd_pos);
+ } else {
+ fdctx->reopen_attempts++;
}
+ }
+unlock:
+ pthread_spin_unlock(&conf->fd_lock);
+ if (reopen) {
+ if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
+ protocol_client_reopen_v2(fdctx, this);
+ else
+ protocol_client_reopen(fdctx, this);
+ }
out:
- return;
+ return;
}
int
-client_post_handshake (call_frame_t *frame, xlator_t *this)
+client_post_handshake(call_frame_t *frame, xlator_t *this)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *tmp = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- struct list_head reopen_head;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *tmp = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ struct list_head reopen_head;
- int count = 0;
+ int count = 0;
- if (!this || !this->private)
- goto out;
+ if (!this || !this->private)
+ goto out;
- conf = this->private;
- INIT_LIST_HEAD (&reopen_head);
+ conf = this->private;
+ INIT_LIST_HEAD(&reopen_head);
- pthread_spin_lock (&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ list_for_each_entry_safe(fdctx, tmp, &conf->saved_fds, sfd_pos)
{
- list_for_each_entry_safe (fdctx, tmp, &conf->saved_fds,
- sfd_pos) {
- if (fdctx->remote_fd != -1)
- continue;
-
- fdctx->reopen_done = client_child_up_reopen_done;
- list_del_init (&fdctx->sfd_pos);
- list_add_tail (&fdctx->sfd_pos, &reopen_head);
- count++;
- }
- }
- pthread_spin_unlock (&conf->fd_lock);
-
- /* Delay notifying CHILD_UP to parents
- until all locks are recovered */
- if (count > 0) {
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_UP_NOTIFY_DELAY, "%d fds open - Delaying "
- "child_up until they are re-opened", count);
- client_save_number_fds (conf, count);
-
- list_for_each_entry_safe (fdctx, tmp, &reopen_head, sfd_pos) {
- list_del_init (&fdctx->sfd_pos);
-
- if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
- protocol_client_reopen_v2 (fdctx, this);
- else
- protocol_client_reopen (fdctx, this);
- }
- } else {
- gf_msg_debug (this->name, 0,
- "No fds to open - notifying all parents child "
- "up");
- client_notify_parents_child_up (this);
- }
+ if (fdctx->remote_fd != -1)
+ continue;
+
+ fdctx->reopen_done = client_child_up_reopen_done;
+ list_del_init(&fdctx->sfd_pos);
+ list_add_tail(&fdctx->sfd_pos, &reopen_head);
+ count++;
+ }
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ /* Delay notifying CHILD_UP to parents
+ until all locks are recovered */
+ if (count > 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY_DELAY,
+ "%d fds open - Delaying "
+ "child_up until they are re-opened",
+ count);
+ client_save_number_fds(conf, count);
+
+ list_for_each_entry_safe(fdctx, tmp, &reopen_head, sfd_pos)
+ {
+ list_del_init(&fdctx->sfd_pos);
+
+ if (conf->fops->progver == GLUSTER_FOP_VERSION_v2)
+ protocol_client_reopen_v2(fdctx, this);
+ else
+ protocol_client_reopen(fdctx, this);
+ }
+ } else {
+ gf_msg_debug(this->name, 0,
+ "No fds to open - notifying all parents child "
+ "up");
+ client_notify_parents_child_up(this);
+ }
out:
- return 0;
+ return 0;
}
int
-client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
+client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- xlator_t *this = NULL;
- dict_t *reply = NULL;
- char *process_uuid = NULL;
- char *remote_error = NULL;
- char *remote_subvol = NULL;
- gf_setvolume_rsp rsp = {0,};
- int ret = 0;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
- gf_boolean_t auth_fail = _gf_false;
- glusterfs_ctx_t *ctx = NULL;
-
- frame = myframe;
- this = frame->this;
- conf = this->private;
- GF_VALIDATE_OR_GOTO (this->name, conf, out);
- ctx = this->ctx;
- GF_VALIDATE_OR_GOTO (this->name, ctx, out);
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
- op_ret = -1;
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- op_ret = -1;
- goto out;
- }
- op_ret = rsp.op_ret;
- op_errno = gf_error_to_errno (rsp.op_errno);
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, op_errno,
- PC_MSG_VOL_SET_FAIL, "failed to set the volume");
- }
-
- reply = dict_new ();
- if (!reply)
- goto out;
-
- if (rsp.dict.dict_len) {
- ret = dict_unserialize (rsp.dict.dict_val,
- rsp.dict.dict_len, &reply);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
- "unserialize buffer to dict");
- goto out;
- }
- }
-
- ret = dict_get_str (reply, "ERROR", &remote_error);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_GET_FAILED, "failed to get ERROR "
- "string from reply dict");
- }
-
- ret = dict_get_str (reply, "process-uuid", &process_uuid);
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ xlator_t *this = NULL;
+ dict_t *reply = NULL;
+ char *process_uuid = NULL;
+ char *remote_error = NULL;
+ char *remote_subvol = NULL;
+ gf_setvolume_rsp rsp = {
+ 0,
+ };
+ int ret = 0;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+ gf_boolean_t auth_fail = _gf_false;
+ glusterfs_ctx_t *ctx = NULL;
+
+ frame = myframe;
+ this = frame->this;
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO(this->name, conf, out);
+ ctx = this->ctx;
+ GF_VALIDATE_OR_GOTO(this->name, ctx, out);
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ op_ret = -1;
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ op_ret = -1;
+ goto out;
+ }
+ op_ret = rsp.op_ret;
+ op_errno = gf_error_to_errno(rsp.op_errno);
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, op_errno, PC_MSG_VOL_SET_FAIL,
+ "failed to set the volume");
+ }
+
+ reply = dict_new();
+ if (!reply)
+ goto out;
+
+ if (rsp.dict.dict_len) {
+ ret = dict_unserialize(rsp.dict.dict_val, rsp.dict.dict_len, &reply);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_GET_FAILED, "failed to get "
- "'process-uuid' from reply dict");
- }
-
- if (op_ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, op_errno,
- PC_MSG_SETVOLUME_FAIL,
- "SETVOLUME on remote-host failed: %s", remote_error);
-
- errno = op_errno;
- if (remote_error &&
- (strcmp ("Authentication failed", remote_error) == 0)) {
- auth_fail = _gf_true;
- op_ret = 0;
- }
- if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
- (ctx->graph_id <= 1)) {
- /* A case of subdir not being present at the moment,
- ride on auth_fail framework to notify the error */
- /* Make sure this case is handled only in the new
- graph, so mount may fail in this case. In case
- of 'add-brick' etc, we need to continue retry */
- auth_fail = _gf_true;
- op_ret = 0;
- }
- if (op_errno == ESTALE) {
- ret = client_notify_dispatch (this,
- GF_EVENT_VOLFILE_MODIFIED,
- NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_VOLFILE_NOTIFY_FAILED,
- "notify of VOLFILE_MODIFIED failed");
- }
- goto out;
- }
-
- ret = dict_get_str (this->options, "remote-subvolume",
- &remote_subvol);
- if (ret || !remote_subvol) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'remote-subvolume' in the options");
- goto out;
- }
-
- uint32_t child_up_int;
- ret = dict_get_uint32 (reply, "child_up", &child_up_int);
- if (ret) {
- /*
- * This would happen in cases where the server trying to *
- * connect to this client is running an older version. Hence *
- * setting the child_up to _gf_true in this case. *
- */
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
- "failed to find key 'child_up' in the options");
- conf->child_up = _gf_true;
- } else {
- conf->child_up = (child_up_int != 0);
- }
-
- /* TODO: currently setpeer path is broken */
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0,
+ PC_MSG_DICT_UNSERIALIZE_FAIL,
+ "failed to "
+ "unserialize buffer to dict");
+ goto out;
+ }
+ }
+
+ ret = dict_get_str(reply, "ERROR", &remote_error);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "failed to get ERROR "
+ "string from reply dict");
+ }
+
+ ret = dict_get_str(reply, "process-uuid", &process_uuid);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_DICT_GET_FAILED,
+ "failed to get "
+ "'process-uuid' from reply dict");
+ }
+
+ if (op_ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, PC_MSG_SETVOLUME_FAIL,
+ "SETVOLUME on remote-host failed: %s", remote_error);
+
+ errno = op_errno;
+ if (remote_error &&
+ (strcmp("Authentication failed", remote_error) == 0)) {
+ auth_fail = _gf_true;
+ op_ret = 0;
+ }
+ if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
+ (ctx->graph_id <= 1)) {
+ /* A case of subdir not being present at the moment,
+ ride on auth_fail framework to notify the error */
+ /* Make sure this case is handled only in the new
+ graph, so mount may fail in this case. In case
+ of 'add-brick' etc, we need to continue retry */
+ auth_fail = _gf_true;
+ op_ret = 0;
+ }
+ if (op_errno == ESTALE) {
+ ret = client_notify_dispatch(this, GF_EVENT_VOLFILE_MODIFIED, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VOLFILE_NOTIFY_FAILED,
+ "notify of VOLFILE_MODIFIED failed");
+ }
+ goto out;
+ }
+
+ ret = dict_get_str(this->options, "remote-subvolume", &remote_subvol);
+ if (ret || !remote_subvol) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
+ "failed to find key 'remote-subvolume' in the options");
+ goto out;
+ }
+
+ uint32_t child_up_int;
+ ret = dict_get_uint32(reply, "child_up", &child_up_int);
+ if (ret) {
/*
- if (process_uuid && req->conn &&
- !strcmp (this->ctx->process_uuid, process_uuid)) {
- rpc_transport_t *peer_trans = NULL;
- uint64_t peertrans_int = 0;
+ * This would happen in cases where the server trying to *
+ * connect to this client is running an older version. Hence *
+ * setting the child_up to _gf_true in this case. *
+ */
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
+ "failed to find key 'child_up' in the options");
+ conf->child_up = _gf_true;
+ } else {
+ conf->child_up = (child_up_int != 0);
+ }
- ret = dict_get_uint64 (reply, "transport-ptr",
- &peertrans_int);
- if (ret)
- goto out;
+ /* TODO: currently setpeer path is broken */
+ /*
+ if (process_uuid && req->conn &&
+ !strcmp (this->ctx->process_uuid, process_uuid)) {
+ rpc_transport_t *peer_trans = NULL;
+ uint64_t peertrans_int = 0;
- gf_log (this->name, GF_LOG_WARNING,
- "attaching to the local volume '%s'",
- remote_subvol);
+ ret = dict_get_uint64 (reply, "transport-ptr",
+ &peertrans_int);
+ if (ret)
+ goto out;
- peer_trans = (void *) (long) (peertrans_int);
+ gf_log (this->name, GF_LOG_WARNING,
+ "attaching to the local volume '%s'",
+ remote_subvol);
- rpc_transport_setpeer (req->conn->trans, peer_trans);
- }
- */
+ peer_trans = (void *) (long) (peertrans_int);
+
+ rpc_transport_setpeer (req->conn->trans, peer_trans);
+ }
+ */
- conf->client_id = glusterfs_leaf_position(this);
+ conf->client_id = glusterfs_leaf_position(this);
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
- "Connected to %s, attached to remote volume '%s'.",
- conf->rpc->conn.name,
- remote_subvol);
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
+ "Connected to %s, attached to remote volume '%s'.",
+ conf->rpc->conn.name, remote_subvol);
- op_ret = 0;
- conf->connected = 1;
+ op_ret = 0;
+ conf->connected = 1;
- client_post_handshake (frame, frame->this);
+ client_post_handshake(frame, frame->this);
out:
- if (auth_fail) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
- "sending AUTH_FAILED event");
- ret = client_notify_dispatch (this, GF_EVENT_AUTH_FAILED, NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_AUTH_FAILED_NOTIFY_FAILED, "notify of "
- "AUTH_FAILED failed");
- conf->connected = 0;
- ret = -1;
- }
- if (-1 == op_ret) {
- /* Let the connection/re-connection happen in
- * background, for now, don't hang here,
- * tell the parents that i am all ok..
- */
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_CONNECTING_EVENT, "sending "
- "CHILD_CONNECTING event");
- ret = client_notify_dispatch (this, GF_EVENT_CHILD_CONNECTING,
- NULL);
- if (ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
- "notify of CHILD_CONNECTING failed");
- /*
- * The reconnection *won't* happen in the background (see
- * previous comment) unless we kill the current connection.
- */
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
- ret = 0;
- }
+ if (auth_fail) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
+ "sending AUTH_FAILED event");
+ ret = client_notify_dispatch(this, GF_EVENT_AUTH_FAILED, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED_NOTIFY_FAILED,
+ "notify of "
+ "AUTH_FAILED failed");
+ conf->connected = 0;
+ ret = -1;
+ }
+ if (-1 == op_ret) {
+ /* Let the connection/re-connection happen in
+ * background, for now, don't hang here,
+ * tell the parents that i am all ok..
+ */
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_CONNECTING_EVENT,
+ "sending "
+ "CHILD_CONNECTING event");
+ ret = client_notify_dispatch(this, GF_EVENT_CHILD_CONNECTING, NULL);
+ if (ret)
+ gf_msg(this->name, GF_LOG_INFO, 0,
+ PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
+ "notify of CHILD_CONNECTING failed");
+ /*
+ * The reconnection *won't* happen in the background (see
+ * previous comment) unless we kill the current connection.
+ */
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
+ ret = 0;
+ }
- free (rsp.dict.dict_val);
+ free(rsp.dict.dict_val);
- STACK_DESTROY (frame->root);
+ STACK_DESTROY(frame->root);
- if (reply)
- dict_unref (reply);
+ if (reply)
+ dict_unref(reply);
- return ret;
+ return ret;
}
int
-client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
+client_setvolume(xlator_t *this, struct rpc_clnt *rpc)
{
- int ret = 0;
- gf_setvolume_req req = {{0,},};
- call_frame_t *fr = NULL;
- char *process_uuid_xl = NULL;
- clnt_conf_t *conf = NULL;
- dict_t *options = NULL;
- char counter_str[32] = {0};
- char hostname[256] = {0,};
-
- options = this->options;
- conf = this->private;
-
- if (conf->fops) {
- ret = dict_set_int32 (options, "fops-version",
- conf->fops->prognum);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "version-fops(%d) in handshake msg",
- conf->fops->prognum);
- goto fail;
- }
- }
-
- if (conf->mgmt) {
- ret = dict_set_int32 (options, "mgmt-version", conf->mgmt->prognum);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "version-mgmt(%d) in handshake msg",
- conf->mgmt->prognum);
- goto fail;
- }
- }
-
- /*
- * Connection-id should always be unique so that server never gets to
- * reuse the previous connection resources so it cleans up the resources
- * on every disconnect. Otherwise it may lead to stale resources, i.e.
- * leaked file descriptors, inode/entry locks
- */
-
- snprintf (counter_str, sizeof (counter_str),
- "-%"PRIu64, conf->setvol_count);
- conf->setvol_count++;
-
- if (gethostname (hostname, 256) == -1) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- LG_MSG_GETHOSTNAME_FAILED, "gethostname: failed");
-
- goto fail;
- }
-
- ret = gf_asprintf (&process_uuid_xl, GLUSTER_PROCESS_UUID_FMT,
- this->ctx->process_uuid, this->graph->id, getpid(),
- hostname, this->name, counter_str);
- if (-1 == ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_PROCESS_UUID_SET_FAIL, "asprintf failed while "
- "setting process_uuid");
- goto fail;
- }
-
- ret = dict_set_dynstr (options, "process-uuid", process_uuid_xl);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-uuid(%s) in handshake msg",
- process_uuid_xl);
- goto fail;
- }
-
- ret = dict_set_str (options, "process-name", this->ctx->cmd_args.process_name);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set process-name in handshake msg");
- }
-
- ret = dict_set_str (options, "client-version", PACKAGE_VERSION);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set client-version(%s) in handshake msg",
- PACKAGE_VERSION);
- }
-
- if (this->ctx->cmd_args.volfile_server) {
- if (this->ctx->cmd_args.volfile_id) {
- ret = dict_set_str (options, "volfile-key",
- this->ctx->cmd_args.volfile_id);
- if (ret)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to "
- "set 'volfile-key'");
- }
- ret = dict_set_uint32 (options, "volfile-checksum",
- this->graph->volfile_checksum);
- if (ret)
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SET_FAILED, "failed to set "
- "'volfile-checksum'");
- }
-
- if (this->ctx->cmd_args.subdir_mount) {
- ret = dict_set_str (options, "subdir-mount",
- this->ctx->cmd_args.subdir_mount);
- if (ret) {
- gf_log (THIS->name, GF_LOG_ERROR,
- "Failed to set subdir_mount");
- /* It makes sense to fail, as per the CLI, we
- should be doing a subdir_mount */
- goto fail;
- }
- }
-
- /* Insert a dummy key value pair to avoid failure at server side for
- * clnt-lk-version with new clients.
- */
- ret = dict_set_uint32 (options, "clnt-lk-version", 1);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set clnt-lk-version(1) in handshake msg");
- }
-
- ret = dict_set_int32 (options, "opversion", GD_OP_VERSION_MAX);
+ int ret = 0;
+ gf_setvolume_req req = {
+ {
+ 0,
+ },
+ };
+ call_frame_t *fr = NULL;
+ char *process_uuid_xl = NULL;
+ clnt_conf_t *conf = NULL;
+ dict_t *options = NULL;
+ char counter_str[32] = {0};
+ char hostname[256] = {
+ 0,
+ };
+
+ options = this->options;
+ conf = this->private;
+
+ if (conf->fops) {
+ ret = dict_set_int32(options, "fops-version", conf->fops->prognum);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "Failed to set client opversion in handshake message");
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "version-fops(%d) in handshake msg",
+ conf->fops->prognum);
+ goto fail;
}
+ }
- ret = dict_serialized_length (options);
+ if (conf->mgmt) {
+ ret = dict_set_int32(options, "mgmt-version", conf->mgmt->prognum);
if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
- "failed to get serialized length of dict");
- ret = -1;
- goto fail;
- }
- req.dict.dict_len = ret;
- req.dict.dict_val = GF_CALLOC (1, req.dict.dict_len,
- gf_client_mt_clnt_req_buf_t);
- ret = dict_serialize (options, req.dict.dict_val);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_DICT_SERIALIZE_FAIL, "failed to serialize "
- "dictionary");
- goto fail;
- }
-
- fr = create_frame (this, this->ctx->pool);
- if (!fr)
- goto fail;
-
- ret = client_submit_request (this, &req, fr, conf->handshake,
- GF_HNDSK_SETVOLUME, client_setvolume_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gf_setvolume_req);
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "version-mgmt(%d) in handshake msg",
+ conf->mgmt->prognum);
+ goto fail;
+ }
+ }
+
+ /*
+ * Connection-id should always be unique so that server never gets to
+ * reuse the previous connection resources so it cleans up the resources
+ * on every disconnect. Otherwise it may lead to stale resources, i.e.
+ * leaked file descriptors, inode/entry locks
+ */
+
+ snprintf(counter_str, sizeof(counter_str), "-%" PRIu64, conf->setvol_count);
+ conf->setvol_count++;
+
+ if (gethostname(hostname, 256) == -1) {
+ gf_msg(this->name, GF_LOG_ERROR, errno, LG_MSG_GETHOSTNAME_FAILED,
+ "gethostname: failed");
+
+ goto fail;
+ }
+
+ ret = gf_asprintf(&process_uuid_xl, GLUSTER_PROCESS_UUID_FMT,
+ this->ctx->process_uuid, this->graph->id, getpid(),
+ hostname, this->name, counter_str);
+ if (-1 == ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PROCESS_UUID_SET_FAIL,
+ "asprintf failed while "
+ "setting process_uuid");
+ goto fail;
+ }
+
+ ret = dict_set_dynstr(options, "process-uuid", process_uuid_xl);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set process-uuid(%s) in handshake msg",
+ process_uuid_xl);
+ goto fail;
+ }
+
+ ret = dict_set_str(options, "process-name",
+ this->ctx->cmd_args.process_name);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set process-name in handshake msg");
+ }
+
+ ret = dict_set_str(options, "client-version", PACKAGE_VERSION);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set client-version(%s) in handshake msg",
+ PACKAGE_VERSION);
+ }
+
+ if (this->ctx->cmd_args.volfile_server) {
+ if (this->ctx->cmd_args.volfile_id) {
+ ret = dict_set_str(options, "volfile-key",
+ this->ctx->cmd_args.volfile_id);
+ if (ret)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to "
+ "set 'volfile-key'");
+ }
+ ret = dict_set_uint32(options, "volfile-checksum",
+ this->graph->volfile_checksum);
+ if (ret)
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set "
+ "'volfile-checksum'");
+ }
+
+ if (this->ctx->cmd_args.subdir_mount) {
+ ret = dict_set_str(options, "subdir-mount",
+ this->ctx->cmd_args.subdir_mount);
+ if (ret) {
+ gf_log(THIS->name, GF_LOG_ERROR, "Failed to set subdir_mount");
+ /* It makes sense to fail, as per the CLI, we
+ should be doing a subdir_mount */
+ goto fail;
+ }
+ }
+
+ /* Insert a dummy key value pair to avoid failure at server side for
+ * clnt-lk-version with new clients.
+ */
+ ret = dict_set_uint32(options, "clnt-lk-version", 1);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set clnt-lk-version(1) in handshake msg");
+ }
+
+ ret = dict_set_int32(options, "opversion", GD_OP_VERSION_MAX);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "Failed to set client opversion in handshake message");
+ }
+
+ ret = dict_serialized_length(options);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
+ "failed to get serialized length of dict");
+ ret = -1;
+ goto fail;
+ }
+ req.dict.dict_len = ret;
+ req.dict.dict_val = GF_CALLOC(1, req.dict.dict_len,
+ gf_client_mt_clnt_req_buf_t);
+ ret = dict_serialize(options, req.dict.dict_val);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SERIALIZE_FAIL,
+ "failed to serialize "
+ "dictionary");
+ goto fail;
+ }
+
+ fr = create_frame(this, this->ctx->pool);
+ if (!fr)
+ goto fail;
+
+ ret = client_submit_request(this, &req, fr, conf->handshake,
+ GF_HNDSK_SETVOLUME, client_setvolume_cbk, NULL,
+ NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_setvolume_req);
fail:
- GF_FREE (req.dict.dict_val);
+ GF_FREE(req.dict.dict_val);
- return ret;
+ return ret;
}
int
-select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)
+select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
{
- gf_prog_detail *trav = NULL;
- clnt_conf_t *conf = NULL;
- int ret = -1;
-
- if (!this || !prog) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
- goto out;
+ gf_prog_detail *trav = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+
+ if (!this || !prog) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "xlator not found OR RPC program not found");
+ goto out;
+ }
+
+ conf = this->private;
+ trav = prog;
+
+ while (trav) {
+ /* Select 'programs' */
+ if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
+ (clnt3_3_fop_prog.progver == trav->progver) && !conf->fops) {
+ conf->fops = &clnt3_3_fop_prog;
+ if (conf->rpc)
+ conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
+ ret = 0;
+ }
+
+ if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
+ (clnt4_0_fop_prog.progver == trav->progver)) {
+ conf->fops = &clnt4_0_fop_prog;
+ if (conf->rpc)
+ conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
+ ret = 0;
+ /* this is latest program, lets use it */
+ goto out;
}
- conf = this->private;
- trav = prog;
-
- while (trav) {
- /* Select 'programs' */
- if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
- (clnt3_3_fop_prog.progver == trav->progver) &&
- !conf->fops) {
- conf->fops = &clnt3_3_fop_prog;
- if (conf->rpc)
- conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
- ret = 0;
- }
-
- if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
- (clnt4_0_fop_prog.progver == trav->progver)) {
- conf->fops = &clnt4_0_fop_prog;
- if (conf->rpc)
- conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
- ret = 0;
- /* this is latest program, lets use it */
- goto out;
- }
-
- if (ret) {
- gf_msg_debug (this->name, 0,
- "%s (%"PRId64") not supported",
- trav->progname, trav->progver);
- }
- trav = trav->next;
+ if (ret) {
+ gf_msg_debug(this->name, 0, "%s (%" PRId64 ") not supported",
+ trav->progname, trav->progver);
}
+ trav = trav->next;
+ }
- if (!ret)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_VERSION_INFO, "Using Program %s,"
- " Num (%d), Version (%d)",
- conf->fops->progname, conf->fops->prognum,
- conf->fops->progver);
+ if (!ret)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VERSION_INFO,
+ "Using Program %s,"
+ " Num (%d), Version (%d)",
+ conf->fops->progname, conf->fops->prognum, conf->fops->progver);
out:
- return ret;
+ return ret;
}
-
int
-server_has_portmap (xlator_t *this, gf_prog_detail *prog)
+server_has_portmap(xlator_t *this, gf_prog_detail *prog)
{
- gf_prog_detail *trav = NULL;
- int ret = -1;
+ gf_prog_detail *trav = NULL;
+ int ret = -1;
- if (!this || !prog) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "xlator not found OR RPC program not found");
- goto out;
- }
+ if (!this || !prog) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "xlator not found OR RPC program not found");
+ goto out;
+ }
- trav = prog;
+ trav = prog;
- while (trav) {
- if ((trav->prognum == GLUSTER_PMAP_PROGRAM) &&
- (trav->progver == GLUSTER_PMAP_VERSION)) {
- gf_msg_debug (this->name, 0,
- "detected portmapper on server");
- ret = 0;
- break;
- }
- trav = trav->next;
+ while (trav) {
+ if ((trav->prognum == GLUSTER_PMAP_PROGRAM) &&
+ (trav->progver == GLUSTER_PMAP_VERSION)) {
+ gf_msg_debug(this->name, 0, "detected portmapper on server");
+ ret = 0;
+ break;
}
+ trav = trav->next;
+ }
out:
- return ret;
+ return ret;
}
-
int
-client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe)
+client_query_portmap_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- struct pmap_port_by_brick_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- int ret = -1;
- struct rpc_clnt_config config = {0, };
- xlator_t *this = NULL;
-
- frame = myframe;
- if (!frame || !frame->this || !frame->this->private) {
- gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "frame not found with rpc "
- "request");
- goto out;
- }
- this = frame->this;
- conf = frame->this->private;
-
- if (-1 == req->rpc_status) {
- gf_msg (this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
- "try again later");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
-
- if (-1 == rsp.op_ret) {
- ret = -1;
- if (!conf->portmap_err_logged) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- PC_MSG_PORT_NUM_ERROR, "failed to get the "
- "port number for remote subvolume. Please run "
- "'gluster volume status' on server to see if "
- "brick process is running.");
- } else {
- gf_msg_debug (this->name, 0,
- "failed to get the port number for "
- "remote subvolume. Please run 'gluster "
- "volume status' on server to see "
- "if brick process is running.");
- }
- conf->portmap_err_logged = 1;
- goto out;
+ struct pmap_port_by_brick_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = -1;
+ struct rpc_clnt_config config = {
+ 0,
+ };
+ xlator_t *this = NULL;
+
+ frame = myframe;
+ if (!frame || !frame->this || !frame->this->private) {
+ gf_msg(THIS->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY,
+ "frame not found with rpc "
+ "request");
+ goto out;
+ }
+ this = frame->this;
+ conf = frame->this->private;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOTCONN, PC_MSG_RPC_STATUS_ERROR,
+ "received RPC status error, "
+ "try again later");
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ goto out;
+ }
+
+ if (-1 == rsp.op_ret) {
+ ret = -1;
+ if (!conf->portmap_err_logged) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_PORT_NUM_ERROR,
+ "failed to get the "
+ "port number for remote subvolume. Please run "
+ "'gluster volume status' on server to see if "
+ "brick process is running.");
+ } else {
+ gf_msg_debug(this->name, 0,
+ "failed to get the port number for "
+ "remote subvolume. Please run 'gluster "
+ "volume status' on server to see "
+ "if brick process is running.");
}
+ conf->portmap_err_logged = 1;
+ goto out;
+ }
- conf->portmap_err_logged = 0;
- conf->disconnect_err_logged = 0;
- config.remote_port = rsp.port;
- rpc_clnt_reconfig (conf->rpc, &config);
+ conf->portmap_err_logged = 0;
+ conf->disconnect_err_logged = 0;
+ config.remote_port = rsp.port;
+ rpc_clnt_reconfig(conf->rpc, &config);
- conf->skip_notify = 1;
- conf->quick_reconnect = 1;
+ conf->skip_notify = 1;
+ conf->quick_reconnect = 1;
out:
- if (frame)
- STACK_DESTROY (frame->root);
+ if (frame)
+ STACK_DESTROY(frame->root);
- if (conf) {
- /* Need this to connect the same transport on different port */
- /* ie, glusterd to glusterfsd */
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
- }
+ if (conf) {
+ /* Need this to connect the same transport on different port */
+ /* ie, glusterd to glusterfsd */
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
+ }
- return ret;
+ return ret;
}
-
int
-client_query_portmap (xlator_t *this, struct rpc_clnt *rpc)
+client_query_portmap(xlator_t *this, struct rpc_clnt *rpc)
{
- int ret = -1;
- pmap_port_by_brick_req req = {0,};
- call_frame_t *fr = NULL;
- dict_t *options = NULL;
- char *remote_subvol = NULL;
- char *xprt = NULL;
- char brick_name[PATH_MAX] = {0,};
-
- options = this->options;
-
- ret = dict_get_str (options, "remote-subvolume", &remote_subvol);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
- "remote-subvolume not set in volfile");
- goto fail;
- }
-
- req.brick = remote_subvol;
-
- if (!dict_get_str (options, "transport-type", &xprt)) {
- if (!strcmp (xprt, "rdma")) {
- snprintf (brick_name, sizeof(brick_name), "%s.rdma",
- remote_subvol);
- req.brick = brick_name;
- }
- }
-
- fr = create_frame (this, this->ctx->pool);
- if (!fr) {
- ret = -1;
- goto fail;
- }
-
- ret = client_submit_request (this, &req, fr, &clnt_pmap_prog,
- GF_PMAP_PORTBYBRICK,
- client_query_portmap_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_pmap_port_by_brick_req);
+ int ret = -1;
+ pmap_port_by_brick_req req = {
+ 0,
+ };
+ call_frame_t *fr = NULL;
+ dict_t *options = NULL;
+ char *remote_subvol = NULL;
+ char *xprt = NULL;
+ char brick_name[PATH_MAX] = {
+ 0,
+ };
+
+ options = this->options;
+
+ ret = dict_get_str(options, "remote-subvolume", &remote_subvol);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
+ "remote-subvolume not set in volfile");
+ goto fail;
+ }
+
+ req.brick = remote_subvol;
+
+ if (!dict_get_str(options, "transport-type", &xprt)) {
+ if (!strcmp(xprt, "rdma")) {
+ snprintf(brick_name, sizeof(brick_name), "%s.rdma", remote_subvol);
+ req.brick = brick_name;
+ }
+ }
+
+ fr = create_frame(this, this->ctx->pool);
+ if (!fr) {
+ ret = -1;
+ goto fail;
+ }
+
+ ret = client_submit_request(this, &req, fr, &clnt_pmap_prog,
+ GF_PMAP_PORTBYBRICK, client_query_portmap_cbk,
+ NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_pmap_port_by_brick_req);
fail:
- return ret;
+ return ret;
}
-
int
-client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client_dump_version_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gf_dump_rsp rsp = {0,};
- gf_prog_detail *trav = NULL;
- gf_prog_detail *next = NULL;
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- int ret = 0;
-
- frame = myframe;
- conf = frame->this->private;
-
- if (-1 == req->rpc_status) {
- gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
- PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
- goto out;
- }
-
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
- if (ret < 0) {
- gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- goto out;
- }
- if (-1 == rsp.op_ret) {
- gf_msg (frame->this->name, GF_LOG_WARNING, 0,
- PC_MSG_VERSION_ERROR, "failed to get the 'versions' "
- "from server");
- goto out;
- }
-
- if (server_has_portmap (frame->this, rsp.prog) == 0) {
- ret = client_query_portmap (frame->this, conf->rpc);
- goto out;
- }
-
- /* Check for the proper version string */
- /* Reply in "Name:Program-Number:Program-Version,..." format */
- ret = select_server_supported_programs (frame->this, rsp.prog);
- if (ret) {
- gf_msg (frame->this->name, GF_LOG_ERROR, 0,
- PC_MSG_VERSION_ERROR, "server doesn't support the "
- "version");
- goto out;
- }
-
- client_setvolume (frame->this, conf->rpc);
+ gf_dump_rsp rsp = {
+ 0,
+ };
+ gf_prog_detail *trav = NULL;
+ gf_prog_detail *next = NULL;
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ int ret = 0;
+
+ frame = myframe;
+ conf = frame->this->private;
+
+ if (-1 == req->rpc_status) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOTCONN,
+ PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
+ goto out;
+ }
+
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
+ if (ret < 0) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, EINVAL,
+ PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
+ goto out;
+ }
+ if (-1 == rsp.op_ret) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0, PC_MSG_VERSION_ERROR,
+ "failed to get the 'versions' "
+ "from server");
+ goto out;
+ }
+
+ if (server_has_portmap(frame->this, rsp.prog) == 0) {
+ ret = client_query_portmap(frame->this, conf->rpc);
+ goto out;
+ }
+
+ /* Check for the proper version string */
+ /* Reply in "Name:Program-Number:Program-Version,..." format */
+ ret = select_server_supported_programs(frame->this, rsp.prog);
+ if (ret) {
+ gf_msg(frame->this->name, GF_LOG_ERROR, 0, PC_MSG_VERSION_ERROR,
+ "server doesn't support the "
+ "version");
+ goto out;
+ }
+
+ client_setvolume(frame->this, conf->rpc);
out:
- /* don't use GF_FREE, buffer was allocated by libc */
- if (rsp.prog) {
- trav = rsp.prog;
- while (trav) {
- next = trav->next;
- free (trav->progname);
- free (trav);
- trav = next;
- }
+ /* don't use GF_FREE, buffer was allocated by libc */
+ if (rsp.prog) {
+ trav = rsp.prog;
+ while (trav) {
+ next = trav->next;
+ free(trav->progname);
+ free(trav);
+ trav = next;
}
+ }
- STACK_DESTROY (frame->root);
+ STACK_DESTROY(frame->root);
- if (ret != 0)
- rpc_transport_disconnect (conf->rpc->conn.trans, _gf_false);
+ if (ret != 0)
+ rpc_transport_disconnect(conf->rpc->conn.trans, _gf_false);
- return ret;
+ return ret;
}
int
-client_handshake (xlator_t *this, struct rpc_clnt *rpc)
+client_handshake(xlator_t *this, struct rpc_clnt *rpc)
{
- call_frame_t *frame = NULL;
- clnt_conf_t *conf = NULL;
- gf_dump_req req = {0,};
- int ret = 0;
-
- conf = this->private;
- if (!conf->handshake) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
- "handshake program not found");
- goto out;
- }
-
- frame = create_frame (this, this->ctx->pool);
- if (!frame)
- goto out;
-
- req.gfs_id = 0xbabe;
- ret = client_submit_request (this, &req, frame, conf->dump,
- GF_DUMP_DUMP, client_dump_version_cbk,
- NULL, NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gf_dump_req);
+ call_frame_t *frame = NULL;
+ clnt_conf_t *conf = NULL;
+ gf_dump_req req = {
+ 0,
+ };
+ int ret = 0;
+
+ conf = this->private;
+ if (!conf->handshake) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+ "handshake program not found");
+ goto out;
+ }
+
+ frame = create_frame(this, this->ctx->pool);
+ if (!frame)
+ goto out;
+
+ req.gfs_id = 0xbabe;
+ ret = client_submit_request(this, &req, frame, conf->dump, GF_DUMP_DUMP,
+ client_dump_version_cbk, NULL, NULL, 0, NULL, 0,
+ NULL, (xdrproc_t)xdr_gf_dump_req);
out:
- return ret;
+ return ret;
}
char *clnt_handshake_procs[GF_HNDSK_MAXVALUE] = {
- [GF_HNDSK_NULL] = "NULL",
- [GF_HNDSK_SETVOLUME] = "SETVOLUME",
- [GF_HNDSK_GETSPEC] = "GETSPEC",
- [GF_HNDSK_PING] = "PING",
+ [GF_HNDSK_NULL] = "NULL",
+ [GF_HNDSK_SETVOLUME] = "SETVOLUME",
+ [GF_HNDSK_GETSPEC] = "GETSPEC",
+ [GF_HNDSK_PING] = "PING",
};
rpc_clnt_prog_t clnt_handshake_prog = {
- .progname = "GlusterFS Handshake",
- .prognum = GLUSTER_HNDSK_PROGRAM,
- .progver = GLUSTER_HNDSK_VERSION,
- .procnames = clnt_handshake_procs,
+ .progname = "GlusterFS Handshake",
+ .prognum = GLUSTER_HNDSK_PROGRAM,
+ .progver = GLUSTER_HNDSK_VERSION,
+ .procnames = clnt_handshake_procs,
};
char *clnt_dump_proc[GF_DUMP_MAXVALUE] = {
- [GF_DUMP_NULL] = "NULL",
- [GF_DUMP_DUMP] = "DUMP",
+ [GF_DUMP_NULL] = "NULL",
+ [GF_DUMP_DUMP] = "DUMP",
};
rpc_clnt_prog_t clnt_dump_prog = {
- .progname = "GF-DUMP",
- .prognum = GLUSTER_DUMP_PROGRAM,
- .progver = GLUSTER_DUMP_VERSION,
- .procnames = clnt_dump_proc,
+ .progname = "GF-DUMP",
+ .prognum = GLUSTER_DUMP_PROGRAM,
+ .progver = GLUSTER_DUMP_VERSION,
+ .procnames = clnt_dump_proc,
};
char *clnt_pmap_procs[GF_PMAP_MAXVALUE] = {
- [GF_PMAP_PORTBYBRICK] = "PORTBYBRICK",
+ [GF_PMAP_PORTBYBRICK] = "PORTBYBRICK",
};
rpc_clnt_prog_t clnt_pmap_prog = {
- .progname = "PORTMAP",
- .prognum = GLUSTER_PMAP_PROGRAM,
- .progver = GLUSTER_PMAP_VERSION,
- .procnames = clnt_pmap_procs,
+ .progname = "PORTMAP",
+ .prognum = GLUSTER_PMAP_PROGRAM,
+ .progver = GLUSTER_PMAP_VERSION,
+ .procnames = clnt_pmap_procs,
};
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index f077fc2..e81f166 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -16,3007 +16,2761 @@
#include "common-utils.h"
int
-client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
+client_fd_lk_list_empty(fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
{
- int ret = 1;
+ int ret = 1;
- if (!lk_ctx) {
- ret = -1;
- goto out;
- }
+ if (!lk_ctx) {
+ ret = -1;
+ goto out;
+ }
- if (try_lock) {
- ret = TRY_LOCK (&lk_ctx->lock);
- if (ret != 0) {
- ret = -1;
- goto out;
- }
- } else {
- LOCK (&lk_ctx->lock);
+ if (try_lock) {
+ ret = TRY_LOCK(&lk_ctx->lock);
+ if (ret != 0) {
+ ret = -1;
+ goto out;
}
+ } else {
+ LOCK(&lk_ctx->lock);
+ }
- ret = list_empty (&lk_ctx->lk_list);
- UNLOCK (&lk_ctx->lock);
+ ret = list_empty(&lk_ctx->lk_list);
+ UNLOCK(&lk_ctx->lock);
out:
- return ret;
+ return ret;
}
clnt_fd_ctx_t *
-this_fd_del_ctx (fd_t *file, xlator_t *this)
+this_fd_del_ctx(fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
- dict_ret = fd_ctx_del (file, this, &ctxaddr);
+ dict_ret = fd_ctx_del(file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
}
-
clnt_fd_ctx_t *
-this_fd_get_ctx (fd_t *file, xlator_t *this)
+this_fd_get_ctx(fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
- dict_ret = fd_ctx_get (file, this, &ctxaddr);
+ dict_ret = fd_ctx_get(file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (clnt_fd_ctx_t *)(unsigned long)ctxaddr;
}
-
void
-this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
+this_fd_set_ctx(fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
{
- uint64_t oldaddr = 0;
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
-
- ret = fd_ctx_get (file, this, &oldaddr);
- if (ret >= 0) {
- if (loc)
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_FD_DUPLICATE_TRY,
- "%s (%s): trying duplicate remote fd set. ",
- loc->path, uuid_utoa (loc->inode->gfid));
- else
- gf_msg (this->name, GF_LOG_INFO, 0,
- PC_MSG_FD_DUPLICATE_TRY,
- "%p: trying duplicate remote fd set. ", file);
- }
-
- ret = fd_ctx_set (file, this, (uint64_t)(unsigned long)ctx);
- if (ret < 0) {
- if (loc)
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_FD_SET_FAIL,
- "%s (%s): failed to set remote fd",
- loc->path, uuid_utoa (loc->inode->gfid));
- else
- gf_msg (this->name, GF_LOG_WARNING, 0,
- PC_MSG_FD_SET_FAIL,
- "%p: failed to set remote fd", file);
- }
+ uint64_t oldaddr = 0;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, file, out);
+
+ ret = fd_ctx_get(file, this, &oldaddr);
+ if (ret >= 0) {
+ if (loc)
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "%s (%s): trying duplicate remote fd set. ", loc->path,
+ uuid_utoa(loc->inode->gfid));
+ else
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_FD_DUPLICATE_TRY,
+ "%p: trying duplicate remote fd set. ", file);
+ }
+
+ ret = fd_ctx_set(file, this, (uint64_t)(unsigned long)ctx);
+ if (ret < 0) {
+ if (loc)
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "%s (%s): failed to set remote fd", loc->path,
+ uuid_utoa(loc->inode->gfid));
+ else
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_SET_FAIL,
+ "%p: failed to set remote fd", file);
+ }
out:
- return;
+ return;
}
-
int
-client_local_wipe (clnt_local_t *local)
+client_local_wipe(clnt_local_t *local)
{
- if (local) {
- loc_wipe (&local->loc);
- loc_wipe (&local->loc2);
-
- if (local->fd) {
- fd_unref (local->fd);
- }
+ if (local) {
+ loc_wipe(&local->loc);
+ loc_wipe(&local->loc2);
- if (local->iobref) {
- iobref_unref (local->iobref);
- }
+ if (local->fd) {
+ fd_unref(local->fd);
+ }
- GF_FREE (local->name);
- local->compound_args = NULL;
- mem_put (local);
+ if (local->iobref) {
+ iobref_unref(local->iobref);
}
- return 0;
+ GF_FREE(local->name);
+ local->compound_args = NULL;
+ mem_put(local);
+ }
+
+ return 0;
}
int
-unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp,
- gf_dirent_t *entries)
+unserialize_rsp_dirent(xlator_t *this, struct gfs3_readdir_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfs3_dirlist *trav = NULL;
- gf_dirent_t *entry = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_dirlist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
+ conf = this->private;
- trav = rsp->reply;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ trav = rsp->reply;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-unserialize_rsp_direntp (xlator_t *this, fd_t *fd,
- struct gfs3_readdirp_rsp *rsp, gf_dirent_t *entries)
+unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfs3_dirplist *trav = NULL;
- char *buf = NULL;
- gf_dirent_t *entry = NULL;
- inode_table_t *itable = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
-
- trav = rsp->reply;
+ struct gfs3_dirplist *trav = NULL;
+ char *buf = NULL;
+ gf_dirent_t *entry = NULL;
+ inode_table_t *itable = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+
+ trav = rsp->reply;
+
+ if (fd)
+ itable = fd->inode->table;
+
+ conf = this->private;
+ if (!conf)
+ goto out;
+
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
+
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
+
+ gf_stat_to_iatt(&trav->stat, &entry->d_stat);
+
+ strcpy(entry->d_name, trav->name);
+
+ if (trav->dict.dict_val) {
+ /* Dictionary is sent along with response */
+ buf = memdup(trav->dict.dict_val, trav->dict.dict_len);
+ if (!buf)
+ goto out;
- if (fd)
- itable = fd->inode->table;
+ entry->dict = dict_new();
- conf = this->private;
- if (!conf)
+ ret = dict_unserialize(buf, trav->dict.dict_len, &entry->dict);
+ if (ret < 0) {
+ gf_msg(THIS->name, GF_LOG_WARNING, EINVAL,
+ PC_MSG_DICT_UNSERIALIZE_FAIL,
+ "failed to unserialize xattr dict");
goto out;
+ }
+ GF_FREE(buf);
+ buf = NULL;
+ }
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
-
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
-
- gf_stat_to_iatt (&trav->stat, &entry->d_stat);
-
- strcpy (entry->d_name, trav->name);
-
- if (trav->dict.dict_val) {
- /* Dictionary is sent along with response */
- buf = memdup (trav->dict.dict_val, trav->dict.dict_len);
- if (!buf)
- goto out;
-
- entry->dict = dict_new ();
-
- ret = dict_unserialize (buf, trav->dict.dict_len,
- &entry->dict);
- if (ret < 0) {
- gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_DICT_UNSERIALIZE_FAIL,
- "failed to unserialize xattr dict");
- goto out;
- }
- GF_FREE (buf);
- buf = NULL;
- }
-
- entry->inode = inode_find (itable, entry->d_stat.ia_gfid);
- if (!entry->inode)
- entry->inode = inode_new (itable);
+ entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
+ if (!entry->inode)
+ entry->inode = inode_new(itable);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- if (buf)
- GF_FREE (buf);
- return ret;
+ if (buf)
+ GF_FREE(buf);
+ return ret;
}
int
-clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp)
+clnt_readdirp_rsp_cleanup(gfs3_readdirp_rsp *rsp)
{
- gfs3_dirplist *prev = NULL;
- gfs3_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirplist *prev = NULL;
+ gfs3_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->dict.dict_val);
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->dict.dict_val);
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-unserialize_rsp_dirent_v2 (xlator_t *this, struct gfx_readdir_rsp *rsp,
- gf_dirent_t *entries)
+unserialize_rsp_dirent_v2(xlator_t *this, struct gfx_readdir_rsp *rsp,
+ gf_dirent_t *entries)
{
- struct gfx_dirlist *trav = NULL;
- gf_dirent_t *entry = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfx_dirlist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- conf = this->private;
+ conf = this->private;
- trav = rsp->reply;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ trav = rsp->reply;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-unserialize_rsp_direntp_v2 (xlator_t *this, fd_t *fd,
- struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
+unserialize_rsp_direntp_v2(xlator_t *this, fd_t *fd,
+ struct gfx_readdirp_rsp *rsp, gf_dirent_t *entries)
{
- struct gfx_dirplist *trav = NULL;
- gf_dirent_t *entry = NULL;
- inode_table_t *itable = NULL;
- int entry_len = 0;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfx_dirplist *trav = NULL;
+ gf_dirent_t *entry = NULL;
+ inode_table_t *itable = NULL;
+ int entry_len = 0;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- if (fd)
- itable = fd->inode->table;
+ if (fd)
+ itable = fd->inode->table;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- entry_len = gf_dirent_size (trav->name);
- entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t);
- if (!entry)
- goto out;
+ while (trav) {
+ entry_len = gf_dirent_size(trav->name);
+ entry = GF_CALLOC(1, entry_len, gf_common_mt_gf_dirent_t);
+ if (!entry)
+ goto out;
- entry->d_ino = trav->d_ino;
- gf_itransform (this, trav->d_off, &entry->d_off,
- conf->client_id);
- entry->d_len = trav->d_len;
- entry->d_type = trav->d_type;
+ entry->d_ino = trav->d_ino;
+ gf_itransform(this, trav->d_off, &entry->d_off, conf->client_id);
+ entry->d_len = trav->d_len;
+ entry->d_type = trav->d_type;
- gfx_stat_to_iattx (&trav->stat, &entry->d_stat);
+ gfx_stat_to_iattx(&trav->stat, &entry->d_stat);
- strcpy (entry->d_name, trav->name);
+ strcpy(entry->d_name, trav->name);
- xdr_to_dict (&trav->dict, &entry->dict);
+ xdr_to_dict(&trav->dict, &entry->dict);
- entry->inode = inode_find (itable, entry->d_stat.ia_gfid);
- if (!entry->inode)
- entry->inode = inode_new (itable);
+ entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
+ if (!entry->inode)
+ entry->inode = inode_new(itable);
- list_add_tail (&entry->list, &entries->list);
+ list_add_tail(&entry->list, &entries->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-clnt_readdirp_rsp_cleanup_v2 (gfx_readdirp_rsp *rsp)
+clnt_readdirp_rsp_cleanup_v2(gfx_readdirp_rsp *rsp)
{
- gfx_dirplist *prev = NULL;
- gfx_dirplist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirplist *prev = NULL;
+ gfx_dirplist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp)
+clnt_readdir_rsp_cleanup(gfs3_readdir_rsp *rsp)
{
- gfs3_dirlist *prev = NULL;
- gfs3_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfs3_dirlist *prev = NULL;
+ gfs3_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-clnt_readdir_rsp_cleanup_v2 (gfx_readdir_rsp *rsp)
+clnt_readdir_rsp_cleanup_v2(gfx_readdir_rsp *rsp)
{
- gfx_dirlist *prev = NULL;
- gfx_dirlist *trav = NULL;
-
- trav = rsp->reply;
+ gfx_dirlist *prev = NULL;
+ gfx_dirlist *trav = NULL;
+
+ trav = rsp->reply;
+ prev = trav;
+ while (trav) {
+ trav = trav->nextentry;
+ /* on client, the rpc lib allocates this */
+ free(prev->name);
+ free(prev);
prev = trav;
- while (trav) {
- trav = trav->nextentry;
- /* on client, the rpc lib allocates this */
- free (prev->name);
- free (prev);
- prev = trav;
- }
+ }
- return 0;
+ return 0;
}
int
-client_get_remote_fd (xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
+client_get_remote_fd(xlator_t *this, fd_t *fd, int flags, int64_t *remote_fd)
{
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_conf_t *conf = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, fd, out);
- GF_VALIDATE_OR_GOTO (this->name, remote_fd, out);
-
- conf = this->private;
- pthread_spin_lock (&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- *remote_fd = GF_ANON_FD_NO;
- } else {
- if (__is_fd_reopen_in_progress (fdctx))
- *remote_fd = -1;
- else
- *remote_fd = fdctx->remote_fd;
- }
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_conf_t *conf = NULL;
+
+ GF_VALIDATE_OR_GOTO(this->name, fd, out);
+ GF_VALIDATE_OR_GOTO(this->name, remote_fd, out);
+
+ conf = this->private;
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ *remote_fd = GF_ANON_FD_NO;
+ } else {
+ if (__is_fd_reopen_in_progress(fdctx))
+ *remote_fd = -1;
+ else
+ *remote_fd = fdctx->remote_fd;
}
- pthread_spin_unlock (&conf->fd_lock);
+ }
+ pthread_spin_unlock(&conf->fd_lock);
- if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1))
- *remote_fd = GF_ANON_FD_NO;
+ if ((flags & FALLBACK_TO_ANON_FD) && (*remote_fd == -1))
+ *remote_fd = GF_ANON_FD_NO;
- return 0;
+ return 0;
out:
- return -1;
+ return -1;
}
gf_boolean_t
-client_is_reopen_needed (fd_t *fd, xlator_t *this, int64_t remote_fd)
+client_is_reopen_needed(fd_t *fd, xlator_t *this, int64_t remote_fd)
{
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- gf_boolean_t res = _gf_false;
-
- conf = this->private;
- pthread_spin_lock(&conf->fd_lock);
- {
- fdctx = this_fd_get_ctx (fd, this);
- if (fdctx && (fdctx->remote_fd == -1) &&
- (remote_fd == GF_ANON_FD_NO))
- res = _gf_true;
- }
- pthread_spin_unlock(&conf->fd_lock);
-
- return res;
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ gf_boolean_t res = _gf_false;
+
+ conf = this->private;
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ fdctx = this_fd_get_ctx(fd, this);
+ if (fdctx && (fdctx->remote_fd == -1) && (remote_fd == GF_ANON_FD_NO))
+ res = _gf_true;
+ }
+ pthread_spin_unlock(&conf->fd_lock);
+
+ return res;
}
int
-client_fd_fop_prepare_local (call_frame_t *frame, fd_t *fd, int64_t remote_fd)
+client_fd_fop_prepare_local(call_frame_t *frame, fd_t *fd, int64_t remote_fd)
{
- xlator_t *this = NULL;
- clnt_local_t *local = NULL;
- int ret = 0;
+ xlator_t *this = NULL;
+ clnt_local_t *local = NULL;
+ int ret = 0;
- if (!frame || !fd) {
- ret = -EINVAL;
- goto out;
- }
+ if (!frame || !fd) {
+ ret = -EINVAL;
+ goto out;
+ }
- this = frame->this;
+ this = frame->this;
- frame->local = mem_get0 (this->local_pool);
- if (frame->local == NULL) {
- ret = -ENOMEM;
- goto out;
- }
+ frame->local = mem_get0(this->local_pool);
+ if (frame->local == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
- local = frame->local;
- local->fd = fd_ref (fd);
- local->attempt_reopen = client_is_reopen_needed (fd, this, remote_fd);
+ local = frame->local;
+ local->fd = fd_ref(fd);
+ local->attempt_reopen = client_is_reopen_needed(fd, this, remote_fd);
- return 0;
+ return 0;
out:
- return ret;
+ return ret;
}
int
-client_process_response (call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfs3_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk,
- int index)
+client_process_response(call_frame_t *frame, xlator_t *this,
+ struct rpc_req *req, gfs3_compound_rsp *rsp,
+ compound_args_cbk_t *args_cbk, int index)
{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD (&entries.list);
-
- switch (args_cbk->enum_list[index]) {
+ int ret = 0;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ gf_dirent_t entries;
+ default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
+ clnt_local_t *local = frame->local;
+ compound_rsp *this_rsp = NULL;
+ compound_args_t *args = local->compound_args;
+
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ args_cbk->enum_list[index] = this_rsp->fop_enum;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ switch (args_cbk->enum_list[index]) {
+ case GF_FOP_STAT: {
+ gfs3_stat_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_stat_rsp;
+
+ client_post_stat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
+
+ CLIENT_POST_FOP_TYPE(stat, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfs3_readlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+
+ client_post_readlink(this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ CLIENT_POST_FOP_TYPE(readlink, this_rsp, this_args_cbk,
+ tmp_rsp->path, &this_args_cbk->stat, xdata);
+ break;
+ }
+ case GF_FOP_MKNOD: {
+ gfs3_mknod_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+
+ client_post_mknod(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(mknod, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_MKDIR: {
+ gfs3_mkdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+
+ client_post_mkdir(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(mkdir, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_UNLINK: {
+ gfs3_unlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+
+ client_post_unlink(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(unlink, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RMDIR: {
+ gfs3_rmdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+
+ client_post_rmdir(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(rmdir, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_SYMLINK: {
+ gfs3_symlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+
+ client_post_symlink(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ symlink, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfs3_rename_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rename_rsp;
+
+ client_post_rename(
+ this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &this_args_cbk->preparent2,
+ &this_args_cbk->postparent2, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
+ break;
+ }
+ case GF_FOP_LINK: {
+ gfs3_link_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_link_rsp;
+
+ client_post_link(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(
+ link, this_rsp, this_args_cbk, NULL, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_TRUNCATE: {
+ gfs3_truncate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+
+ client_post_truncate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT_POST_FOP_TYPE(truncate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_OPEN: {
+ gfs3_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_open_rsp;
+
+ client_post_open(this, tmp_rsp, &xdata);
+ CLIENT_POST_FOP_TYPE(open, this_rsp, this_args_cbk, local->fd,
+ xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
+ }
+ case GF_FOP_READ: {
+ gfs3_read_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_read_rsp;
+
+ client_post_readv(this, tmp_rsp, &this_args_cbk->iobref,
+ req->rsp_iobref, &this_args_cbk->stat, vector,
+ &req->rsp[1], &this_args_cbk->count, &xdata);
+
+ /* Each read should be given read response that only
+ * corresponds to its request.
+ * Modify the iovecs accordingly.
+ * After each read, store the length of data already read
+ * so that the next ones can continue from there.
+ */
+ if (local->read_length) {
+ vector[0].iov_base += local->read_length;
+ local->read_length += tmp_rsp->op_ret;
+ } else {
+ local->read_length = tmp_rsp->op_ret;
+ }
+
+ args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno), vector,
+ this_args_cbk->count, &this_args_cbk->stat,
+ this_args_cbk->iobref, xdata);
+
+ if (tmp_rsp->op_ret >= 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+
+ break;
+ }
+ case GF_FOP_WRITE: {
+ gfs3_write_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_write_rsp;
+
+ client_post_writev(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ args_writev_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno),
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+
+ if (tmp_rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfs3_statfs_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_statfs_rsp;
+
+ client_post_statfs(this, tmp_rsp, &this_args_cbk->statvfs, &xdata);
+
+ CLIENT_POST_FOP_TYPE(statfs, this_rsp, this_args_cbk,
+ &this_args_cbk->statvfs, xdata);
+ break;
+ }
+ case GF_FOP_FLUSH: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_flush_rsp;
+
+ client_post_flush(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
+ if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+ break;
+ }
+ case GF_FOP_FSYNC: {
+ gfs3_fsync_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+
+ client_post_fsync(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+
+ CLIENT_POST_FOP_TYPE(fsync, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_SETXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ client_post_setxattr(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ gfs3_getxattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+
+ client_post_getxattr(this, tmp_rsp, &xattr, &xdata);
+
+ CLIENT_POST_FOP_TYPE(getxattr, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+
+ client_post_removexattr(this, tmp_rsp, &xdata);
+
+ CLIENT_POST_FOP(removexattr, this_rsp, this_args_cbk, xdata);
+ break;
+ }
+ case GF_FOP_OPENDIR: {
+ gfs3_opendir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_opendir_rsp;
- case GF_FOP_STAT:
- {
- gfs3_stat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_stat_rsp;
-
- client_post_stat (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_opendir(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (stat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(opendir, this_rsp, this_args_cbk, local->fd,
+ xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfs3_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+ case GF_FOP_FSYNCDIR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
- client_post_readlink (this, tmp_rsp, &this_args_cbk->stat,
- &xdata);
- CLIENT_POST_FOP_TYPE (readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat,
- xdata);
- break;
- }
- case GF_FOP_MKNOD:
- {
- gfs3_mknod_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+ client_post_fsyncdir(this, tmp_rsp, &xdata);
- client_post_mknod (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (mknod, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP(fsyncdir, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_MKDIR:
- {
- gfs3_mkdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+ case GF_FOP_ACCESS: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_access_rsp;
- client_post_mkdir (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (mkdir, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_UNLINK:
- {
- gfs3_unlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+ client_post_access(this, tmp_rsp, &xdata);
- client_post_unlink (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (unlink, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP(access, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_RMDIR:
- {
- gfs3_rmdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+ case GF_FOP_CREATE: {
+ gfs3_create_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_create_rsp;
- client_post_rmdir (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (rmdir, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_SYMLINK:
- {
- gfs3_symlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+ client_post_create(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, local, &xdata);
- client_post_symlink (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (symlink, this_rsp, this_args_cbk, NULL,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(create, this_rsp, this_args_cbk, local->fd,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_RENAME:
- {
- gfs3_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rename_rsp;
-
- client_post_rename (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT_POST_FOP_TYPE (rename, this_rsp, this_args_cbk,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, xdata);
- break;
- }
- case GF_FOP_LINK:
- {
- gfs3_link_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_link_rsp;
+ case GF_FOP_FTRUNCATE: {
+ gfs3_ftruncate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
- client_post_link (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (link, this_rsp, this_args_cbk, NULL,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ client_post_ftruncate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT_POST_FOP_TYPE(ftruncate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_TRUNCATE:
- {
- gfs3_truncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+ case GF_FOP_FSTAT: {
+ gfs3_fstat_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fstat_rsp;
- client_post_truncate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (truncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN:
- {
- gfs3_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_open_rsp;
+ client_post_fstat(this, tmp_rsp, &this_args_cbk->stat, &xdata);
- client_post_open (this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (open, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd,
- 0);
- break;
+ CLIENT_POST_FOP_TYPE(fstat, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
}
- case GF_FOP_READ:
- {
- gfs3_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_read_rsp;
-
- client_post_readv (this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat,
- vector, &req->rsp[1], &this_args_cbk->count,
- &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
+ case GF_FOP_LK: {
+ gfs3_lk_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lk_rsp;
- args_readv_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- vector, this_args_cbk->count,
- &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
+ client_post_lk(this, tmp_rsp, &this_args_cbk->lock, &xdata);
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
-
- break;
+ CLIENT_POST_FOP_TYPE(lk, this_rsp, this_args_cbk,
+ &this_args_cbk->lock, xdata);
+ break;
}
- case GF_FOP_WRITE:
- {
- gfs3_write_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_write_rsp;
-
- client_post_writev (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- args_writev_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
+ case GF_FOP_LOOKUP: {
+ gfs3_lookup_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lookup_rsp;
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ client_post_lookup(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT_POST_FOP_TYPE(lookup, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat, xdata,
+ &this_args_cbk->postparent);
+ break;
}
- case GF_FOP_STATFS:
- {
- gfs3_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_statfs_rsp;
-
- client_post_statfs (this, tmp_rsp, &this_args_cbk->statvfs,
- &xdata);
-
- CLIENT_POST_FOP_TYPE (statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_flush_rsp;
-
- client_post_flush (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP (flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
- break;
- }
- case GF_FOP_FSYNC:
- {
- gfs3_fsync_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+ case GF_FOP_READDIR: {
+ gfs3_readdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readdir_rsp;
- client_post_fsync (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ client_post_readdir(this, tmp_rsp, &entries, &xdata);
- CLIENT_POST_FOP_TYPE (fsync, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(readdir, this_rsp, this_args_cbk, &entries,
+ xdata);
+ break;
}
- case GF_FOP_SETXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ case GF_FOP_INODELK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
- client_post_setxattr (this, tmp_rsp, &xdata);
+ client_post_inodelk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (setxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(inodelk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_GETXATTR:
- {
- gfs3_getxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+ case GF_FOP_FINODELK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
- client_post_getxattr (this, tmp_rsp, &xattr, &xdata);
+ client_post_finodelk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (getxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP(finodelk, this_rsp, this_args_cbk, xdata);
+ if (tmp_rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
}
- case GF_FOP_REMOVEXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+ case GF_FOP_ENTRYLK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
- client_post_removexattr (this, tmp_rsp, &xdata);
+ client_post_entrylk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (removexattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(entrylk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfs3_opendir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_opendir_rsp;
+ case GF_FOP_FENTRYLK: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
- client_post_opendir (this, tmp_rsp, &xdata);
+ client_post_fentrylk(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (opendir, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ CLIENT_POST_FOP(fentrylk, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_FSYNCDIR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
- client_post_fsyncdir (this, tmp_rsp, &xdata);
+ client_post_xattrop(this, tmp_rsp, &xattr, &xdata);
- CLIENT_POST_FOP (fsyncdir, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(xattrop, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
}
- case GF_FOP_ACCESS:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_access_rsp;
-
- client_post_access (this, tmp_rsp, &xdata);
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
- CLIENT_POST_FOP (access, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_CREATE:
- {
- gfs3_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_create_rsp;
-
- client_post_create (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT_POST_FOP_TYPE (create, this_rsp, this_args_cbk,
- local->fd, local->loc.inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
- }
- case GF_FOP_FTRUNCATE:
- {
- gfs3_ftruncate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
+ client_post_fxattrop(this, tmp_rsp, &xattr, &xdata);
- client_post_ftruncate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (ftruncate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fxattrop, this_rsp, this_args_cbk, xattr,
+ xdata);
+ if (rsp->op_ret == 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+ break;
}
- case GF_FOP_FSTAT:
- {
- gfs3_fstat_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fstat_rsp;
+ case GF_FOP_FGETXATTR: {
+ gfs3_fgetxattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
- client_post_fstat (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_fgetxattr(this, tmp_rsp, &xattr, &xdata);
- CLIENT_POST_FOP_TYPE (fstat, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fgetxattr, this_rsp, this_args_cbk, xattr,
+ xdata);
+ break;
}
- case GF_FOP_LK:
- {
- gfs3_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lk_rsp;
+ case GF_FOP_FSETXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetxattr_rsp;
- client_post_lk (this, tmp_rsp, &this_args_cbk->lock, &xdata);
+ client_post_fsetxattr(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
- }
- case GF_FOP_LOOKUP:
- {
- gfs3_lookup_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lookup_rsp;
-
- client_post_lookup (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT_POST_FOP_TYPE (lookup, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- xdata, &this_args_cbk->postparent);
- break;
+ CLIENT_POST_FOP(fsetxattr, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_READDIR:
- {
- gfs3_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdir_rsp;
+ case GF_FOP_RCHECKSUM: {
+ gfs3_rchecksum_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
- client_post_readdir (this, tmp_rsp, &entries, &xdata);
+ client_post_rchecksum(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP_TYPE (readdir, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ break;
+ CLIENT_POST_FOP_TYPE(
+ rchecksum, this_rsp, this_args_cbk, tmp_rsp->weak_checksum,
+ (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
+ break;
}
- case GF_FOP_INODELK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
+ case GF_FOP_SETATTR: {
+ gfs3_setattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_setattr_rsp;
- client_post_inodelk (this, tmp_rsp, &xdata);
+ client_post_setattr(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP (inodelk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(setattr, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FINODELK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
+ case GF_FOP_FSETATTR: {
+ gfs3_fsetattr_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
- client_post_finodelk (this, tmp_rsp, &xdata);
+ client_post_fsetattr(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP (finodelk, this_rsp, this_args_cbk, xdata);
- if (tmp_rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ CLIENT_POST_FOP_TYPE(fsetattr, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_ENTRYLK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
- client_post_entrylk (this, tmp_rsp, &xdata);
+ client_post_readdirp(this, tmp_rsp, local->fd, &entries, &xdata);
- CLIENT_POST_FOP (entrylk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(readdirp, this_rsp, this_args_cbk, &entries,
+ xdata);
+ break;
}
- case GF_FOP_FENTRYLK:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
+ case GF_FOP_FREMOVEXATTR: {
+ gf_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
- client_post_fentrylk (this, tmp_rsp, &xdata);
+ client_post_fremovexattr(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (fentrylk, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP(fremovexattr, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
+ case GF_FOP_FALLOCATE: {
+ gfs3_fallocate_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
- client_post_xattrop (this, tmp_rsp, &xattr, &xdata);
+ client_post_fallocate(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (xattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(fallocate, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
+ case GF_FOP_DISCARD: {
+ gfs3_discard_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_discard_rsp;
- client_post_fxattrop (this, tmp_rsp, &xattr, &xdata);
+ client_post_discard(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (fxattrop, this_rsp, this_args_cbk, xattr,
- xdata);
- if (rsp->op_ret == 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
- break;
+ CLIENT_POST_FOP_TYPE(discard, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FGETXATTR:
- {
- gfs3_fgetxattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
+ case GF_FOP_ZEROFILL: {
+ gfs3_zerofill_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
- client_post_fgetxattr (this, tmp_rsp, &xattr, &xdata);
+ client_post_zerofill(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
- CLIENT_POST_FOP_TYPE (fgetxattr, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(zerofill, this_rsp, this_args_cbk,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
}
- case GF_FOP_FSETXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetxattr_rsp;
+ case GF_FOP_IPC: {
+ gfs3_ipc_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_ipc_rsp;
- client_post_fsetxattr (this, tmp_rsp, &xdata);
+ client_post_ipc(this, tmp_rsp, &xdata);
- CLIENT_POST_FOP (fsetxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(ipc, this_rsp, this_args_cbk, xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfs3_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
+ case GF_FOP_SEEK: {
+ gfs3_seek_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_seek_rsp;
- client_post_rchecksum (this, tmp_rsp, &xdata);
+ client_post_seek(this, tmp_rsp, &xdata);
- break;
- CLIENT_POST_FOP_TYPE (rchecksum, this_rsp, this_args_cbk,
- tmp_rsp->weak_checksum,
- (uint8_t*)tmp_rsp->strong_checksum.strong_checksum_val,
- xdata);
- break;
+ CLIENT_POST_FOP_TYPE(seek, this_rsp, this_args_cbk, tmp_rsp->offset,
+ xdata);
+ break;
}
- case GF_FOP_SETATTR:
- {
- gfs3_setattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_setattr_rsp;
+ case GF_FOP_LEASE: {
+ gfs3_lease_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_u.compound_lease_rsp;
- client_post_setattr (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ client_post_lease(this, tmp_rsp, &this_args_cbk->lease, &xdata);
- CLIENT_POST_FOP_TYPE (setattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
+ CLIENT_POST_FOP_TYPE(lease, this_rsp, this_args_cbk,
+ &this_args_cbk->lease, xdata);
+ break;
}
- case GF_FOP_FSETATTR:
- {
- gfs3_fsetattr_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
+ default:
+ return -ENOTSUP;
+ }
+
+ if (xdata)
+ dict_unref(xdata);
+ if (xattr)
+ dict_unref(xattr);
+ gf_dirent_free(&entries);
+ return 0;
+}
- client_post_fsetattr (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+int
+client_handle_fop_requirements(
+ xlator_t *this, call_frame_t *frame, gfs3_compound_req *req,
+ clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
+ struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
+ int *rsp_count, default_args_t *args, int fop_enum, int index)
+{
+ int ret = 0;
+ int op_errno = ENOMEM;
+ struct iobuf *rsp_iobuf = NULL;
+ int64_t remote_fd = -1;
+ compound_req *this_req = &req->compound_req_array
+ .compound_req_array_val[index];
- CLIENT_POST_FOP_TYPE (fsetattr, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
+ this_req->fop_enum = fop_enum;
- client_post_readdirp (this, tmp_rsp, local->fd, &entries,
- &xdata);
+ switch (fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_PRE_FOP(stat, this,
+ &this_req->compound_req_u.compound_stat_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
+ case GF_FOP_READLINK:
+ CLIENT_PRE_FOP(readlink, this,
+ &this_req->compound_req_u.compound_readlink_req,
+ op_errno, out, &args->loc, args->size, args->xdata);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT_PRE_FOP(mknod, this,
+ &this_req->compound_req_u.compound_mknod_req,
+ op_errno, out, &args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT_PRE_FOP(mkdir, this,
+ &this_req->compound_req_u.compound_mkdir_req,
+ op_errno, out, &args->loc, args->mode, args->umask,
+ args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT_PRE_FOP(unlink, this,
+ &this_req->compound_req_u.compound_unlink_req,
+ op_errno, out, &args->loc, args->xflag, args->xdata);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT_PRE_FOP(rmdir, this,
+ &this_req->compound_req_u.compound_rmdir_req,
+ op_errno, out, &args->loc, args->flags, args->xdata);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT_PRE_FOP(symlink, this,
+ &this_req->compound_req_u.compound_symlink_req,
+ op_errno, out, &args->loc, args->linkname,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT_PRE_FOP(rename, this,
+ &this_req->compound_req_u.compound_rename_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
+ case GF_FOP_LINK:
+ CLIENT_PRE_FOP(link, this,
+ &this_req->compound_req_u.compound_link_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT_PRE_FOP(
+ truncate, this, &this_req->compound_req_u.compound_truncate_req,
+ op_errno, out, &args->loc, args->offset, args->xdata);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT_PRE_FOP(
+ open, this, &this_req->compound_req_u.compound_open_req,
+ op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
+ case GF_FOP_READ:
+ op_errno = client_pre_readv(
+ this, &this_req->compound_req_u.compound_read_req, args->fd,
+ args->size, args->offset, args->flags, args->xdata);
- CLIENT_POST_FOP_TYPE (readdirp, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- {
- gf_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- client_post_fremovexattr (this, tmp_rsp, &xdata);
+ if (!*rsp_iobref) {
+ *rsp_iobref = iobref_new();
+ if (*rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ }
- CLIENT_POST_FOP (fremovexattr, this_rsp, this_args_cbk, xdata);
- break;
- }
- case GF_FOP_FALLOCATE:
- {
- gfs3_fallocate_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
+ if (*rsp_count + 1 >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
+ iobref_add(*rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ if (args->size > rsp_vector[*rsp_count].iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size "
+ "(%lu)",
+ (unsigned long)args->size,
+ (unsigned long)rsp_vector[*rsp_count].iov_len);
+ op_errno = EINVAL;
+ goto out;
+ }
+ *rsp_count += 1;
- client_post_fallocate (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
+ break;
+ case GF_FOP_WRITE:
+ op_errno = client_pre_writev(
+ this, &this_req->compound_req_u.compound_write_req, args->fd,
+ iov_length(args->vector, args->count), args->offset,
+ args->flags, &args->xdata);
- CLIENT_POST_FOP_TYPE (fallocate, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+
+ if (*req_count + args->count >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ memcpy(&req_vector[*req_count], args->vector,
+ (args->count * sizeof(req_vector[0])));
+ *req_count += args->count;
+
+ if (!*req_iobref)
+ *req_iobref = args->iobref;
+ else if (iobref_merge(*req_iobref, args->iobref))
+ goto out;
+ break;
+ case GF_FOP_STATFS:
+ CLIENT_PRE_FOP(statfs, this,
+ &this_req->compound_req_u.compound_statfs_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
+ case GF_FOP_FLUSH:
+ CLIENT_PRE_FOP(flush, this,
+ &this_req->compound_req_u.compound_flush_req,
+ op_errno, out, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT_PRE_FOP(
+ fsync, this, &this_req->compound_req_u.compound_fsync_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
+ case GF_FOP_SETXATTR:
+ CLIENT_PRE_FOP(setxattr, this,
+ &this_req->compound_req_u.compound_setxattr_req,
+ op_errno, out, &args->loc, args->xattr, args->flags,
+ args->xdata);
+ break;
+ case GF_FOP_GETXATTR:
+ CLIENT_PRE_FOP(getxattr, this,
+ &this_req->compound_req_u.compound_getxattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_PRE_FOP(removexattr, this,
+ &this_req->compound_req_u.compound_removexattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT_PRE_FOP(opendir, this,
+ &this_req->compound_req_u.compound_opendir_req,
+ op_errno, out, &args->loc, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT_PRE_FOP(
+ fsyncdir, this, &this_req->compound_req_u.compound_fsyncdir_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT_PRE_FOP(access, this,
+ &this_req->compound_req_u.compound_access_req,
+ op_errno, out, &args->loc, args->mask, args->xdata);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT_PRE_FOP(create, this,
+ &this_req->compound_req_u.compound_create_req,
+ op_errno, out, &args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT_PRE_FOP(ftruncate, this,
+ &this_req->compound_req_u.compound_ftruncate_req,
+ op_errno, out, args->fd, args->offset, args->xdata);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT_PRE_FOP(fstat, this,
+ &this_req->compound_req_u.compound_fstat_req,
+ op_errno, out, args->fd, args->xdata);
+ break;
+ case GF_FOP_LK:
+ CLIENT_PRE_FOP(lk, this, &this_req->compound_req_u.compound_lk_req,
+ op_errno, out, args->cmd, &args->lock, args->fd,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT_PRE_FOP(lookup, this,
+ &this_req->compound_req_u.compound_lookup_req,
+ op_errno, out, &args->loc, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
+ case GF_FOP_READDIR:
+ CLIENT_PRE_FOP(
+ readdir, this, &this_req->compound_req_u.compound_readdir_req,
+ op_errno, out, args->fd, args->size, args->offset, args->xdata);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT_PRE_FOP(inodelk, this,
+ &this_req->compound_req_u.compound_inodelk_req,
+ op_errno, out, &args->loc, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT_PRE_FOP(finodelk, this,
+ &this_req->compound_req_u.compound_finodelk_req,
+ op_errno, out, args->fd, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT_PRE_FOP(
+ entrylk, this, &this_req->compound_req_u.compound_entrylk_req,
+ op_errno, out, &args->loc, args->entrylkcmd, args->entrylktype,
+ args->volume, args->name, args->xdata);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT_PRE_FOP(
+ fentrylk, this, &this_req->compound_req_u.compound_fentrylk_req,
+ op_errno, out, args->fd, args->entrylkcmd, args->entrylktype,
+ args->volume, args->name, args->xdata);
+ break;
+ case GF_FOP_XATTROP:
+ CLIENT_PRE_FOP(xattrop, this,
+ &this_req->compound_req_u.compound_xattrop_req,
+ op_errno, out, &args->loc, args->xattr, args->optype,
+ args->xdata);
+ break;
+ case GF_FOP_FXATTROP:
+ CLIENT_PRE_FOP(fxattrop, this,
+ &this_req->compound_req_u.compound_fxattrop_req,
+ op_errno, out, args->fd, args->xattr, args->optype,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
+ case GF_FOP_FGETXATTR:
+ CLIENT_PRE_FOP(fgetxattr, this,
+ &this_req->compound_req_u.compound_fgetxattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
+ case GF_FOP_FSETXATTR:
+ CLIENT_PRE_FOP(fsetxattr, this,
+ &this_req->compound_req_u.compound_fsetxattr_req,
+ op_errno, out, args->fd, args->flags, args->xattr,
+ args->xdata);
+ break;
+ case GF_FOP_RCHECKSUM:
+ CLIENT_PRE_FOP(rchecksum, this,
+ &this_req->compound_req_u.compound_rchecksum_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT_PRE_FOP(setattr, this,
+ &this_req->compound_req_u.compound_setattr_req,
+ op_errno, out, &args->loc, args->valid, &args->stat,
+ args->xdata);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT_PRE_FOP(
+ fsetattr, this, &this_req->compound_req_u.compound_fsetattr_req,
+ op_errno, out, args->fd, args->valid, &args->stat, args->xdata);
+ break;
+ case GF_FOP_READDIRP:
+ CLIENT_PRE_FOP(
+ readdirp, this, &this_req->compound_req_u.compound_readdirp_req,
+ op_errno, out, args->fd, args->size, args->offset, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_PRE_FOP(fremovexattr, this,
+ &this_req->compound_req_u.compound_fremovexattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT_PRE_FOP(fallocate, this,
+ &this_req->compound_req_u.compound_fallocate_req,
+ op_errno, out, args->fd, args->flags, args->offset,
+ args->size, args->xdata);
+ break;
case GF_FOP_DISCARD:
- {
- gfs3_discard_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_discard_rsp;
-
- client_post_discard (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE (discard, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ discard, this, &this_req->compound_req_u.compound_discard_req,
+ op_errno, out, args->fd, args->offset, args->size, args->xdata);
+ break;
case GF_FOP_ZEROFILL:
- {
- gfs3_zerofill_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
-
- client_post_zerofill (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
-
- CLIENT_POST_FOP_TYPE (zerofill, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ zerofill, this, &this_req->compound_req_u.compound_zerofill_req,
+ op_errno, out, args->fd, args->offset, args->size, args->xdata);
+ break;
case GF_FOP_IPC:
- {
- gfs3_ipc_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_ipc_rsp;
-
- client_post_ipc (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE (ipc, this_rsp, this_args_cbk, xdata);
- break;
- }
+ CLIENT_PRE_FOP(ipc, this,
+ &this_req->compound_req_u.compound_ipc_req, op_errno,
+ out, args->cmd, args->xdata);
+ break;
case GF_FOP_SEEK:
- {
- gfs3_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_seek_rsp;
-
- client_post_seek (this, tmp_rsp, &xdata);
-
- CLIENT_POST_FOP_TYPE (seek, this_rsp, this_args_cbk,
- tmp_rsp->offset, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ seek, this, &this_req->compound_req_u.compound_seek_req,
+ op_errno, out, args->fd, args->offset, args->what, args->xdata);
+ break;
case GF_FOP_LEASE:
- {
- gfs3_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_u.compound_lease_rsp;
-
- client_post_lease (this, tmp_rsp, &this_args_cbk->lease,
- &xdata);
-
- CLIENT_POST_FOP_TYPE (lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
- }
+ CLIENT_PRE_FOP(
+ lease, this, &this_req->compound_req_u.compound_lease_req,
+ op_errno, out, &args->loc, &args->lease, args->xdata);
+ break;
default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref (xdata);
- if (xattr)
- dict_unref (xattr);
- gf_dirent_free (&entries);
- return 0;
+ return ENOTSUP;
+ }
+ return 0;
+out:
+ return op_errno;
}
-int
-client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
- gfs3_compound_req *req,
- clnt_local_t *local,
- struct iobref **req_iobref,
- struct iobref **rsp_iobref,
- struct iovec *req_vector,
- struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args,
- int fop_enum, int index)
+void
+compound_request_cleanup(gfs3_compound_req *req)
{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req *this_req = &req->compound_req_array.compound_req_array_val[index];
+ int i = 0;
+ int length = req->compound_req_array.compound_req_array_len;
+ compound_req *curr_req = NULL;
- this_req->fop_enum = fop_enum;
+ if (!req->compound_req_array.compound_req_array_val)
+ return;
- switch (fop_enum) {
- case GF_FOP_STAT:
- CLIENT_PRE_FOP (stat, this,
- &this_req->compound_req_u.compound_stat_req,
- op_errno, out,
- &args->loc, args->xdata);
+ for (i = 0; i < length; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
+
+ switch (curr_req->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, stat);
break;
- case GF_FOP_READLINK:
- CLIENT_PRE_FOP (readlink, this,
- &this_req->compound_req_u.compound_readlink_req,
- op_errno, out,
- &args->loc, args->size, args->xdata);
+ case GF_FOP_READLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readlink);
break;
- case GF_FOP_MKNOD:
- CLIENT_PRE_FOP (mknod, this,
- &this_req->compound_req_u.compound_mknod_req,
- op_errno, out,
- &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_MKNOD:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mknod);
break;
- case GF_FOP_MKDIR:
- CLIENT_PRE_FOP (mkdir, this,
- &this_req->compound_req_u.compound_mkdir_req,
- op_errno, out,
- &args->loc, args->mode,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_MKDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
break;
- case GF_FOP_UNLINK:
- CLIENT_PRE_FOP (unlink, this,
- &this_req->compound_req_u.compound_unlink_req,
- op_errno, out,
- &args->loc, args->xflag, args->xdata);
+ case GF_FOP_UNLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, unlink);
break;
- case GF_FOP_RMDIR:
- CLIENT_PRE_FOP (rmdir, this,
- &this_req->compound_req_u.compound_rmdir_req,
- op_errno, out,
- &args->loc, args->flags, args->xdata);
+ case GF_FOP_RMDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
break;
- case GF_FOP_SYMLINK:
- CLIENT_PRE_FOP (symlink, this,
- &this_req->compound_req_u.compound_symlink_req,
- op_errno, out,
- &args->loc, args->linkname, args->umask,
- args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_SYMLINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, symlink);
break;
- case GF_FOP_RENAME:
- CLIENT_PRE_FOP (rename, this,
- &this_req->compound_req_u.compound_rename_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
+ case GF_FOP_RENAME:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rename);
break;
- case GF_FOP_LINK:
- CLIENT_PRE_FOP (link, this,
- &this_req->compound_req_u.compound_link_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
+ case GF_FOP_LINK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, link);
break;
- case GF_FOP_TRUNCATE:
- CLIENT_PRE_FOP (truncate, this,
- &this_req->compound_req_u.compound_truncate_req,
- op_errno, out,
- &args->loc, args->offset, args->xdata);
+ case GF_FOP_TRUNCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, truncate);
break;
- case GF_FOP_OPEN:
- CLIENT_PRE_FOP (open, this,
- &this_req->compound_req_u.compound_open_req,
- op_errno, out,
- &args->loc, args->fd, args->flags,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
+ case GF_FOP_OPEN:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, open);
break;
- case GF_FOP_READ:
- op_errno = client_pre_readv (this,
- &this_req->compound_req_u.compound_read_req,
- args->fd, args->size, args->offset,
- args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
-
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new ();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
-
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize (rsp_iobuf);
- iobref_add (*rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
- }
- *rsp_count += 1;
-
+ case GF_FOP_READ:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, read);
break;
- case GF_FOP_WRITE:
- op_errno = client_pre_writev (this,
- &this_req->compound_req_u.compound_write_req,
- args->fd, iov_length (args->vector, args->count),
- args->offset, args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy (&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
-
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else
- if (iobref_merge (*req_iobref, args->iobref))
- goto out;
+ case GF_FOP_WRITE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, write);
break;
- case GF_FOP_STATFS:
- CLIENT_PRE_FOP (statfs, this,
- &this_req->compound_req_u.compound_statfs_req,
- op_errno, out,
- &args->loc, args->xdata);
+ case GF_FOP_STATFS:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, statfs);
break;
- case GF_FOP_FLUSH:
- CLIENT_PRE_FOP (flush, this,
- &this_req->compound_req_u.compound_flush_req,
- op_errno, out,
- args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
+ case GF_FOP_FLUSH:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, flush);
break;
- case GF_FOP_FSYNC:
- CLIENT_PRE_FOP (fsync, this,
- &this_req->compound_req_u.compound_fsync_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
+ case GF_FOP_FSYNC:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsync);
break;
- case GF_FOP_SETXATTR:
- CLIENT_PRE_FOP (setxattr, this,
- &this_req->compound_req_u.compound_setxattr_req,
- op_errno, out,
- &args->loc, args->xattr, args->flags,
- args->xdata);
+ case GF_FOP_SETXATTR: {
+ gfs3_setxattr_req *args = &CPD_REQ_FIELD(curr_req, setxattr);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
break;
- case GF_FOP_GETXATTR:
- CLIENT_PRE_FOP (getxattr, this,
- &this_req->compound_req_u.compound_getxattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ }
+ case GF_FOP_GETXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_PRE_FOP (removexattr, this,
- &this_req->compound_req_u.compound_removexattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
break;
- case GF_FOP_OPENDIR:
- CLIENT_PRE_FOP (opendir, this,
- &this_req->compound_req_u.compound_opendir_req,
- op_errno, out,
- &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_OPENDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, opendir);
break;
- case GF_FOP_FSYNCDIR:
- CLIENT_PRE_FOP (fsyncdir, this,
- &this_req->compound_req_u.compound_fsyncdir_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
+ case GF_FOP_FSYNCDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
break;
- case GF_FOP_ACCESS:
- CLIENT_PRE_FOP (access, this,
- &this_req->compound_req_u.compound_access_req,
- op_errno, out,
- &args->loc, args->mask, args->xdata);
+ case GF_FOP_ACCESS:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, access);
break;
- case GF_FOP_CREATE:
- CLIENT_PRE_FOP (create, this,
- &this_req->compound_req_u.compound_create_req,
- op_errno, out,
- &args->loc, args->fd, args->mode, args->flags,
- args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
-
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_CREATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, create);
break;
- case GF_FOP_FTRUNCATE:
- CLIENT_PRE_FOP (ftruncate, this,
- &this_req->compound_req_u.compound_ftruncate_req,
- op_errno, out,
- args->fd, args->offset, args->xdata);
+ case GF_FOP_FTRUNCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
break;
- case GF_FOP_FSTAT:
- CLIENT_PRE_FOP (fstat, this,
- &this_req->compound_req_u.compound_fstat_req,
- op_errno, out,
- args->fd, args->xdata);
+ case GF_FOP_FSTAT:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fstat);
break;
- case GF_FOP_LK:
- CLIENT_PRE_FOP (lk, this,
- &this_req->compound_req_u.compound_lk_req,
- op_errno, out,
- args->cmd, &args->lock, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
+ case GF_FOP_LK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lk);
break;
- case GF_FOP_LOOKUP:
- CLIENT_PRE_FOP (lookup, this,
- &this_req->compound_req_u.compound_lookup_req,
- op_errno, out,
- &args->loc, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
+ case GF_FOP_LOOKUP:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, lookup);
break;
- case GF_FOP_READDIR:
- CLIENT_PRE_FOP (readdir, this,
- &this_req->compound_req_u.compound_readdir_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
+ case GF_FOP_READDIR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, readdir);
break;
- case GF_FOP_INODELK:
- CLIENT_PRE_FOP (inodelk, this,
- &this_req->compound_req_u.compound_inodelk_req,
- op_errno, out,
- &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
+ case GF_FOP_INODELK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
break;
- case GF_FOP_FINODELK:
- CLIENT_PRE_FOP (finodelk, this,
- &this_req->compound_req_u.compound_finodelk_req,
- op_errno, out,
- args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
+ case GF_FOP_FINODELK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
break;
- case GF_FOP_ENTRYLK:
- CLIENT_PRE_FOP (entrylk, this,
- &this_req->compound_req_u.compound_entrylk_req,
- op_errno, out,
- &args->loc, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
+ case GF_FOP_ENTRYLK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
break;
- case GF_FOP_FENTRYLK:
- CLIENT_PRE_FOP (fentrylk, this,
- &this_req->compound_req_u.compound_fentrylk_req,
- op_errno, out,
- args->fd, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
+ case GF_FOP_FENTRYLK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
break;
- case GF_FOP_XATTROP:
- CLIENT_PRE_FOP (xattrop, this,
- &this_req->compound_req_u.compound_xattrop_req,
- op_errno, out,
- &args->loc, args->xattr, args->optype,
- args->xdata);
+ case GF_FOP_XATTROP: {
+ gfs3_xattrop_req *args = &CPD_REQ_FIELD(curr_req, xattrop);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
break;
- case GF_FOP_FXATTROP:
- CLIENT_PRE_FOP (fxattrop, this,
- &this_req->compound_req_u.compound_fxattrop_req,
- op_errno, out,
- args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
+ }
+ case GF_FOP_FXATTROP: {
+ gfs3_fxattrop_req *args = &CPD_REQ_FIELD(curr_req, fxattrop);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
break;
- case GF_FOP_FGETXATTR:
- CLIENT_PRE_FOP (fgetxattr, this,
- &this_req->compound_req_u.compound_fgetxattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
+ }
+ case GF_FOP_FGETXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
break;
- case GF_FOP_FSETXATTR:
- CLIENT_PRE_FOP (fsetxattr, this,
- &this_req->compound_req_u.compound_fsetxattr_req,
- op_errno, out,
- args->fd, args->flags, args->xattr,
- args->xdata);
+ case GF_FOP_FSETXATTR: {
+ gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req, fsetxattr);
+ GF_FREE(args->dict.dict_val);
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
break;
- case GF_FOP_RCHECKSUM:
- CLIENT_PRE_FOP (rchecksum, this,
- &this_req->compound_req_u.compound_rchecksum_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
+ }
+ case GF_FOP_RCHECKSUM:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
break;
- case GF_FOP_SETATTR:
- CLIENT_PRE_FOP (setattr, this,
- &this_req->compound_req_u.compound_setattr_req,
- op_errno, out,
- &args->loc, args->valid, &args->stat,
- args->xdata);
+ case GF_FOP_SETATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, setattr);
break;
- case GF_FOP_FSETATTR:
- CLIENT_PRE_FOP (fsetattr, this,
- &this_req->compound_req_u.compound_fsetattr_req,
- op_errno, out,
- args->fd, args->valid, &args->stat,
- args->xdata);
+ case GF_FOP_FSETATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
break;
- case GF_FOP_READDIRP:
- CLIENT_PRE_FOP (readdirp, this,
- &this_req->compound_req_u.compound_readdirp_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
+ case GF_FOP_READDIRP: {
+ gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req, readdirp);
+ GF_FREE(args->dict.dict_val);
break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_PRE_FOP (fremovexattr, this,
- &this_req->compound_req_u.compound_fremovexattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_PRE_FOP (fallocate, this,
- &this_req->compound_req_u.compound_fallocate_req,
- op_errno, out,
- args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
- case GF_FOP_DISCARD:
- CLIENT_PRE_FOP (discard, this,
- &this_req->compound_req_u.compound_discard_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
+ }
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
break;
- case GF_FOP_ZEROFILL:
- CLIENT_PRE_FOP (zerofill, this,
- &this_req->compound_req_u.compound_zerofill_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
+ case GF_FOP_FALLOCATE:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
break;
- case GF_FOP_IPC:
- CLIENT_PRE_FOP (ipc, this,
- &this_req->compound_req_u.compound_ipc_req,
- op_errno, out,
- args->cmd, args->xdata);
+ case GF_FOP_DISCARD:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, discard);
break;
- case GF_FOP_SEEK:
- CLIENT_PRE_FOP (seek, this,
- &this_req->compound_req_u.compound_seek_req,
- op_errno, out,
- args->fd, args->offset, args->what,
- args->xdata);
+ case GF_FOP_ZEROFILL:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
break;
- case GF_FOP_LEASE:
- CLIENT_PRE_FOP (lease, this,
- &this_req->compound_req_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease,
- args->xdata);
+ case GF_FOP_IPC:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, ipc);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT_COMPOUND_FOP_CLEANUP(curr_req, seek);
+ break;
+ default:
break;
- default:
- return ENOTSUP;
- }
- return 0;
-out:
- return op_errno;
-}
-
-void
-compound_request_cleanup (gfs3_compound_req *req)
-{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req *curr_req = NULL;
-
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsync);
- break;
- case GF_FOP_SETXATTR:
- {
- gfs3_setxattr_req *args = &CPD_REQ_FIELD (curr_req,
- setxattr);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP:
- {
- gfs3_xattrop_req *args = &CPD_REQ_FIELD (curr_req,
- xattrop);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfs3_fxattrop_req *args = &CPD_REQ_FIELD (curr_req,
- fxattrop);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR:
- {
- gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req,
- fsetxattr);
- GF_FREE (args->dict.dict_val);
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- {
- gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req,
- readdirp);
- GF_FREE (args->dict.dict_val);
- break;
- }
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT_COMPOUND_FOP_CLEANUP (curr_req, seek);
- break;
- default:
- break;
- }
}
+ }
- GF_FREE (req->compound_req_array.compound_req_array_val);
- return;
+ GF_FREE(req->compound_req_array.compound_req_array_val);
+ return;
}
void
-clnt_getactivelk_rsp_cleanup (gfs3_getactivelk_rsp *rsp)
+clnt_getactivelk_rsp_cleanup(gfs3_getactivelk_rsp *rsp)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- while (trav) {
- next = trav->nextentry;
- free (trav->client_uid);
- free (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ free(trav->client_uid);
+ free(trav);
+ trav = next;
+ }
}
void
-clnt_getactivelk_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp)
+clnt_getactivelk_rsp_cleanup_v2(gfx_getactivelk_rsp *rsp)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- while (trav) {
- next = trav->nextentry;
- free (trav->client_uid);
- free (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ free(trav->client_uid);
+ free(trav);
+ trav = next;
+ }
}
int
-clnt_unserialize_rsp_locklist (xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
- lock_migration_info_t *lmi)
+clnt_unserialize_rsp_locklist(xlator_t *this, struct gfs3_getactivelk_rsp *rsp,
+ lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
int
-clnt_unserialize_rsp_locklist_v2 (xlator_t *this, struct gfx_getactivelk_rsp *rsp,
- lock_migration_info_t *lmi)
+clnt_unserialize_rsp_locklist_v2(xlator_t *this,
+ struct gfx_getactivelk_rsp *rsp,
+ lock_migration_info_t *lmi)
{
- struct gfs3_locklist *trav = NULL;
- lock_migration_info_t *temp = NULL;
- int ret = -1;
- clnt_conf_t *conf = NULL;
+ struct gfs3_locklist *trav = NULL;
+ lock_migration_info_t *temp = NULL;
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
- trav = rsp->reply;
+ trav = rsp->reply;
- conf = this->private;
- if (!conf)
- goto out;
+ conf = this->private;
+ if (!conf)
+ goto out;
- while (trav) {
- temp = GF_CALLOC (1, sizeof (*lmi), gf_common_mt_lock_mig);
- if (temp == NULL) {
- gf_msg (this->name, GF_LOG_ERROR, 0, 0, "No memory");
- goto out;
- }
+ while (trav) {
+ temp = GF_CALLOC(1, sizeof(*lmi), gf_common_mt_lock_mig);
+ if (temp == NULL) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0, "No memory");
+ goto out;
+ }
- INIT_LIST_HEAD (&temp->list);
+ INIT_LIST_HEAD(&temp->list);
- gf_proto_flock_to_flock (&trav->flock, &temp->flock);
+ gf_proto_flock_to_flock(&trav->flock, &temp->flock);
- temp->lk_flags = trav->lk_flags;
+ temp->lk_flags = trav->lk_flags;
- temp->client_uid = gf_strdup (trav->client_uid);
+ temp->client_uid = gf_strdup(trav->client_uid);
- list_add_tail (&temp->list, &lmi->list);
+ list_add_tail(&temp->list, &lmi->list);
- trav = trav->nextentry;
- }
+ trav = trav->nextentry;
+ }
- ret = 0;
+ ret = 0;
out:
- return ret;
+ return ret;
}
-
void
-clnt_setactivelk_req_cleanup (gfs3_setactivelk_req *req)
+clnt_setactivelk_req_cleanup(gfs3_setactivelk_req *req)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = req->request;
+ trav = req->request;
- while (trav) {
- next = trav->nextentry;
- GF_FREE (trav->client_uid);
- GF_FREE (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ GF_FREE(trav->client_uid);
+ GF_FREE(trav);
+ trav = next;
+ }
}
void
-clnt_setactivelk_req_cleanup_v2 (gfx_setactivelk_req *req)
+clnt_setactivelk_req_cleanup_v2(gfx_setactivelk_req *req)
{
- gfs3_locklist *trav = NULL;
- gfs3_locklist *next = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *next = NULL;
- trav = req->request;
+ trav = req->request;
- while (trav) {
- next = trav->nextentry;
- GF_FREE (trav->client_uid);
- GF_FREE (trav);
- trav = next;
- }
+ while (trav) {
+ next = trav->nextentry;
+ GF_FREE(trav->client_uid);
+ GF_FREE(trav);
+ trav = next;
+ }
}
int
-serialize_req_locklist (lock_migration_info_t *locklist,
- gfs3_setactivelk_req *req)
+serialize_req_locklist(lock_migration_info_t *locklist,
+ gfs3_setactivelk_req *req)
{
- lock_migration_info_t *tmp = NULL;
- gfs3_locklist *trav = NULL;
- gfs3_locklist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", locklist, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
-
- list_for_each_entry (tmp, &locklist->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav),
- gf_client_mt_clnt_lock_request_t);
- if (!trav)
- goto out;
-
- switch (tmp->flock.l_type) {
- case F_RDLCK:
- tmp->flock.l_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- tmp->flock.l_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- tmp->flock.l_type = GF_LK_F_UNLCK;
- break;
-
- default:
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %"PRId32"!",
- tmp->flock.l_type);
- break;
- }
+ lock_migration_info_t *tmp = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ int ret = -1;
- gf_proto_flock_from_flock (&trav->flock, &tmp->flock);
+ GF_VALIDATE_OR_GOTO("server", locklist, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- trav->lk_flags = tmp->lk_flags;
+ list_for_each_entry(tmp, &locklist->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_client_mt_clnt_lock_request_t);
+ if (!trav)
+ goto out;
- trav->client_uid = gf_strdup (tmp->client_uid);
- if (!trav->client_uid) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
- ret = -1;
- goto out;
- }
+ switch (tmp->flock.l_type) {
+ case F_RDLCK:
+ tmp->flock.l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ tmp->flock.l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ tmp->flock.l_type = GF_LK_F_UNLCK;
+ break;
- if (prev)
- prev->nextentry = trav;
- else
- req->request = trav;
+ default:
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ break;
+ }
+
+ gf_proto_flock_from_flock(&trav->flock, &tmp->flock);
- prev = trav;
- trav = NULL;
+ trav->lk_flags = tmp->lk_flags;
+
+ trav->client_uid = gf_strdup(tmp->client_uid);
+ if (!trav->client_uid) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "client_uid could not be allocated");
+ ret = -1;
+ goto out;
}
- ret = 0;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ req->request = trav;
+
+ prev = trav;
+ trav = NULL;
+ }
+
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
-
int
-serialize_req_locklist_v2 (lock_migration_info_t *locklist,
- gfx_setactivelk_req *req)
+serialize_req_locklist_v2(lock_migration_info_t *locklist,
+ gfx_setactivelk_req *req)
{
- lock_migration_info_t *tmp = NULL;
- gfs3_locklist *trav = NULL;
- gfs3_locklist *prev = NULL;
- int ret = -1;
-
- GF_VALIDATE_OR_GOTO ("server", locklist, out);
- GF_VALIDATE_OR_GOTO ("server", req, out);
-
- list_for_each_entry (tmp, &locklist->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav),
- gf_client_mt_clnt_lock_request_t);
- if (!trav)
- goto out;
-
- switch (tmp->flock.l_type) {
- case F_RDLCK:
- tmp->flock.l_type = GF_LK_F_RDLCK;
- break;
- case F_WRLCK:
- tmp->flock.l_type = GF_LK_F_WRLCK;
- break;
- case F_UNLCK:
- tmp->flock.l_type = GF_LK_F_UNLCK;
- break;
-
- default:
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "Unknown lock type: %"PRId32"!",
- tmp->flock.l_type);
- break;
- }
+ lock_migration_info_t *tmp = NULL;
+ gfs3_locklist *trav = NULL;
+ gfs3_locklist *prev = NULL;
+ int ret = -1;
- gf_proto_flock_from_flock (&trav->flock, &tmp->flock);
+ GF_VALIDATE_OR_GOTO("server", locklist, out);
+ GF_VALIDATE_OR_GOTO("server", req, out);
- trav->lk_flags = tmp->lk_flags;
+ list_for_each_entry(tmp, &locklist->list, list)
+ {
+ trav = GF_CALLOC(1, sizeof(*trav), gf_client_mt_clnt_lock_request_t);
+ if (!trav)
+ goto out;
- trav->client_uid = gf_strdup (tmp->client_uid);
- if (!trav->client_uid) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, 0,
- "client_uid could not be allocated");
- ret = -1;
- goto out;
- }
+ switch (tmp->flock.l_type) {
+ case F_RDLCK:
+ tmp->flock.l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ tmp->flock.l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ tmp->flock.l_type = GF_LK_F_UNLCK;
+ break;
+
+ default:
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "Unknown lock type: %" PRId32 "!", tmp->flock.l_type);
+ break;
+ }
+
+ gf_proto_flock_from_flock(&trav->flock, &tmp->flock);
- if (prev)
- prev->nextentry = trav;
- else
- req->request = trav;
+ trav->lk_flags = tmp->lk_flags;
- prev = trav;
- trav = NULL;
+ trav->client_uid = gf_strdup(tmp->client_uid);
+ if (!trav->client_uid) {
+ gf_msg(THIS->name, GF_LOG_ERROR, 0, 0,
+ "client_uid could not be allocated");
+ ret = -1;
+ goto out;
}
- ret = 0;
+ if (prev)
+ prev->nextentry = trav;
+ else
+ req->request = trav;
+
+ prev = trav;
+ trav = NULL;
+ }
+
+ ret = 0;
out:
- GF_FREE (trav);
+ GF_FREE(trav);
- return ret;
+ return ret;
}
void
-client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len)
+client_compound_rsp_cleanup(gfs3_compound_rsp *rsp, int len)
{
- int i = 0;
- compound_rsp *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- case GF_FOP_STAT:
- CLIENT_FOP_RSP_CLEANUP (rsp, stat, i);
- break;
- case GF_FOP_MKNOD:
- CLIENT_FOP_RSP_CLEANUP (rsp, mknod, i);
- break;
- case GF_FOP_MKDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, mkdir, i);
- break;
- case GF_FOP_UNLINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, unlink, i);
- break;
- case GF_FOP_RMDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, rmdir, i);
- break;
- case GF_FOP_SYMLINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, symlink, i);
- break;
- case GF_FOP_RENAME:
- CLIENT_FOP_RSP_CLEANUP (rsp, rename, i);
- break;
- case GF_FOP_LINK:
- CLIENT_FOP_RSP_CLEANUP (rsp, link, i);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, truncate, i);
- break;
- case GF_FOP_OPEN:
- CLIENT_FOP_RSP_CLEANUP (rsp, open, i);
- break;
- case GF_FOP_READ:
- CLIENT_FOP_RSP_CLEANUP (rsp, read, i);
- break;
- case GF_FOP_WRITE:
- CLIENT_FOP_RSP_CLEANUP (rsp, write, i);
- break;
- case GF_FOP_STATFS:
- CLIENT_FOP_RSP_CLEANUP (rsp, statfs, i);
- break;
- case GF_FOP_FSYNC:
- CLIENT_FOP_RSP_CLEANUP (rsp, fsync, i);
- break;
- case GF_FOP_OPENDIR:
- CLIENT_FOP_RSP_CLEANUP (rsp, opendir, i);
- break;
- case GF_FOP_CREATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, create, i);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, ftruncate, i);
- break;
- case GF_FOP_FSTAT:
- CLIENT_FOP_RSP_CLEANUP (rsp, fstat, i);
- break;
- case GF_FOP_LOOKUP:
- CLIENT_FOP_RSP_CLEANUP (rsp, lookup, i);
- break;
- case GF_FOP_SETATTR:
- CLIENT_FOP_RSP_CLEANUP (rsp, setattr, i);
- break;
- case GF_FOP_FSETATTR:
- CLIENT_FOP_RSP_CLEANUP (rsp, fsetattr, i);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT_FOP_RSP_CLEANUP (rsp, fallocate, i);
- break;
- case GF_FOP_DISCARD:
- CLIENT_FOP_RSP_CLEANUP (rsp, discard, i);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT_FOP_RSP_CLEANUP (rsp, zerofill, i);
- break;
- case GF_FOP_IPC:
- CLIENT_FOP_RSP_CLEANUP (rsp, ipc, i);
- break;
- case GF_FOP_SEEK:
- CLIENT_FOP_RSP_CLEANUP (rsp, seek, i);
- break;
- case GF_FOP_LEASE:
- CLIENT_FOP_RSP_CLEANUP (rsp, lease, i);
- break;
- /* fops that use gf_common_rsp */
- case GF_FOP_FLUSH:
- CLIENT_COMMON_RSP_CLEANUP (rsp, flush, i);
- break;
- case GF_FOP_SETXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, setxattr, i);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, removexattr, i);
- break;
- case GF_FOP_FSETXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fsetxattr, i);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fremovexattr, i);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fsyncdir, i);
- break;
- case GF_FOP_ACCESS:
- CLIENT_COMMON_RSP_CLEANUP (rsp, access, i);
- break;
- case GF_FOP_INODELK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, inodelk, i);
- break;
- case GF_FOP_FINODELK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, finodelk, i);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, entrylk, i);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT_COMMON_RSP_CLEANUP (rsp, fentrylk, i);
- break;
- /* fops that need extra cleanup */
- case GF_FOP_LK:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, lk, i);
- gfs3_lk_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, lk);
- free (tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readlink, i);
- gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readlink);
- free (tmp_rsp->path);
- break;
- }
- case GF_FOP_XATTROP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, xattrop, i);
- gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- xattrop);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, fxattrop, i);
- gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fxattrop);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_READDIR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readdir, i);
- gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdir);
- clnt_readdir_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, readdirp, i);
- gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- readdirp);
- clnt_readdirp_rsp_cleanup (tmp_rsp);
- break;
- }
- case GF_FOP_GETXATTR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, getxattr, i);
- gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- getxattr);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_FGETXATTR:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, fgetxattr, i);
- gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
- fgetxattr);
- free (tmp_rsp->dict.dict_val);
- break;
- }
- case GF_FOP_RCHECKSUM:
- {
- CLIENT_FOP_RSP_CLEANUP (rsp, rchecksum, i);
- gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp,
- rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free (rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
+ int i = 0;
+ compound_rsp *this_rsp = NULL;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (this_rsp->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_FOP_RSP_CLEANUP(rsp, stat, i);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT_FOP_RSP_CLEANUP(rsp, mknod, i);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, mkdir, i);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, unlink, i);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, rmdir, i);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, symlink, i);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT_FOP_RSP_CLEANUP(rsp, rename, i);
+ break;
+ case GF_FOP_LINK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, link, i);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, truncate, i);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT_FOP_RSP_CLEANUP(rsp, open, i);
+ break;
+ case GF_FOP_READ:
+ CLIENT_FOP_RSP_CLEANUP(rsp, read, i);
+ break;
+ case GF_FOP_WRITE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, write, i);
+ break;
+ case GF_FOP_STATFS:
+ CLIENT_FOP_RSP_CLEANUP(rsp, statfs, i);
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fsync, i);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, opendir, i);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, create, i);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, ftruncate, i);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fstat, i);
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT_FOP_RSP_CLEANUP(rsp, lookup, i);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, setattr, i);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fsetattr, i);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, fallocate, i);
+ break;
+ case GF_FOP_DISCARD:
+ CLIENT_FOP_RSP_CLEANUP(rsp, discard, i);
+ break;
+ case GF_FOP_ZEROFILL:
+ CLIENT_FOP_RSP_CLEANUP(rsp, zerofill, i);
+ break;
+ case GF_FOP_IPC:
+ CLIENT_FOP_RSP_CLEANUP(rsp, ipc, i);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT_FOP_RSP_CLEANUP(rsp, seek, i);
+ break;
+ case GF_FOP_LEASE:
+ CLIENT_FOP_RSP_CLEANUP(rsp, lease, i);
+ break;
+ /* fops that use gf_common_rsp */
+ case GF_FOP_FLUSH:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, flush, i);
+ break;
+ case GF_FOP_SETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, setxattr, i);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, removexattr, i);
+ break;
+ case GF_FOP_FSETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fsetxattr, i);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fremovexattr, i);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fsyncdir, i);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, access, i);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, inodelk, i);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, finodelk, i);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, entrylk, i);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP(rsp, fentrylk, i);
+ break;
+ /* fops that need extra cleanup */
+ case GF_FOP_LK: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, lk, i);
+ gfs3_lk_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, lk);
+ free(tmp_rsp->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readlink, i);
+ gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readlink);
+ free(tmp_rsp->path);
+ break;
+ }
+ case GF_FOP_XATTROP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, xattrop, i);
+ gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, xattrop);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, fxattrop, i);
+ gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, fxattrop);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readdir, i);
+ gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdir);
+ clnt_readdir_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, readdirp, i);
+ gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, readdirp);
+ clnt_readdirp_rsp_cleanup(tmp_rsp);
+ break;
+ }
+ case GF_FOP_GETXATTR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, getxattr, i);
+ gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp, getxattr);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FGETXATTR: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, fgetxattr, i);
+ gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ fgetxattr);
+ free(tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_RCHECKSUM: {
+ CLIENT_FOP_RSP_CLEANUP(rsp, rchecksum, i);
+ gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp, rchecksum);
+ if (rck->strong_checksum.strong_checksum_val) {
+ free(rck->strong_checksum.strong_checksum_val);
}
+ break;
+ }
+ default:
+ break;
}
- return;
+ }
+ return;
}
/* compound v2 */
int
-client_handle_fop_requirements_v2 (xlator_t *this, call_frame_t *frame,
- gfx_compound_req *req,
- clnt_local_t *local,
- struct iobref **req_iobref,
- struct iobref **rsp_iobref,
- struct iovec *req_vector,
- struct iovec *rsp_vector, int *req_count,
- int *rsp_count, default_args_t *args,
- int fop_enum, int index)
+client_handle_fop_requirements_v2(
+ xlator_t *this, call_frame_t *frame, gfx_compound_req *req,
+ clnt_local_t *local, struct iobref **req_iobref, struct iobref **rsp_iobref,
+ struct iovec *req_vector, struct iovec *rsp_vector, int *req_count,
+ int *rsp_count, default_args_t *args, int fop_enum, int index)
{
- int ret = 0;
- int op_errno = ENOMEM;
- struct iobuf *rsp_iobuf = NULL;
- int64_t remote_fd = -1;
- compound_req_v2 *this_req = &req->compound_req_array.compound_req_array_val[index];
+ int ret = 0;
+ int op_errno = ENOMEM;
+ struct iobuf *rsp_iobuf = NULL;
+ int64_t remote_fd = -1;
+ compound_req_v2 *this_req = &req->compound_req_array
+ .compound_req_array_val[index];
- this_req->fop_enum = fop_enum;
+ this_req->fop_enum = fop_enum;
- switch (fop_enum) {
+ switch (fop_enum) {
case GF_FOP_STAT:
- CLIENT4_PRE_FOP (stat, this,
- &this_req->compound_req_v2_u.compound_stat_req,
- op_errno, out,
- &args->loc, args->xdata);
- break;
+ CLIENT4_PRE_FOP(stat, this,
+ &this_req->compound_req_v2_u.compound_stat_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
case GF_FOP_READLINK:
- CLIENT4_PRE_FOP (readlink, this,
- &this_req->compound_req_v2_u.compound_readlink_req,
- op_errno, out,
- &args->loc, args->size, args->xdata);
- break;
+ CLIENT4_PRE_FOP(readlink, this,
+ &this_req->compound_req_v2_u.compound_readlink_req,
+ op_errno, out, &args->loc, args->size, args->xdata);
+ break;
case GF_FOP_MKNOD:
- CLIENT4_PRE_FOP (mknod, this,
- &this_req->compound_req_v2_u.compound_mknod_req,
- op_errno, out,
- &args->loc, args->mode, args->rdev,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(mknod, this,
+ &this_req->compound_req_v2_u.compound_mknod_req,
+ op_errno, out, &args->loc, args->mode, args->rdev,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_MKDIR:
- CLIENT4_PRE_FOP (mkdir, this,
- &this_req->compound_req_v2_u.compound_mkdir_req,
- op_errno, out,
- &args->loc, args->mode,
- args->umask, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(mkdir, this,
+ &this_req->compound_req_v2_u.compound_mkdir_req,
+ op_errno, out, &args->loc, args->mode, args->umask,
+ args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_UNLINK:
- CLIENT4_PRE_FOP (unlink, this,
- &this_req->compound_req_v2_u.compound_unlink_req,
- op_errno, out,
- &args->loc, args->xflag, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ unlink, this, &this_req->compound_req_v2_u.compound_unlink_req,
+ op_errno, out, &args->loc, args->xflag, args->xdata);
+ break;
case GF_FOP_RMDIR:
- CLIENT4_PRE_FOP (rmdir, this,
- &this_req->compound_req_v2_u.compound_rmdir_req,
- op_errno, out,
- &args->loc, args->flags, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ rmdir, this, &this_req->compound_req_v2_u.compound_rmdir_req,
+ op_errno, out, &args->loc, args->flags, args->xdata);
+ break;
case GF_FOP_SYMLINK:
- CLIENT4_PRE_FOP (symlink, this,
- &this_req->compound_req_v2_u.compound_symlink_req,
- op_errno, out,
- &args->loc, args->linkname, args->umask,
- args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(symlink, this,
+ &this_req->compound_req_v2_u.compound_symlink_req,
+ op_errno, out, &args->loc, args->linkname,
+ args->umask, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_RENAME:
- CLIENT4_PRE_FOP (rename, this,
- &this_req->compound_req_v2_u.compound_rename_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ rename, this, &this_req->compound_req_v2_u.compound_rename_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
case GF_FOP_LINK:
- CLIENT4_PRE_FOP (link, this,
- &this_req->compound_req_v2_u.compound_link_req,
- op_errno, out,
- &args->loc, &args->loc2, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ link, this, &this_req->compound_req_v2_u.compound_link_req,
+ op_errno, out, &args->loc, &args->loc2, args->xdata);
+ break;
case GF_FOP_TRUNCATE:
- CLIENT4_PRE_FOP (truncate, this,
- &this_req->compound_req_v2_u.compound_truncate_req,
- op_errno, out,
- &args->loc, args->offset, args->xdata);
- break;
+ CLIENT4_PRE_FOP(truncate, this,
+ &this_req->compound_req_v2_u.compound_truncate_req,
+ op_errno, out, &args->loc, args->offset,
+ args->xdata);
+ break;
case GF_FOP_OPEN:
- CLIENT4_PRE_FOP (open, this,
- &this_req->compound_req_v2_u.compound_open_req,
- op_errno, out,
- &args->loc, args->fd, args->flags,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- break;
+ CLIENT4_PRE_FOP(
+ open, this, &this_req->compound_req_v2_u.compound_open_req,
+ op_errno, out, &args->loc, args->fd, args->flags, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
case GF_FOP_READ:
- op_errno = client_pre_readv_v2 (this,
- &this_req->compound_req_v2_u.compound_read_req,
- args->fd, args->size, args->offset,
- args->flags, args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
- if (rsp_iobuf == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
+ op_errno = client_pre_readv_v2(
+ this, &this_req->compound_req_v2_u.compound_read_req, args->fd,
+ args->size, args->offset, args->flags, args->xdata);
- if (!*rsp_iobref) {
- *rsp_iobref = iobref_new ();
- if (*rsp_iobref == NULL) {
- op_errno = ENOMEM;
- goto out;
- }
- }
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ rsp_iobuf = iobuf_get2(this->ctx->iobuf_pool, args->size);
+ if (rsp_iobuf == NULL) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- if (*rsp_count + 1 >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- rsp_vector[*rsp_count].iov_base = iobuf_ptr (rsp_iobuf);
- rsp_vector[*rsp_count].iov_len = iobuf_pagesize (rsp_iobuf);
- iobref_add (*rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
- rsp_iobuf = NULL;
- if (args->size > rsp_vector[*rsp_count].iov_len) {
- gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
- PC_MSG_NO_MEMORY,
- "read-size (%lu) is bigger than iobuf size "
- "(%lu)",
- (unsigned long)args->size,
- (unsigned long)rsp_vector[*rsp_count].iov_len);
- op_errno = EINVAL;
- goto out;
+ if (!*rsp_iobref) {
+ *rsp_iobref = iobref_new();
+ if (*rsp_iobref == NULL) {
+ op_errno = ENOMEM;
+ goto out;
}
- *rsp_count += 1;
+ }
- break;
+ if (*rsp_count + 1 >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ rsp_vector[*rsp_count].iov_base = iobuf_ptr(rsp_iobuf);
+ rsp_vector[*rsp_count].iov_len = iobuf_pagesize(rsp_iobuf);
+ iobref_add(*rsp_iobref, rsp_iobuf);
+ iobuf_unref(rsp_iobuf);
+ rsp_iobuf = NULL;
+ if (args->size > rsp_vector[*rsp_count].iov_len) {
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
+ "read-size (%lu) is bigger than iobuf size "
+ "(%lu)",
+ (unsigned long)args->size,
+ (unsigned long)rsp_vector[*rsp_count].iov_len);
+ op_errno = EINVAL;
+ goto out;
+ }
+ *rsp_count += 1;
+
+ break;
case GF_FOP_WRITE:
- op_errno = client_pre_writev_v2 (this,
- &this_req->compound_req_v2_u.compound_write_req,
- args->fd, iov_length (args->vector, args->count),
- args->offset, args->flags, &args->xdata);
-
- if (op_errno) {
- op_errno = -op_errno;
- goto out;
- }
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
-
- if (*req_count + args->count >= MAX_IOVEC) {
- op_errno = ENOMEM;
- goto out;
- }
- memcpy (&req_vector[*req_count], args->vector,
- (args->count * sizeof(req_vector[0])));
- *req_count += args->count;
+ op_errno = client_pre_writev_v2(
+ this, &this_req->compound_req_v2_u.compound_write_req, args->fd,
+ iov_length(args->vector, args->count), args->offset,
+ args->flags, &args->xdata);
- if (!*req_iobref)
- *req_iobref = args->iobref;
- else
- if (iobref_merge (*req_iobref, args->iobref))
- goto out;
- break;
+ if (op_errno) {
+ op_errno = -op_errno;
+ goto out;
+ }
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+
+ if (*req_count + args->count >= MAX_IOVEC) {
+ op_errno = ENOMEM;
+ goto out;
+ }
+ memcpy(&req_vector[*req_count], args->vector,
+ (args->count * sizeof(req_vector[0])));
+ *req_count += args->count;
+
+ if (!*req_iobref)
+ *req_iobref = args->iobref;
+ else if (iobref_merge(*req_iobref, args->iobref))
+ goto out;
+ break;
case GF_FOP_STATFS:
- CLIENT4_PRE_FOP (statfs, this,
- &this_req->compound_req_v2_u.compound_statfs_req,
- op_errno, out,
- &args->loc, args->xdata);
- break;
+ CLIENT4_PRE_FOP(statfs, this,
+ &this_req->compound_req_v2_u.compound_statfs_req,
+ op_errno, out, &args->loc, args->xdata);
+ break;
case GF_FOP_FLUSH:
- CLIENT4_PRE_FOP (flush, this,
- &this_req->compound_req_v2_u.compound_flush_req,
- op_errno, out,
- args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- break;
+ CLIENT4_PRE_FOP(flush, this,
+ &this_req->compound_req_v2_u.compound_flush_req,
+ op_errno, out, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
case GF_FOP_FSYNC:
- CLIENT4_PRE_FOP (fsync, this,
- &this_req->compound_req_v2_u.compound_fsync_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ fsync, this, &this_req->compound_req_v2_u.compound_fsync_req,
+ op_errno, out, args->fd, args->datasync, args->xdata);
+ break;
case GF_FOP_SETXATTR:
- CLIENT4_PRE_FOP (setxattr, this,
- &this_req->compound_req_v2_u.compound_setxattr_req,
- op_errno, out,
- &args->loc, args->xattr, args->flags,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(setxattr, this,
+ &this_req->compound_req_v2_u.compound_setxattr_req,
+ op_errno, out, &args->loc, args->xattr, args->flags,
+ args->xdata);
+ break;
case GF_FOP_GETXATTR:
- CLIENT4_PRE_FOP (getxattr, this,
- &this_req->compound_req_v2_u.compound_getxattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(getxattr, this,
+ &this_req->compound_req_v2_u.compound_getxattr_req,
+ op_errno, out, &args->loc, args->name, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_REMOVEXATTR:
- CLIENT4_PRE_FOP (removexattr, this,
- &this_req->compound_req_v2_u.compound_removexattr_req,
- op_errno, out,
- &args->loc, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ removexattr, this,
+ &this_req->compound_req_v2_u.compound_removexattr_req, op_errno,
+ out, &args->loc, args->name, args->xdata);
+ break;
case GF_FOP_OPENDIR:
- CLIENT4_PRE_FOP (opendir, this,
- &this_req->compound_req_v2_u.compound_opendir_req,
- op_errno, out,
- &args->loc, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(opendir, this,
+ &this_req->compound_req_v2_u.compound_opendir_req,
+ op_errno, out, &args->loc, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_FSYNCDIR:
- CLIENT4_PRE_FOP (fsyncdir, this,
- &this_req->compound_req_v2_u.compound_fsyncdir_req,
- op_errno, out,
- args->fd, args->datasync, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsyncdir, this,
+ &this_req->compound_req_v2_u.compound_fsyncdir_req,
+ op_errno, out, args->fd, args->datasync,
+ args->xdata);
+ break;
case GF_FOP_ACCESS:
- CLIENT4_PRE_FOP (access, this,
- &this_req->compound_req_v2_u.compound_access_req,
- op_errno, out,
- &args->loc, args->mask, args->xdata);
- break;
+ CLIENT4_PRE_FOP(access, this,
+ &this_req->compound_req_v2_u.compound_access_req,
+ op_errno, out, &args->loc, args->mask, args->xdata);
+ break;
case GF_FOP_CREATE:
- CLIENT4_PRE_FOP (create, this,
- &this_req->compound_req_v2_u.compound_create_req,
- op_errno, out,
- &args->loc, args->fd, args->mode, args->flags,
- args->umask, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
-
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(create, this,
+ &this_req->compound_req_v2_u.compound_create_req,
+ op_errno, out, &args->loc, args->fd, args->mode,
+ args->flags, args->umask, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_FTRUNCATE:
- CLIENT4_PRE_FOP (ftruncate, this,
- &this_req->compound_req_v2_u.compound_ftruncate_req,
- op_errno, out,
- args->fd, args->offset, args->xdata);
- break;
+ CLIENT4_PRE_FOP(ftruncate, this,
+ &this_req->compound_req_v2_u.compound_ftruncate_req,
+ op_errno, out, args->fd, args->offset, args->xdata);
+ break;
case GF_FOP_FSTAT:
- CLIENT4_PRE_FOP (fstat, this,
- &this_req->compound_req_v2_u.compound_fstat_req,
- op_errno, out,
- args->fd, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fstat, this,
+ &this_req->compound_req_v2_u.compound_fstat_req,
+ op_errno, out, args->fd, args->xdata);
+ break;
case GF_FOP_LK:
- CLIENT4_PRE_FOP (lk, this,
- &this_req->compound_req_v2_u.compound_lk_req,
- op_errno, out,
- args->cmd, &args->lock, args->fd, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->owner = frame->root->lk_owner;
- break;
+ CLIENT4_PRE_FOP(
+ lk, this, &this_req->compound_req_v2_u.compound_lk_req,
+ op_errno, out, args->cmd, &args->lock, args->fd, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->owner = frame->root->lk_owner;
+ break;
case GF_FOP_LOOKUP:
- CLIENT4_PRE_FOP (lookup, this,
- &this_req->compound_req_v2_u.compound_lookup_req,
- op_errno, out,
- &args->loc, args->xdata);
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- break;
+ CLIENT4_PRE_FOP(lookup, this,
+ &this_req->compound_req_v2_u.compound_lookup_req,
+ op_errno, out, &args->loc, args->xdata);
+ loc_copy(&local->loc, &args->loc);
+ loc_path(&local->loc, NULL);
+ break;
case GF_FOP_READDIR:
- CLIENT4_PRE_FOP (readdir, this,
- &this_req->compound_req_v2_u.compound_readdir_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(readdir, this,
+ &this_req->compound_req_v2_u.compound_readdir_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
case GF_FOP_INODELK:
- CLIENT4_PRE_FOP (inodelk, this,
- &this_req->compound_req_v2_u.compound_inodelk_req,
- op_errno, out,
- &args->loc, args->cmd, &args->lock,
- args->volume, args->xdata);
- break;
+ CLIENT4_PRE_FOP(inodelk, this,
+ &this_req->compound_req_v2_u.compound_inodelk_req,
+ op_errno, out, &args->loc, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ break;
case GF_FOP_FINODELK:
- CLIENT4_PRE_FOP (finodelk, this,
- &this_req->compound_req_v2_u.compound_finodelk_req,
- op_errno, out,
- args->fd, args->cmd, &args->lock,
- args->volume, args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- break;
+ CLIENT4_PRE_FOP(finodelk, this,
+ &this_req->compound_req_v2_u.compound_finodelk_req,
+ op_errno, out, args->fd, args->cmd, &args->lock,
+ args->volume, args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
case GF_FOP_ENTRYLK:
- CLIENT4_PRE_FOP (entrylk, this,
- &this_req->compound_req_v2_u.compound_entrylk_req,
- op_errno, out,
- &args->loc, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(entrylk, this,
+ &this_req->compound_req_v2_u.compound_entrylk_req,
+ op_errno, out, &args->loc, args->entrylkcmd,
+ args->entrylktype, args->volume, args->name,
+ args->xdata);
+ break;
case GF_FOP_FENTRYLK:
- CLIENT4_PRE_FOP (fentrylk, this,
- &this_req->compound_req_v2_u.compound_fentrylk_req,
- op_errno, out,
- args->fd, args->entrylkcmd,
- args->entrylktype, args->volume,
- args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fentrylk, this,
+ &this_req->compound_req_v2_u.compound_fentrylk_req,
+ op_errno, out, args->fd, args->entrylkcmd,
+ args->entrylktype, args->volume, args->name,
+ args->xdata);
+ break;
case GF_FOP_XATTROP:
- CLIENT4_PRE_FOP (xattrop, this,
- &this_req->compound_req_v2_u.compound_xattrop_req,
- op_errno, out,
- &args->loc, args->xattr, args->optype,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(xattrop, this,
+ &this_req->compound_req_v2_u.compound_xattrop_req,
+ op_errno, out, &args->loc, args->xattr,
+ args->optype, args->xdata);
+ break;
case GF_FOP_FXATTROP:
- CLIENT4_PRE_FOP (fxattrop, this,
- &this_req->compound_req_v2_u.compound_fxattrop_req,
- op_errno, out,
- args->fd, args->xattr, args->optype,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- local->attempt_reopen = client_is_reopen_needed
- (args->fd, this, remote_fd);
- break;
+ CLIENT4_PRE_FOP(fxattrop, this,
+ &this_req->compound_req_v2_u.compound_fxattrop_req,
+ op_errno, out, args->fd, args->xattr, args->optype,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ local->attempt_reopen = client_is_reopen_needed(args->fd, this,
+ remote_fd);
+ break;
case GF_FOP_FGETXATTR:
- CLIENT4_PRE_FOP (fgetxattr, this,
- &this_req->compound_req_v2_u.compound_fgetxattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fgetxattr, this,
+ &this_req->compound_req_v2_u.compound_fgetxattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
case GF_FOP_FSETXATTR:
- CLIENT4_PRE_FOP (fsetxattr, this,
- &this_req->compound_req_v2_u.compound_fsetxattr_req,
- op_errno, out,
- args->fd, args->flags, args->xattr,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsetxattr, this,
+ &this_req->compound_req_v2_u.compound_fsetxattr_req,
+ op_errno, out, args->fd, args->flags, args->xattr,
+ args->xdata);
+ break;
case GF_FOP_RCHECKSUM:
- CLIENT4_PRE_FOP (rchecksum, this,
- &this_req->compound_req_v2_u.compound_rchecksum_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(rchecksum, this,
+ &this_req->compound_req_v2_u.compound_rchecksum_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ break;
case GF_FOP_SETATTR:
- CLIENT4_PRE_FOP (setattr, this,
- &this_req->compound_req_v2_u.compound_setattr_req,
- op_errno, out,
- &args->loc, args->valid, &args->stat,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(setattr, this,
+ &this_req->compound_req_v2_u.compound_setattr_req,
+ op_errno, out, &args->loc, args->valid, &args->stat,
+ args->xdata);
+ break;
case GF_FOP_FSETATTR:
- CLIENT4_PRE_FOP (fsetattr, this,
- &this_req->compound_req_v2_u.compound_fsetattr_req,
- op_errno, out,
- args->fd, args->valid, &args->stat,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(fsetattr, this,
+ &this_req->compound_req_v2_u.compound_fsetattr_req,
+ op_errno, out, args->fd, args->valid, &args->stat,
+ args->xdata);
+ break;
case GF_FOP_READDIRP:
- CLIENT4_PRE_FOP (readdirp, this,
- &this_req->compound_req_v2_u.compound_readdirp_req,
- op_errno, out,
- args->fd, args->size, args->offset,
- args->xdata);
- if (!local->fd)
- local->fd = fd_ref (args->fd);
- break;
+ CLIENT4_PRE_FOP(readdirp, this,
+ &this_req->compound_req_v2_u.compound_readdirp_req,
+ op_errno, out, args->fd, args->size, args->offset,
+ args->xdata);
+ if (!local->fd)
+ local->fd = fd_ref(args->fd);
+ break;
case GF_FOP_FREMOVEXATTR:
- CLIENT4_PRE_FOP (fremovexattr, this,
- &this_req->compound_req_v2_u.compound_fremovexattr_req,
- op_errno, out,
- args->fd, args->name, args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ fremovexattr, this,
+ &this_req->compound_req_v2_u.compound_fremovexattr_req,
+ op_errno, out, args->fd, args->name, args->xdata);
+ break;
case GF_FOP_FALLOCATE:
- CLIENT4_PRE_FOP (fallocate, this,
- &this_req->compound_req_v2_u.compound_fallocate_req,
- op_errno, out,
- args->fd, args->flags, args->offset,
- args->size, args->xdata);
- break;
+ CLIENT4_PRE_FOP(fallocate, this,
+ &this_req->compound_req_v2_u.compound_fallocate_req,
+ op_errno, out, args->fd, args->flags, args->offset,
+ args->size, args->xdata);
+ break;
case GF_FOP_DISCARD:
- CLIENT4_PRE_FOP (discard, this,
- &this_req->compound_req_v2_u.compound_discard_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(discard, this,
+ &this_req->compound_req_v2_u.compound_discard_req,
+ op_errno, out, args->fd, args->offset, args->size,
+ args->xdata);
+ break;
case GF_FOP_ZEROFILL:
- CLIENT4_PRE_FOP (zerofill, this,
- &this_req->compound_req_v2_u.compound_zerofill_req,
- op_errno, out,
- args->fd, args->offset, args->size,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(zerofill, this,
+ &this_req->compound_req_v2_u.compound_zerofill_req,
+ op_errno, out, args->fd, args->offset, args->size,
+ args->xdata);
+ break;
case GF_FOP_IPC:
- CLIENT4_PRE_FOP (ipc, this,
- &this_req->compound_req_v2_u.compound_ipc_req,
- op_errno, out,
- args->cmd, args->xdata);
- break;
+ CLIENT4_PRE_FOP(ipc, this,
+ &this_req->compound_req_v2_u.compound_ipc_req,
+ op_errno, out, args->cmd, args->xdata);
+ break;
case GF_FOP_SEEK:
- CLIENT4_PRE_FOP (seek, this,
- &this_req->compound_req_v2_u.compound_seek_req,
- op_errno, out,
- args->fd, args->offset, args->what,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ seek, this, &this_req->compound_req_v2_u.compound_seek_req,
+ op_errno, out, args->fd, args->offset, args->what, args->xdata);
+ break;
case GF_FOP_LEASE:
- CLIENT4_PRE_FOP (lease, this,
- &this_req->compound_req_v2_u.compound_lease_req,
- op_errno, out, &args->loc, &args->lease,
- args->xdata);
- break;
+ CLIENT4_PRE_FOP(
+ lease, this, &this_req->compound_req_v2_u.compound_lease_req,
+ op_errno, out, &args->loc, &args->lease, args->xdata);
+ break;
default:
- return ENOTSUP;
- }
- return 0;
+ return ENOTSUP;
+ }
+ return 0;
out:
- return op_errno;
+ return op_errno;
}
void
-compound_request_cleanup_v2 (gfx_compound_req *req)
+compound_request_cleanup_v2(gfx_compound_req *req)
{
- int i = 0;
- int length = req->compound_req_array.compound_req_array_len;
- compound_req_v2 *curr_req = NULL;
-
- if (!req->compound_req_array.compound_req_array_val)
- return;
-
- for (i = 0; i < length; i++) {
- curr_req = &req->compound_req_array.compound_req_array_val[i];
-
- switch (curr_req->fop_enum) {
- case GF_FOP_STAT:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, stat);
- break;
- case GF_FOP_READLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readlink);
- break;
- case GF_FOP_MKNOD:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, mknod);
- break;
- case GF_FOP_MKDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, mkdir);
- break;
- case GF_FOP_UNLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, unlink);
- break;
- case GF_FOP_RMDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rmdir);
- break;
- case GF_FOP_SYMLINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, symlink);
- break;
- case GF_FOP_RENAME:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rename);
- break;
- case GF_FOP_LINK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, link);
- break;
- case GF_FOP_TRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, truncate);
- break;
- case GF_FOP_OPEN:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, open);
- break;
- case GF_FOP_READ:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, read);
- break;
- case GF_FOP_WRITE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, write);
- break;
- case GF_FOP_STATFS:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, statfs);
- break;
- case GF_FOP_FLUSH:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, flush);
- break;
- case GF_FOP_FSYNC:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsync);
- break;
- case GF_FOP_SETXATTR:
- {
- gfx_setxattr_req *args = &CPD4_REQ_FIELD (curr_req,
- setxattr);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
- break;
- }
- case GF_FOP_GETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, getxattr);
- break;
- case GF_FOP_REMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, removexattr);
- break;
- case GF_FOP_OPENDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, opendir);
- break;
- case GF_FOP_FSYNCDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsyncdir);
- break;
- case GF_FOP_ACCESS:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, access);
- break;
- case GF_FOP_CREATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, create);
- break;
- case GF_FOP_FTRUNCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, ftruncate);
- break;
- case GF_FOP_FSTAT:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fstat);
- break;
- case GF_FOP_LK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, lk);
- break;
- case GF_FOP_LOOKUP:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, lookup);
- break;
- case GF_FOP_READDIR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readdir);
- break;
- case GF_FOP_INODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, inodelk);
- break;
- case GF_FOP_FINODELK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, finodelk);
- break;
- case GF_FOP_ENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, entrylk);
- break;
- case GF_FOP_FENTRYLK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fentrylk);
- break;
- case GF_FOP_XATTROP:
- {
- gfx_xattrop_req *args = &CPD4_REQ_FIELD (curr_req,
- xattrop);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
- break;
- }
- case GF_FOP_FXATTROP:
- {
- gfx_fxattrop_req *args = &CPD4_REQ_FIELD (curr_req,
- fxattrop);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
- break;
- }
- case GF_FOP_FGETXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fgetxattr);
- break;
- case GF_FOP_FSETXATTR:
- {
- gfx_fsetxattr_req *args = &CPD4_REQ_FIELD(curr_req,
- fsetxattr);
- GF_FREE (args->dict.pairs.pairs_val);
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
- break;
- }
- case GF_FOP_RCHECKSUM:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, rchecksum);
- break;
- case GF_FOP_SETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, setattr);
- break;
- case GF_FOP_FSETATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fsetattr);
- break;
- case GF_FOP_READDIRP:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, readdirp);
- break;
- case GF_FOP_FREMOVEXATTR:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fremovexattr);
- break;
- case GF_FOP_FALLOCATE:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, fallocate);
- break;
- case GF_FOP_DISCARD:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, discard);
- break;
- case GF_FOP_ZEROFILL:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, zerofill);
- break;
- case GF_FOP_IPC:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, ipc);
- break;
- case GF_FOP_SEEK:
- CLIENT4_COMPOUND_FOP_CLEANUP (curr_req, seek);
- break;
- default:
- break;
- }
- }
+ int i = 0;
+ int length = req->compound_req_array.compound_req_array_len;
+ compound_req_v2 *curr_req = NULL;
- GF_FREE (req->compound_req_array.compound_req_array_val);
+ if (!req->compound_req_array.compound_req_array_val)
return;
-}
+ for (i = 0; i < length; i++) {
+ curr_req = &req->compound_req_array.compound_req_array_val[i];
-void
-client_compound_rsp_cleanup_v2 (gfx_compound_rsp *rsp, int len)
-{
- int i = 0;
- compound_rsp_v2 *this_rsp = NULL;
-
- for (i = 0; i < len; i++) {
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
- switch (this_rsp->fop_enum) {
- /* fops that need extra cleanup */
- case GF_FOP_LK:
- {
- gfx_lk_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, lk);
- free (tmp_rsp->flock.lk_owner.lk_owner_val);
- break;
- }
- case GF_FOP_READLINK:
- {
- gfx_readlink_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readlink);
- free (tmp_rsp->path);
- break;
- }
- case GF_FOP_READDIR:
- {
+ switch (curr_req->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, stat);
+ break;
+ case GF_FOP_READLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readlink);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mknod);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, mkdir);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, unlink);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rmdir);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, symlink);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rename);
+ break;
+ case GF_FOP_LINK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, link);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, truncate);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, open);
+ break;
+ case GF_FOP_READ:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, read);
+ break;
+ case GF_FOP_WRITE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, write);
+ break;
+ case GF_FOP_STATFS:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, statfs);
+ break;
+ case GF_FOP_FLUSH:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, flush);
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsync);
+ break;
+ case GF_FOP_SETXATTR: {
+ gfx_setxattr_req *args = &CPD4_REQ_FIELD(curr_req, setxattr);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setxattr);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, getxattr);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, removexattr);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, opendir);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsyncdir);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, access);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, create);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ftruncate);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fstat);
+ break;
+ case GF_FOP_LK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lk);
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, lookup);
+ break;
+ case GF_FOP_READDIR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdir);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, inodelk);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, finodelk);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, entrylk);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fentrylk);
+ break;
+ case GF_FOP_XATTROP: {
+ gfx_xattrop_req *args = &CPD4_REQ_FIELD(curr_req, xattrop);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, xattrop);
+ break;
+ }
+ case GF_FOP_FXATTROP: {
+ gfx_fxattrop_req *args = &CPD4_REQ_FIELD(curr_req, fxattrop);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fxattrop);
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fgetxattr);
+ break;
+ case GF_FOP_FSETXATTR: {
+ gfx_fsetxattr_req *args = &CPD4_REQ_FIELD(curr_req, fsetxattr);
+ GF_FREE(args->dict.pairs.pairs_val);
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetxattr);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, rchecksum);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, setattr);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fsetattr);
+ break;
+ case GF_FOP_READDIRP:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, readdirp);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fremovexattr);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, fallocate);
+ break;
+ case GF_FOP_DISCARD:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, discard);
+ break;
+ case GF_FOP_ZEROFILL:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, zerofill);
+ break;
+ case GF_FOP_IPC:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, ipc);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT4_COMPOUND_FOP_CLEANUP(curr_req, seek);
+ break;
+ default:
+ break;
+ }
+ }
- gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdir);
- clnt_readdir_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_READDIRP:
- {
+ GF_FREE(req->compound_req_array.compound_req_array_val);
+ return;
+}
- gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp,
- readdirp);
- clnt_readdirp_rsp_cleanup_v2 (tmp_rsp);
- break;
- }
- case GF_FOP_RCHECKSUM:
- {
-
- gfx_rchecksum_rsp *rck = &CPD4_RSP_FIELD(this_rsp,
- rchecksum);
- if (rck->strong_checksum.strong_checksum_val) {
- free (rck->strong_checksum.strong_checksum_val);
- }
- break;
- }
- default:
- break;
+void
+client_compound_rsp_cleanup_v2(gfx_compound_rsp *rsp, int len)
+{
+ int i = 0;
+ compound_rsp_v2 *this_rsp = NULL;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (this_rsp->fop_enum) {
+ /* fops that need extra cleanup */
+ case GF_FOP_LK: {
+ gfx_lk_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, lk);
+ free(tmp_rsp->flock.lk_owner.lk_owner_val);
+ break;
+ }
+ case GF_FOP_READLINK: {
+ gfx_readlink_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readlink);
+ free(tmp_rsp->path);
+ break;
+ }
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdir);
+ clnt_readdir_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *tmp_rsp = &CPD4_RSP_FIELD(this_rsp, readdirp);
+ clnt_readdirp_rsp_cleanup_v2(tmp_rsp);
+ break;
+ }
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_rsp *rck = &CPD4_RSP_FIELD(this_rsp, rchecksum);
+ if (rck->strong_checksum.strong_checksum_val) {
+ free(rck->strong_checksum.strong_checksum_val);
}
+ break;
+ }
+ default:
+ break;
}
- return;
+ }
+ return;
}
int
-client_process_response_v2 (call_frame_t *frame, xlator_t *this,
- struct rpc_req *req, gfx_compound_rsp *rsp,
- compound_args_cbk_t *args_cbk,
- int index)
+client_process_response_v2(call_frame_t *frame, xlator_t *this,
+ struct rpc_req *req, gfx_compound_rsp *rsp,
+ compound_args_cbk_t *args_cbk, int index)
{
- int ret = 0;
- dict_t *xdata = NULL;
- dict_t *xattr = NULL;
- struct iovec vector[MAX_IOVEC] = {{0}, };
- gf_dirent_t entries;
- default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
- clnt_local_t *local = frame->local;
- compound_rsp_v2 *this_rsp = NULL;
- compound_args_t *args = local->compound_args;
-
- this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
- args_cbk->enum_list[index] = this_rsp->fop_enum;
-
- INIT_LIST_HEAD (&entries.list);
-
- switch (args_cbk->enum_list[index]) {
-
+ int ret = 0;
+ dict_t *xdata = NULL;
+ dict_t *xattr = NULL;
+ struct iovec vector[MAX_IOVEC] = {
+ {0},
+ };
+ gf_dirent_t entries;
+ default_args_cbk_t *this_args_cbk = &args_cbk->rsp_list[index];
+ clnt_local_t *local = frame->local;
+ compound_rsp_v2 *this_rsp = NULL;
+ compound_args_t *args = local->compound_args;
+
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+ args_cbk->enum_list[index] = this_rsp->fop_enum;
+
+ INIT_LIST_HEAD(&entries.list);
+
+ switch (args_cbk->enum_list[index]) {
case GF_FOP_STAT:
- case GF_FOP_FSTAT:
- {
- gfx_common_iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
+ case GF_FOP_FSTAT: {
+ gfx_common_iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_stat_rsp;
- client_post_common_iatt (this, tmp_rsp, &this_args_cbk->stat, &xdata);
+ client_post_common_iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &xdata);
- CLIENT4_POST_FOP_TYPE (stat, common_iatt, this_rsp, this_args_cbk,
- &this_args_cbk->stat, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(stat, common_iatt, this_rsp, this_args_cbk,
+ &this_args_cbk->stat, xdata);
+ break;
}
- case GF_FOP_READLINK:
- {
- gfx_readlink_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
+ case GF_FOP_READLINK: {
+ gfx_readlink_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readlink_rsp;
- gfx_stat_to_iattx (&tmp_rsp->buf, &this_args_cbk->stat);
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ gfx_stat_to_iattx(&tmp_rsp->buf, &this_args_cbk->stat);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (readlink, readlink, this_rsp, this_args_cbk,
- tmp_rsp->path, &this_args_cbk->stat,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readlink, readlink, this_rsp, this_args_cbk,
+ tmp_rsp->path, &this_args_cbk->stat, xdata);
+ break;
}
case GF_FOP_MKDIR:
case GF_FOP_MKNOD:
case GF_FOP_SYMLINK:
- case GF_FOP_LINK:
- {
- gfx_common_3iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
+ case GF_FOP_LINK: {
+ gfx_common_3iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_mknod_rsp;
- client_post_common_3iatt (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (mknod, common_3iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
+ client_post_common_3iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(mknod, common_3iatt, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
}
case GF_FOP_UNLINK:
- case GF_FOP_RMDIR:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
+ case GF_FOP_RMDIR: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_unlink_rsp;
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->preparent,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (unlink, common_2iatt, this_rsp, this_args_cbk,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- break;
- }
- case GF_FOP_RENAME:
- {
- gfx_rename_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
-
- client_post_rename_v2 (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, &xdata);
- CLIENT4_POST_FOP_TYPE (rename, rename, this_rsp, this_args_cbk,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent,
- &this_args_cbk->preparent2,
- &this_args_cbk->postparent2, xdata);
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(unlink, common_2iatt, this_rsp, this_args_cbk,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, xdata);
+ break;
+ }
+ case GF_FOP_RENAME: {
+ gfx_rename_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rename_rsp;
+
+ client_post_rename_v2(
+ this, tmp_rsp, &this_args_cbk->stat, &this_args_cbk->preparent,
+ &this_args_cbk->postparent, &this_args_cbk->preparent2,
+ &this_args_cbk->postparent2, &xdata);
+ CLIENT4_POST_FOP_TYPE(
+ rename, rename, this_rsp, this_args_cbk, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent,
+ &this_args_cbk->preparent2, &this_args_cbk->postparent2, xdata);
+ break;
}
case GF_FOP_WRITE:
case GF_FOP_TRUNCATE:
@@ -3026,97 +2780,88 @@ client_process_response_v2 (call_frame_t *frame, xlator_t *this,
case GF_FOP_DISCARD:
case GF_FOP_FALLOCATE:
case GF_FOP_FSETATTR:
- case GF_FOP_SETATTR:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
-
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->prestat,
- &this_args_cbk->poststat, &xdata);
- CLIENT4_POST_FOP_TYPE (truncate, common_2iatt, this_rsp, this_args_cbk,
- &this_args_cbk->prestat,
- &this_args_cbk->poststat, xdata);
- break;
- }
- case GF_FOP_OPEN:
- {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
-
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (open, open, this_rsp, this_args_cbk, local->fd,
- xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd,
- 0);
- break;
- }
- case GF_FOP_READ:
- {
- gfx_read_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
-
- client_post_readv_v2 (this, tmp_rsp, &this_args_cbk->iobref,
- req->rsp_iobref, &this_args_cbk->stat,
- vector, &req->rsp[1], &this_args_cbk->count,
- &xdata);
-
- /* Each read should be given read response that only
- * corresponds to its request.
- * Modify the iovecs accordingly.
- * After each read, store the length of data already read
- * so that the next ones can continue from there.
- */
- if (local->read_length) {
- vector[0].iov_base += local->read_length;
- local->read_length += tmp_rsp->op_ret;
- } else {
- local->read_length = tmp_rsp->op_ret;
- }
-
- args_readv_cbk_store (this_args_cbk, tmp_rsp->op_ret,
- gf_error_to_errno (tmp_rsp->op_errno),
- vector, this_args_cbk->count,
- &this_args_cbk->stat,
- this_args_cbk->iobref, xdata);
-
- if (tmp_rsp->op_ret >= 0)
- if (local->attempt_reopen)
- client_attempt_reopen (local->fd, this);
+ case GF_FOP_SETATTR: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_truncate_rsp;
- break;
- }
- case GF_FOP_STATFS:
- {
- gfx_statfs_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
-
- gf_statfs_to_statfs (&tmp_rsp->statfs, &this_args_cbk->statvfs);
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP_TYPE (statfs, statfs, this_rsp, this_args_cbk,
- &this_args_cbk->statvfs, xdata);
- break;
- }
- case GF_FOP_FLUSH:
- {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
-
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
-
- CLIENT4_POST_FOP (flush, this_rsp, this_args_cbk, xdata);
- if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous (local->fd)) {
- /* Delete all saved locks of the owner issuing flush */
- ret = delete_granted_locks_owner (local->fd, &local->owner);
- gf_msg_trace (this->name, 0,
- "deleting locks of owner (%s) returned %d",
- lkowner_utoa (&local->owner), ret);
- }
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, &xdata);
+ CLIENT4_POST_FOP_TYPE(truncate, common_2iatt, this_rsp,
+ this_args_cbk, &this_args_cbk->prestat,
+ &this_args_cbk->poststat, xdata);
+ break;
+ }
+ case GF_FOP_OPEN: {
+ gfx_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_open_rsp;
+
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+ CLIENT4_POST_FOP_TYPE(open, open, this_rsp, this_args_cbk,
+ local->fd, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
+ }
+ case GF_FOP_READ: {
+ gfx_read_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_read_rsp;
+
+ client_post_readv_v2(this, tmp_rsp, &this_args_cbk->iobref,
+ req->rsp_iobref, &this_args_cbk->stat, vector,
+ &req->rsp[1], &this_args_cbk->count, &xdata);
+
+ /* Each read should be given read response that only
+ * corresponds to its request.
+ * Modify the iovecs accordingly.
+ * After each read, store the length of data already read
+ * so that the next ones can continue from there.
+ */
+ if (local->read_length) {
+ vector[0].iov_base += local->read_length;
+ local->read_length += tmp_rsp->op_ret;
+ } else {
+ local->read_length = tmp_rsp->op_ret;
+ }
+
+ args_readv_cbk_store(this_args_cbk, tmp_rsp->op_ret,
+ gf_error_to_errno(tmp_rsp->op_errno), vector,
+ this_args_cbk->count, &this_args_cbk->stat,
+ this_args_cbk->iobref, xdata);
+
+ if (tmp_rsp->op_ret >= 0)
+ if (local->attempt_reopen)
+ client_attempt_reopen(local->fd, this);
+
+ break;
+ }
+ case GF_FOP_STATFS: {
+ gfx_statfs_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_statfs_rsp;
+
+ gf_statfs_to_statfs(&tmp_rsp->statfs, &this_args_cbk->statvfs);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+
+ CLIENT4_POST_FOP_TYPE(statfs, statfs, this_rsp, this_args_cbk,
+ &this_args_cbk->statvfs, xdata);
+ break;
+ }
+ case GF_FOP_FLUSH: {
+ gfx_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_flush_rsp;
+
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
+
+ CLIENT4_POST_FOP(flush, this_rsp, this_args_cbk, xdata);
+ if (this_args_cbk->op_ret >= 0 && !fd_is_anonymous(local->fd)) {
+ /* Delete all saved locks of the owner issuing flush */
+ ret = delete_granted_locks_owner(local->fd, &local->owner);
+ gf_msg_trace(this->name, 0,
+ "deleting locks of owner (%s) returned %d",
+ lkowner_utoa(&local->owner), ret);
+ }
+ break;
}
case GF_FOP_FSYNCDIR:
case GF_FOP_ACCESS:
@@ -3128,290 +2873,284 @@ client_process_response_v2 (call_frame_t *frame, xlator_t *this,
case GF_FOP_FINODELK:
case GF_FOP_ENTRYLK:
case GF_FOP_FENTRYLK:
- case GF_FOP_IPC:
- {
- gfx_common_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_setxattr_rsp;
+ case GF_FOP_IPC: {
+ gfx_common_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_setxattr_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP (setxattr, this_rsp, this_args_cbk, xdata);
- break;
+ CLIENT4_POST_FOP(setxattr, this_rsp, this_args_cbk, xdata);
+ break;
}
case GF_FOP_GETXATTR:
case GF_FOP_FGETXATTR:
case GF_FOP_XATTROP:
- case GF_FOP_FXATTROP:
- {
- gfx_common_dict_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
+ case GF_FOP_FXATTROP: {
+ gfx_common_dict_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp;
- client_post_common_dict (this, tmp_rsp, &xattr, &xdata);
+ client_post_common_dict(this, tmp_rsp, &xattr, &xdata);
- CLIENT4_POST_FOP_TYPE (getxattr, common_dict, this_rsp, this_args_cbk, xattr,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(getxattr, common_dict, this_rsp,
+ this_args_cbk, xattr, xdata);
+ break;
}
- case GF_FOP_OPENDIR:
- {
- gfx_open_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_opendir_rsp;
+ case GF_FOP_OPENDIR: {
+ gfx_open_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_opendir_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (opendir, open, this_rsp, this_args_cbk,
- local->fd, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ CLIENT4_POST_FOP_TYPE(opendir, open, this_rsp, this_args_cbk,
+ local->fd, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_CREATE:
- {
- gfx_create_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
-
- client_post_create_v2 (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, local, &xdata);
-
- CLIENT4_POST_FOP_TYPE (create, create, this_rsp, this_args_cbk,
- local->fd, local->loc.inode,
- &this_args_cbk->stat,
- &this_args_cbk->preparent,
- &this_args_cbk->postparent, xdata);
- if (-1 != this_args_cbk->op_ret)
- ret = client_add_fd_to_saved_fds (this, local->fd,
- &local->loc,
- args->req_list[index].flags,
- tmp_rsp->fd, 0);
- break;
+ case GF_FOP_CREATE: {
+ gfx_create_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_create_rsp;
+
+ client_post_create_v2(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent, local, &xdata);
+
+ CLIENT4_POST_FOP_TYPE(
+ create, create, this_rsp, this_args_cbk, local->fd,
+ local->loc.inode, &this_args_cbk->stat,
+ &this_args_cbk->preparent, &this_args_cbk->postparent, xdata);
+ if (-1 != this_args_cbk->op_ret)
+ ret = client_add_fd_to_saved_fds(this, local->fd, &local->loc,
+ args->req_list[index].flags,
+ tmp_rsp->fd, 0);
+ break;
}
- case GF_FOP_LK:
- {
- gfx_lk_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
+ case GF_FOP_LK: {
+ gfx_lk_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lk_rsp;
- client_post_lk_v2 (this, tmp_rsp, &this_args_cbk->lock, &xdata);
+ client_post_lk_v2(this, tmp_rsp, &this_args_cbk->lock, &xdata);
- CLIENT4_POST_FOP_TYPE (lk, lk, this_rsp, this_args_cbk,
- &this_args_cbk->lock, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(lk, lk, this_rsp, this_args_cbk,
+ &this_args_cbk->lock, xdata);
+ break;
}
- case GF_FOP_LOOKUP:
- {
- gfx_common_2iatt_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
+ case GF_FOP_LOOKUP: {
+ gfx_common_2iatt_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lookup_rsp;
- client_post_common_2iatt (this, tmp_rsp, &this_args_cbk->stat,
- &this_args_cbk->postparent, &xdata);
- CLIENT4_POST_FOP_TYPE (lookup, common_2iatt, this_rsp, this_args_cbk,
- local->loc.inode, &this_args_cbk->stat,
- xdata, &this_args_cbk->postparent);
- break;
+ client_post_common_2iatt(this, tmp_rsp, &this_args_cbk->stat,
+ &this_args_cbk->postparent, &xdata);
+ CLIENT4_POST_FOP_TYPE(lookup, common_2iatt, this_rsp, this_args_cbk,
+ local->loc.inode, &this_args_cbk->stat, xdata,
+ &this_args_cbk->postparent);
+ break;
}
- case GF_FOP_READDIR:
- {
- gfx_readdir_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
+ case GF_FOP_READDIR: {
+ gfx_readdir_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdir_rsp;
- client_post_readdir_v2 (this, tmp_rsp, &entries, &xdata);
+ client_post_readdir_v2(this, tmp_rsp, &entries, &xdata);
- CLIENT4_POST_FOP_TYPE (readdir, readdir, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readdir, readdir, this_rsp, this_args_cbk,
+ &entries, xdata);
+ break;
}
- case GF_FOP_RCHECKSUM:
- {
- gfx_rchecksum_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
+ case GF_FOP_RCHECKSUM: {
+ gfx_rchecksum_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_rchecksum_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (rchecksum, rchecksum, this_rsp, this_args_cbk,
- tmp_rsp->weak_checksum,
- (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val,
- xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(
+ rchecksum, rchecksum, this_rsp, this_args_cbk,
+ tmp_rsp->weak_checksum,
+ (uint8_t *)tmp_rsp->strong_checksum.strong_checksum_val, xdata);
+ break;
}
- case GF_FOP_READDIRP:
- {
- gfx_readdirp_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
+ case GF_FOP_READDIRP: {
+ gfx_readdirp_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_readdirp_rsp;
- client_post_readdirp_v2 (this, tmp_rsp, local->fd, &entries,
- &xdata);
+ client_post_readdirp_v2(this, tmp_rsp, local->fd, &entries, &xdata);
- CLIENT4_POST_FOP_TYPE (readdirp, readdirp, this_rsp, this_args_cbk,
- &entries, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(readdirp, readdirp, this_rsp, this_args_cbk,
+ &entries, xdata);
+ break;
}
- case GF_FOP_SEEK:
- {
- gfx_seek_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
+ case GF_FOP_SEEK: {
+ gfx_seek_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_seek_rsp;
- xdr_to_dict (&tmp_rsp->xdata, &xdata);
+ xdr_to_dict(&tmp_rsp->xdata, &xdata);
- CLIENT4_POST_FOP_TYPE (seek, seek, this_rsp, this_args_cbk,
- tmp_rsp->offset, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(seek, seek, this_rsp, this_args_cbk,
+ tmp_rsp->offset, xdata);
+ break;
}
- case GF_FOP_LEASE:
- {
- gfx_lease_rsp *tmp_rsp = NULL;
- tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
+ case GF_FOP_LEASE: {
+ gfx_lease_rsp *tmp_rsp = NULL;
+ tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_lease_rsp;
- client_post_lease_v2 (this, tmp_rsp, &this_args_cbk->lease,
- &xdata);
+ client_post_lease_v2(this, tmp_rsp, &this_args_cbk->lease, &xdata);
- CLIENT4_POST_FOP_TYPE (lease, lease, this_rsp, this_args_cbk,
- &this_args_cbk->lease, xdata);
- break;
+ CLIENT4_POST_FOP_TYPE(lease, lease, this_rsp, this_args_cbk,
+ &this_args_cbk->lease, xdata);
+ break;
}
default:
- return -ENOTSUP;
- }
-
- if (xdata)
- dict_unref (xdata);
- if (xattr)
- dict_unref (xattr);
- gf_dirent_free (&entries);
- return 0;
+ return -ENOTSUP;
+ }
+
+ if (xdata)
+ dict_unref(xdata);
+ if (xattr)
+ dict_unref(xattr);
+ gf_dirent_free(&entries);
+ return 0;
}
extern int
-client3_3_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client3_3_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client3_3_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client3_3_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client4_0_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client4_0_releasedir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
extern int
-client4_0_release_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe);
+client4_0_release_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe);
static int
-send_release4_0_over_wire (xlator_t *this, clnt_fd_ctx_t *fdctx,
- call_frame_t *fr)
+send_release4_0_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ call_frame_t *fr)
{
- clnt_conf_t *conf = NULL;
- conf = (clnt_conf_t *) this->private;
- if (fdctx->is_dir) {
- gfx_releasedir_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
-
- gf_msg_trace (this->name, 0, "sending releasedir on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASEDIR,
- client4_0_releasedir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_releasedir_req);
- } else {
- gfx_release_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending release on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASE,
- client4_0_release_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfx_release_req);
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ conf = (clnt_conf_t *)this->private;
+ if (fdctx->is_dir) {
+ gfx_releasedir_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+
+ gf_msg_trace(this->name, 0, "sending releasedir on fd");
+ (void)client_submit_request(
+ this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
+ client4_0_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfx_releasedir_req);
+ } else {
+ gfx_release_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending release on fd");
+ (void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
+ client4_0_release_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfx_release_req);
+ }
+
+ return 0;
}
static int
-send_release3_3_over_wire (xlator_t *this, clnt_fd_ctx_t *fdctx,
- call_frame_t *fr)
+send_release3_3_over_wire(xlator_t *this, clnt_fd_ctx_t *fdctx,
+ call_frame_t *fr)
{
- clnt_conf_t *conf = NULL;
- conf = (clnt_conf_t *) this->private;
- if (fdctx->is_dir) {
- gfs3_releasedir_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending releasedir on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASEDIR,
- client3_3_releasedir_cbk,
- NULL, NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_releasedir_req);
- } else {
- gfs3_release_req req = {{0,},};
- memcpy (req.gfid, fdctx->gfid, 16);
- req.fd = fdctx->remote_fd;
- gf_msg_trace (this->name, 0, "sending release on fd");
- (void)client_submit_request (this, &req, fr, conf->fops,
- GFS3_OP_RELEASE,
- client3_3_release_cbk, NULL,
- NULL, 0, NULL, 0, NULL,
- (xdrproc_t)xdr_gfs3_release_req);
- }
-
- return 0;
+ clnt_conf_t *conf = NULL;
+ conf = (clnt_conf_t *)this->private;
+ if (fdctx->is_dir) {
+ gfs3_releasedir_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending releasedir on fd");
+ (void)client_submit_request(
+ this, &req, fr, conf->fops, GFS3_OP_RELEASEDIR,
+ client3_3_releasedir_cbk, NULL, NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_releasedir_req);
+ } else {
+ gfs3_release_req req = {
+ {
+ 0,
+ },
+ };
+ memcpy(req.gfid, fdctx->gfid, 16);
+ req.fd = fdctx->remote_fd;
+ gf_msg_trace(this->name, 0, "sending release on fd");
+ (void)client_submit_request(this, &req, fr, conf->fops, GFS3_OP_RELEASE,
+ client3_3_release_cbk, NULL, NULL, 0, NULL,
+ 0, NULL, (xdrproc_t)xdr_gfs3_release_req);
+ }
+
+ return 0;
}
int
-client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
+client_fdctx_destroy(xlator_t *this, clnt_fd_ctx_t *fdctx)
{
- clnt_conf_t *conf = NULL;
- call_frame_t *fr = NULL;
- int32_t ret = -1;
- char parent_down = 0;
- fd_lk_ctx_t *lk_ctx = NULL;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
-
- conf = (clnt_conf_t *) this->private;
-
- if (fdctx->remote_fd == -1) {
- gf_msg_debug (this->name, 0, "not a valid fd");
- goto out;
- }
-
- pthread_mutex_lock (&conf->lock);
- {
- parent_down = conf->parent_down;
- }
- pthread_mutex_unlock (&conf->lock);
- lk_ctx = fdctx->lk_ctx;
- fdctx->lk_ctx = NULL;
-
- if (lk_ctx)
- fd_lk_ctx_unref (lk_ctx);
-
- if (!parent_down)
- rpc_clnt_ref (conf->rpc);
- else
- goto out;
-
- fr = create_frame (this, this->ctx->pool);
- if (fr == NULL) {
- goto out;
- }
-
- ret = 0;
-
- if (conf->fops->progver == GLUSTER_FOP_VERSION)
- send_release3_3_over_wire (this, fdctx, fr);
- else
- send_release4_0_over_wire (this, fdctx, fr);
-
- rpc_clnt_unref (conf->rpc);
+ clnt_conf_t *conf = NULL;
+ call_frame_t *fr = NULL;
+ int32_t ret = -1;
+ char parent_down = 0;
+ fd_lk_ctx_t *lk_ctx = NULL;
+
+ GF_VALIDATE_OR_GOTO("client", this, out);
+ GF_VALIDATE_OR_GOTO(this->name, fdctx, out);
+
+ conf = (clnt_conf_t *)this->private;
+
+ if (fdctx->remote_fd == -1) {
+ gf_msg_debug(this->name, 0, "not a valid fd");
+ goto out;
+ }
+
+ pthread_mutex_lock(&conf->lock);
+ {
+ parent_down = conf->parent_down;
+ }
+ pthread_mutex_unlock(&conf->lock);
+ lk_ctx = fdctx->lk_ctx;
+ fdctx->lk_ctx = NULL;
+
+ if (lk_ctx)
+ fd_lk_ctx_unref(lk_ctx);
+
+ if (!parent_down)
+ rpc_clnt_ref(conf->rpc);
+ else
+ goto out;
+
+ fr = create_frame(this, this->ctx->pool);
+ if (fr == NULL) {
+ goto out;
+ }
+
+ ret = 0;
+
+ if (conf->fops->progver == GLUSTER_FOP_VERSION)
+ send_release3_3_over_wire(this, fdctx, fr);
+ else
+ send_release4_0_over_wire(this, fdctx, fr);
+
+ rpc_clnt_unref(conf->rpc);
out:
- if (fdctx) {
- fdctx->remote_fd = -1;
- GF_FREE (fdctx);
- }
+ if (fdctx) {
+ fdctx->remote_fd = -1;
+ GF_FREE(fdctx);
+ }
- return ret;
+ return ret;
}
diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c
index 4851252..48f3211 100644
--- a/xlators/protocol/client/src/client-lk.c
+++ b/xlators/protocol/client/src/client-lk.c
@@ -15,519 +15,504 @@
#include "client-messages.h"
static void
-__insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock);
+__insert_and_merge(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock);
static void
-__dump_client_lock (client_posix_lock_t *lock)
+__dump_client_lock(client_posix_lock_t *lock)
{
- xlator_t *this = NULL;
-
- this = THIS;
-
- gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
- "{fd=%p}"
- "{%s lk-owner:%s %"PRId64" - %"PRId64"}"
- "{start=%"PRId64" end=%"PRId64"}",
- lock->fd,
- lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
- lkowner_utoa (&lock->owner),
- lock->user_flock.l_start,
- lock->user_flock.l_len,
- lock->fl_start,
- lock->fl_end);
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
+ "{fd=%p}"
+ "{%s lk-owner:%s %" PRId64 " - %" PRId64
+ "}"
+ "{start=%" PRId64 " end=%" PRId64 "}",
+ lock->fd, lock->fl_type == F_WRLCK ? "Write-Lock" : "Read-Lock",
+ lkowner_utoa(&lock->owner), lock->user_flock.l_start,
+ lock->user_flock.l_len, lock->fl_start, lock->fl_end);
}
static int
-dump_client_locks_fd (clnt_fd_ctx_t *fdctx)
+dump_client_locks_fd(clnt_fd_ctx_t *fdctx)
{
- client_posix_lock_t *lock = NULL;
- int count = 0;
+ client_posix_lock_t *lock = NULL;
+ int count = 0;
- list_for_each_entry (lock, &fdctx->lock_list, list) {
- __dump_client_lock (lock);
- count++;
- }
-
- return count;
+ list_for_each_entry(lock, &fdctx->lock_list, list)
+ {
+ __dump_client_lock(lock);
+ count++;
+ }
+ return count;
}
int
-dump_client_locks (inode_t *inode)
+dump_client_locks(inode_t *inode)
{
- fd_t *fd = NULL;
- xlator_t *this = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
- clnt_conf_t *conf = NULL;
+ fd_t *fd = NULL;
+ xlator_t *this = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ clnt_conf_t *conf = NULL;
- int total_count = 0;
- int locks_fd_count = 0;
+ int total_count = 0;
+ int locks_fd_count = 0;
- this = THIS;
- conf = this->private;
+ this = THIS;
+ conf = this->private;
- LOCK (&inode->lock);
+ LOCK(&inode->lock);
+ {
+ list_for_each_entry(fd, &inode->fd_list, inode_list)
{
- list_for_each_entry (fd, &inode->fd_list, inode_list) {
- locks_fd_count = 0;
+ locks_fd_count = 0;
- pthread_spin_lock(&conf->fd_lock);
- fdctx = this_fd_get_ctx (fd, this);
- if (fdctx)
- locks_fd_count = dump_client_locks_fd (fdctx);
- pthread_spin_unlock(&conf->fd_lock);
-
- total_count += locks_fd_count;
- }
+ pthread_spin_lock(&conf->fd_lock);
+ fdctx = this_fd_get_ctx(fd, this);
+ if (fdctx)
+ locks_fd_count = dump_client_locks_fd(fdctx);
+ pthread_spin_unlock(&conf->fd_lock);
+ total_count += locks_fd_count;
}
- UNLOCK (&inode->lock);
-
- return total_count;
+ }
+ UNLOCK(&inode->lock);
+ return total_count;
}
static off_t
-__get_lock_length (off_t start, off_t end)
+__get_lock_length(off_t start, off_t end)
{
- if (end == LLONG_MAX)
- return 0;
- else
- return (end - start + 1);
+ if (end == LLONG_MAX)
+ return 0;
+ else
+ return (end - start + 1);
}
/* Add two locks */
static client_posix_lock_t *
-add_locks (client_posix_lock_t *l1, client_posix_lock_t *l2)
+add_locks(client_posix_lock_t *l1, client_posix_lock_t *l2)
{
- client_posix_lock_t *sum = NULL;
+ client_posix_lock_t *sum = NULL;
- sum = GF_CALLOC (1, sizeof (*sum), gf_client_mt_clnt_lock_t);
- if (!sum)
- return NULL;
+ sum = GF_CALLOC(1, sizeof(*sum), gf_client_mt_clnt_lock_t);
+ if (!sum)
+ return NULL;
- sum->fl_start = min (l1->fl_start, l2->fl_start);
- sum->fl_end = max (l1->fl_end, l2->fl_end);
+ sum->fl_start = min(l1->fl_start, l2->fl_start);
+ sum->fl_end = max(l1->fl_end, l2->fl_end);
- sum->user_flock.l_start = sum->fl_start;
- sum->user_flock.l_len = __get_lock_length (sum->fl_start,
- sum->fl_end);
+ sum->user_flock.l_start = sum->fl_start;
+ sum->user_flock.l_len = __get_lock_length(sum->fl_start, sum->fl_end);
- return sum;
+ return sum;
}
-
/* Return true if the locks overlap, false otherwise */
static int
-locks_overlap (client_posix_lock_t *l1, client_posix_lock_t *l2)
+locks_overlap(client_posix_lock_t *l1, client_posix_lock_t *l2)
{
- /*
- Note:
- FUSE always gives us absolute offsets, so no need to worry
- about SEEK_CUR or SEEK_END
- */
-
- return ((l1->fl_end >= l2->fl_start) &&
- (l2->fl_end >= l1->fl_start));
+ /*
+ Note:
+ FUSE always gives us absolute offsets, so no need to worry
+ about SEEK_CUR or SEEK_END
+ */
+
+ return ((l1->fl_end >= l2->fl_start) && (l2->fl_end >= l1->fl_start));
}
static void
-__delete_client_lock (client_posix_lock_t *lock)
+__delete_client_lock(client_posix_lock_t *lock)
{
- list_del_init (&lock->list);
+ list_del_init(&lock->list);
}
/* Destroy a posix_lock */
static void
-__destroy_client_lock (client_posix_lock_t *lock)
+__destroy_client_lock(client_posix_lock_t *lock)
{
- GF_FREE (lock);
+ GF_FREE(lock);
}
/* Subtract two locks */
struct _values {
- client_posix_lock_t *locks[3];
+ client_posix_lock_t *locks[3];
};
/* {big} must always be contained inside {small} */
static struct _values
-subtract_locks (client_posix_lock_t *big, client_posix_lock_t *small)
+subtract_locks(client_posix_lock_t *big, client_posix_lock_t *small)
{
- struct _values v = { .locks = {0, 0, 0} };
-
- if ((big->fl_start == small->fl_start) &&
- (big->fl_end == small->fl_end)) {
- /* both edges coincide with big */
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t );
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_type = small->fl_type;
- }
- else if ((small->fl_start > big->fl_start) &&
- (small->fl_end < big->fl_end)) {
- /* both edges lie inside big */
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_end = small->fl_start - 1;
- v.locks[0]->user_flock.l_len = __get_lock_length (v.locks[0]->fl_start,
- v.locks[0]->fl_end);
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- v.locks[2] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[2]);
- memcpy (v.locks[2], big, sizeof (client_posix_lock_t));
- v.locks[2]->fl_start = small->fl_end + 1;
- v.locks[2]->user_flock.l_start = small->fl_end + 1;
- }
- /* one edge coincides with big */
- else if (small->fl_start == big->fl_start) {
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_start = small->fl_end + 1;
- v.locks[0]->user_flock.l_start = small->fl_end + 1;
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- }
- else if (small->fl_end == big->fl_end) {
- v.locks[0] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[0]);
- memcpy (v.locks[0], big, sizeof (client_posix_lock_t));
- v.locks[0]->fl_end = small->fl_start - 1;
- v.locks[0]->user_flock.l_len = __get_lock_length (v.locks[0]->fl_start,
- v.locks[0]->fl_end);
-
- v.locks[1] = GF_MALLOC (sizeof (client_posix_lock_t),
- gf_client_mt_clnt_lock_t);
- GF_ASSERT (v.locks[1]);
- memcpy (v.locks[1], small, sizeof (client_posix_lock_t));
- }
- else {
- /* LOG-TODO : decide what more info is required here*/
- gf_msg ("client-protocol", GF_LOG_CRITICAL, 0,
- PC_MSG_LOCK_ERROR,
- "Unexpected case in subtract_locks. Please send "
- "a bug report to gluster-devel@gluster.org");
- }
-
- return v;
+ struct _values v = {.locks = {0, 0, 0}};
+
+ if ((big->fl_start == small->fl_start) && (big->fl_end == small->fl_end)) {
+ /* both edges coincide with big */
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_type = small->fl_type;
+ } else if ((small->fl_start > big->fl_start) &&
+ (small->fl_end < big->fl_end)) {
+ /* both edges lie inside big */
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_end = small->fl_start - 1;
+ v.locks[0]->user_flock.l_len = __get_lock_length(v.locks[0]->fl_start,
+ v.locks[0]->fl_end);
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ v.locks[2] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[2]);
+ memcpy(v.locks[2], big, sizeof(client_posix_lock_t));
+ v.locks[2]->fl_start = small->fl_end + 1;
+ v.locks[2]->user_flock.l_start = small->fl_end + 1;
+ }
+ /* one edge coincides with big */
+ else if (small->fl_start == big->fl_start) {
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_start = small->fl_end + 1;
+ v.locks[0]->user_flock.l_start = small->fl_end + 1;
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ } else if (small->fl_end == big->fl_end) {
+ v.locks[0] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[0]);
+ memcpy(v.locks[0], big, sizeof(client_posix_lock_t));
+ v.locks[0]->fl_end = small->fl_start - 1;
+ v.locks[0]->user_flock.l_len = __get_lock_length(v.locks[0]->fl_start,
+ v.locks[0]->fl_end);
+
+ v.locks[1] = GF_MALLOC(sizeof(client_posix_lock_t),
+ gf_client_mt_clnt_lock_t);
+ GF_ASSERT(v.locks[1]);
+ memcpy(v.locks[1], small, sizeof(client_posix_lock_t));
+ } else {
+ /* LOG-TODO : decide what more info is required here*/
+ gf_msg("client-protocol", GF_LOG_CRITICAL, 0, PC_MSG_LOCK_ERROR,
+ "Unexpected case in subtract_locks. Please send "
+ "a bug report to gluster-devel@gluster.org");
+ }
+
+ return v;
}
static void
-__delete_unlck_locks (clnt_fd_ctx_t *fdctx)
+__delete_unlck_locks(clnt_fd_ctx_t *fdctx)
{
- client_posix_lock_t *l = NULL;
- client_posix_lock_t *tmp = NULL;
-
- list_for_each_entry_safe (l, tmp, &fdctx->lock_list, list) {
- if (l->fl_type == F_UNLCK) {
- __delete_client_lock (l);
- __destroy_client_lock (l);
- }
- }
+ client_posix_lock_t *l = NULL;
+ client_posix_lock_t *tmp = NULL;
+
+ list_for_each_entry_safe(l, tmp, &fdctx->lock_list, list)
+ {
+ if (l->fl_type == F_UNLCK) {
+ __delete_client_lock(l);
+ __destroy_client_lock(l);
+ }
+ }
}
static void
-__insert_lock (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+__insert_lock(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- list_add_tail (&lock->list, &fdctx->lock_list);
+ list_add_tail(&lock->list, &fdctx->lock_list);
- return;
+ return;
}
static void
-__insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+__insert_and_merge(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- client_posix_lock_t *conf = NULL;
- client_posix_lock_t *t = NULL;
- client_posix_lock_t *sum = NULL;
- int i = 0;
- struct _values v = { .locks = {0, 0, 0} };
-
- list_for_each_entry_safe (conf, t, &fdctx->lock_list, list) {
- if (!locks_overlap (conf, lock))
- continue;
+ client_posix_lock_t *conf = NULL;
+ client_posix_lock_t *t = NULL;
+ client_posix_lock_t *sum = NULL;
+ int i = 0;
+ struct _values v = {.locks = {0, 0, 0}};
- if (is_same_lkowner (&conf->owner, &lock->owner)) {
- if (conf->fl_type == lock->fl_type) {
- sum = add_locks (lock, conf);
+ list_for_each_entry_safe(conf, t, &fdctx->lock_list, list)
+ {
+ if (!locks_overlap(conf, lock))
+ continue;
- sum->fd = lock->fd;
+ if (is_same_lkowner(&conf->owner, &lock->owner)) {
+ if (conf->fl_type == lock->fl_type) {
+ sum = add_locks(lock, conf);
- __delete_client_lock (conf);
- __destroy_client_lock (conf);
+ sum->fd = lock->fd;
- __destroy_client_lock (lock);
- __insert_and_merge (fdctx, sum);
+ __delete_client_lock(conf);
+ __destroy_client_lock(conf);
- return;
- } else {
- sum = add_locks (lock, conf);
+ __destroy_client_lock(lock);
+ __insert_and_merge(fdctx, sum);
- sum->fd = conf->fd;
- sum->owner = conf->owner;
+ return;
+ } else {
+ sum = add_locks(lock, conf);
- v = subtract_locks (sum, lock);
+ sum->fd = conf->fd;
+ sum->owner = conf->owner;
- __delete_client_lock (conf);
- __destroy_client_lock (conf);
+ v = subtract_locks(sum, lock);
- __delete_client_lock (lock);
- __destroy_client_lock (lock);
+ __delete_client_lock(conf);
+ __destroy_client_lock(conf);
- __destroy_client_lock (sum);
+ __delete_client_lock(lock);
+ __destroy_client_lock(lock);
- for (i = 0; i < 3; i++) {
- if (!v.locks[i])
- continue;
+ __destroy_client_lock(sum);
- INIT_LIST_HEAD (&v.locks[i]->list);
- __insert_and_merge (fdctx,
- v.locks[i]);
- }
+ for (i = 0; i < 3; i++) {
+ if (!v.locks[i])
+ continue;
- __delete_unlck_locks (fdctx);
- return;
- }
+ INIT_LIST_HEAD(&v.locks[i]->list);
+ __insert_and_merge(fdctx, v.locks[i]);
}
- if (lock->fl_type == F_UNLCK) {
- continue;
- }
+ __delete_unlck_locks(fdctx);
+ return;
+ }
+ }
- if ((conf->fl_type == F_RDLCK) && (lock->fl_type == F_RDLCK)) {
- __insert_lock (fdctx, lock);
- return;
- }
+ if (lock->fl_type == F_UNLCK) {
+ continue;
}
- /* no conflicts, so just insert */
- if (lock->fl_type != F_UNLCK) {
- __insert_lock (fdctx, lock);
- } else {
- __destroy_client_lock (lock);
+ if ((conf->fl_type == F_RDLCK) && (lock->fl_type == F_RDLCK)) {
+ __insert_lock(fdctx, lock);
+ return;
}
+ }
+
+ /* no conflicts, so just insert */
+ if (lock->fl_type != F_UNLCK) {
+ __insert_lock(fdctx, lock);
+ } else {
+ __destroy_client_lock(lock);
+ }
}
static void
-client_setlk (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
+client_setlk(clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock)
{
- __insert_and_merge (fdctx, lock);
+ __insert_and_merge(fdctx, lock);
}
static void
-destroy_client_lock (client_posix_lock_t *lock)
+destroy_client_lock(client_posix_lock_t *lock)
{
- GF_FREE (lock);
+ GF_FREE(lock);
}
int32_t
-delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner)
+delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner)
{
- clnt_fd_ctx_t *fdctx = NULL;
- client_posix_lock_t *lock = NULL;
- client_posix_lock_t *tmp = NULL;
- xlator_t *this = NULL;
- clnt_conf_t *conf = NULL;
-
- struct list_head delete_list;
- int ret = 0;
- int count = 0;
-
- INIT_LIST_HEAD (&delete_list);
- this = THIS;
- conf = this->private;
-
- pthread_spin_lock(&conf->fd_lock);
-
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
-
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_FD_CTX_INVALID, "fdctx not valid");
- ret = -1;
- goto out;
- }
+ clnt_fd_ctx_t *fdctx = NULL;
+ client_posix_lock_t *lock = NULL;
+ client_posix_lock_t *tmp = NULL;
+ xlator_t *this = NULL;
+ clnt_conf_t *conf = NULL;
- list_for_each_entry_safe (lock, tmp, &fdctx->lock_list, list) {
- if (!is_same_lkowner (&lock->owner, owner)) {
- list_del_init (&lock->list);
- list_add_tail (&lock->list, &delete_list);
- count++;
- }
- }
+ struct list_head delete_list;
+ int ret = 0;
+ int count = 0;
+ INIT_LIST_HEAD(&delete_list);
+ this = THIS;
+ conf = this->private;
+
+ pthread_spin_lock(&conf->fd_lock);
+
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock);
- list_for_each_entry_safe (lock, tmp, &delete_list, list) {
- list_del_init (&lock->list);
- destroy_client_lock (lock);
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
+ "fdctx not valid");
+ ret = -1;
+ goto out;
+ }
+
+ list_for_each_entry_safe(lock, tmp, &fdctx->lock_list, list)
+ {
+ if (!is_same_lkowner(&lock->owner, owner)) {
+ list_del_init(&lock->list);
+ list_add_tail(&lock->list, &delete_list);
+ count++;
}
+ }
+
+ pthread_spin_unlock(&conf->fd_lock);
- /* FIXME: Need to actually print the locks instead of count */
- gf_msg_trace (this->name, 0,
- "Number of locks cleared=%d", count);
+ list_for_each_entry_safe(lock, tmp, &delete_list, list)
+ {
+ list_del_init(&lock->list);
+ destroy_client_lock(lock);
+ }
+
+ /* FIXME: Need to actually print the locks instead of count */
+ gf_msg_trace(this->name, 0, "Number of locks cleared=%d", count);
out:
- return ret;
+ return ret;
}
int32_t
-client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd)
+client_cmd_to_gf_cmd(int32_t cmd, int32_t *gf_cmd)
{
- int ret = 0;
-
- if (cmd == F_GETLK || cmd == F_GETLK64)
- *gf_cmd = GF_LK_GETLK;
- else if (cmd == F_SETLK || cmd == F_SETLK64)
- *gf_cmd = GF_LK_SETLK;
- else if (cmd == F_SETLKW || cmd == F_SETLKW64)
- *gf_cmd = GF_LK_SETLKW;
- else if (cmd == F_RESLK_LCK)
- *gf_cmd = GF_LK_RESLK_LCK;
- else if (cmd == F_RESLK_LCKW)
- *gf_cmd = GF_LK_RESLK_LCKW;
- else if (cmd == F_RESLK_UNLCK)
- *gf_cmd = GF_LK_RESLK_UNLCK;
- else if (cmd == F_GETLK_FD)
- *gf_cmd = GF_LK_GETLK_FD;
- else
- ret = -1;
-
- return ret;
-
+ int ret = 0;
+
+ if (cmd == F_GETLK || cmd == F_GETLK64)
+ *gf_cmd = GF_LK_GETLK;
+ else if (cmd == F_SETLK || cmd == F_SETLK64)
+ *gf_cmd = GF_LK_SETLK;
+ else if (cmd == F_SETLKW || cmd == F_SETLKW64)
+ *gf_cmd = GF_LK_SETLKW;
+ else if (cmd == F_RESLK_LCK)
+ *gf_cmd = GF_LK_RESLK_LCK;
+ else if (cmd == F_RESLK_LCKW)
+ *gf_cmd = GF_LK_RESLK_LCKW;
+ else if (cmd == F_RESLK_UNLCK)
+ *gf_cmd = GF_LK_RESLK_UNLCK;
+ else if (cmd == F_GETLK_FD)
+ *gf_cmd = GF_LK_GETLK_FD;
+ else
+ ret = -1;
+
+ return ret;
}
static client_posix_lock_t *
-new_client_lock (struct gf_flock *flock, gf_lkowner_t *owner,
- int32_t cmd, fd_t *fd)
+new_client_lock(struct gf_flock *flock, gf_lkowner_t *owner, int32_t cmd,
+ fd_t *fd)
{
- client_posix_lock_t *new_lock = NULL;
+ client_posix_lock_t *new_lock = NULL;
- new_lock = GF_CALLOC (1, sizeof (*new_lock),
- gf_client_mt_clnt_lock_t);
- if (!new_lock) {
- goto out;
- }
+ new_lock = GF_CALLOC(1, sizeof(*new_lock), gf_client_mt_clnt_lock_t);
+ if (!new_lock) {
+ goto out;
+ }
- INIT_LIST_HEAD (&new_lock->list);
- new_lock->fd = fd;
- memcpy (&new_lock->user_flock, flock, sizeof (struct gf_flock));
+ INIT_LIST_HEAD(&new_lock->list);
+ new_lock->fd = fd;
+ memcpy(&new_lock->user_flock, flock, sizeof(struct gf_flock));
- new_lock->fl_type = flock->l_type;
- new_lock->fl_start = flock->l_start;
+ new_lock->fl_type = flock->l_type;
+ new_lock->fl_start = flock->l_start;
- if (flock->l_len == 0)
- new_lock->fl_end = LLONG_MAX;
- else
- new_lock->fl_end = flock->l_start + flock->l_len - 1;
+ if (flock->l_len == 0)
+ new_lock->fl_end = LLONG_MAX;
+ else
+ new_lock->fl_end = flock->l_start + flock->l_len - 1;
- new_lock->owner = *owner;
+ new_lock->owner = *owner;
- new_lock->cmd = cmd; /* Not really useful */
+ new_lock->cmd = cmd; /* Not really useful */
out:
- return new_lock;
+ return new_lock;
}
void
-client_save_number_fds (clnt_conf_t *conf, int count)
+client_save_number_fds(clnt_conf_t *conf, int count)
{
- LOCK (&conf->rec_lock);
- {
- conf->reopen_fd_count = count;
- }
- UNLOCK (&conf->rec_lock);
+ LOCK(&conf->rec_lock);
+ {
+ conf->reopen_fd_count = count;
+ }
+ UNLOCK(&conf->rec_lock);
}
int
-client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock,
- gf_lkowner_t *owner, int32_t cmd)
+client_add_lock_for_recovery(fd_t *fd, struct gf_flock *flock,
+ gf_lkowner_t *owner, int32_t cmd)
{
- clnt_fd_ctx_t *fdctx = NULL;
- xlator_t *this = NULL;
- client_posix_lock_t *lock = NULL;
- clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+ xlator_t *this = NULL;
+ client_posix_lock_t *lock = NULL;
+ clnt_conf_t *conf = NULL;
- int ret = 0;
+ int ret = 0;
- this = THIS;
- conf = this->private;
+ this = THIS;
+ conf = this->private;
- pthread_spin_lock(&conf->fd_lock);
+ pthread_spin_lock(&conf->fd_lock);
- fdctx = this_fd_get_ctx (fd, this);
- if (!fdctx) {
- pthread_spin_unlock(&conf->fd_lock);
+ fdctx = this_fd_get_ctx(fd, this);
+ if (!fdctx) {
+ pthread_spin_unlock(&conf->fd_lock);
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
- "failed to get fd context. sending EBADFD");
- ret = -EBADFD;
- goto out;
- }
+ gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
+ "failed to get fd context. sending EBADFD");
+ ret = -EBADFD;
+ goto out;
+ }
- lock = new_client_lock (flock, owner, cmd, fd);
- if (!lock) {
- pthread_spin_unlock(&conf->fd_lock);
+ lock = new_client_lock(flock, owner, cmd, fd);
+ if (!lock) {
+ pthread_spin_unlock(&conf->fd_lock);
- ret = -ENOMEM;
- goto out;
- }
+ ret = -ENOMEM;
+ goto out;
+ }
- client_setlk (fdctx, lock);
+ client_setlk(fdctx, lock);
- pthread_spin_unlock(&conf->fd_lock);
+ pthread_spin_unlock(&conf->fd_lock);
out:
- return ret;
-
+ return ret;
}
int32_t
-client_dump_locks (char *name, inode_t *inode,
- dict_t *dict)
+client_dump_locks(char *name, inode_t *inode, dict_t *dict)
{
- int ret = 0;
- dict_t *new_dict = NULL;
- char dict_string[256];
-
- GF_ASSERT (dict);
- new_dict = dict;
-
- ret = dump_client_locks (inode);
- snprintf (dict_string, 256, "%d locks dumped in log file", ret);
-
- ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
- PC_MSG_DICT_SET_FAILED,
- "could not set dict with %s", CLIENT_DUMP_LOCKS);
- goto out;
- }
+ int ret = 0;
+ dict_t *new_dict = NULL;
+ char dict_string[256];
+
+ GF_ASSERT(dict);
+ new_dict = dict;
+
+ ret = dump_client_locks(inode);
+ snprintf(dict_string, 256, "%d locks dumped in log file", ret);
+
+ ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
+ if (ret) {
+ gf_msg(THIS->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "could not set dict with %s", CLIENT_DUMP_LOCKS);
+ goto out;
+ }
out:
- return ret;
+ return ret;
}
int32_t
-is_client_dump_locks_cmd (char *name)
+is_client_dump_locks_cmd(char *name)
{
- int ret = 0;
+ int ret = 0;
- if (strcmp (name, CLIENT_DUMP_LOCKS) == 0)
- ret = 1;
+ if (strcmp(name, CLIENT_DUMP_LOCKS) == 0)
+ ret = 1;
- return ret;
+ return ret;
}
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 5c5a96d..9e5a5b4 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -18,5800 +18,5897 @@
#include "client-common.h"
#include "compound-fop-utils.h"
-int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
+int32_t
+client3_getspec(call_frame_t *frame, xlator_t *this, void *data);
rpc_clnt_prog_t clnt3_3_fop_prog;
-
-
/* CBK */
int
-client3_3_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_symlink_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_symlink (this, &rsp, &stbuf, &preparent,
- &postparent, &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_symlink_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_symlink(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1) {
- if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- /* no need to print the gfid, because it will be null,
- * since symlink operation failed.
- */
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: (%s to %s)",
- local->loc.path, local->loc2.path);
- }
+ if (rsp.op_ret == -1) {
+ if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ /* no need to print the gfid, because it will be null,
+ * since symlink operation failed.
+ */
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: (%s to %s)", local->loc.path,
+ local->loc2.path);
}
+ }
- CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode, &stbuf,
- &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(symlink, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_mknod_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
-
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_mknod (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_mknod_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_mknod(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKNOD,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
- CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- call_frame_t *frame = NULL;
- gfs3_mkdir_rsp rsp = {0,};
- struct iatt stbuf = {0,};
- struct iatt preparent = {0,};
- struct iatt postparent = {0,};
- int ret = 0;
- clnt_local_t *local = NULL;
- inode_t *inode = NULL;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- local = frame->local;
- inode = local->loc.inode;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_mkdir (this, &rsp, &stbuf, &preparent, &postparent,
- &xdata);
+ call_frame_t *frame = NULL;
+ gfs3_mkdir_rsp rsp = {
+ 0,
+ };
+ struct iatt stbuf = {
+ 0,
+ };
+ struct iatt preparent = {
+ 0,
+ };
+ struct iatt postparent = {
+ 0,
+ };
+ int ret = 0;
+ clnt_local_t *local = NULL;
+ inode_t *inode = NULL;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ local = frame->local;
+ inode = local->loc.inode;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_mkdir(this, &rsp, &stbuf, &preparent, &postparent,
+ &xdata);
out:
- if (rsp.op_ret == -1 &&
- GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
- gf_msg (this->name, fop_log_level (GF_FOP_MKDIR,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s",
- local->loc.path);
- }
+ if (rsp.op_ret == -1 &&
+ GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s", local->loc.path);
+ }
- CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), inode,
- &stbuf, &preparent, &postparent, xdata);
+ CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), inode, &stbuf,
+ &preparent, &postparent, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
int
-_copy_gfid_from_inode_holders (uuid_t gfid, loc_t *loc, fd_t *fd)
+_copy_gfid_from_inode_holders(uuid_t gfid, loc_t *loc, fd_t *fd)
{
- int ret = 0;
-
- if (fd && fd->inode && !gf_uuid_is_null (fd->inode->gfid)) {
- gf_uuid_copy (gfid, fd->inode->gfid);
- goto out;
- }
-
- if (!loc) {
- GF_ASSERT (0);
- ret = -1;
- goto out;
- }
-
- if (loc->inode && !gf_uuid_is_null (loc->inode->gfid)) {
- gf_uuid_copy (gfid, loc->inode->gfid);
- } else if (!gf_uuid_is_null (loc->gfid)) {
- gf_uuid_copy (gfid, loc->gfid);
- } else {
- GF_ASSERT (0);
- ret = -1;
- }
+ int ret = 0;
+
+ if (fd && fd->inode && !gf_uuid_is_null(fd->inode->gfid)) {
+ gf_uuid_copy(gfid, fd->inode->gfid);
+ goto out;
+ }
+
+ if (!loc) {
+ GF_ASSERT(0);
+ ret = -1;
+ goto out;
+ }
+
+ if (loc->inode && !gf_uuid_is_null(loc->inode->gfid)) {
+ gf_uuid_copy(gfid, loc->inode->gfid);
+ } else if (!gf_uuid_is_null(loc->gfid)) {
+ gf_uuid_copy(gfid, loc->gfid);
+ } else {
+ GF_ASSERT(0);
+ ret = -1;
+ }
out:
- return ret;
+ return ret;
}
int
-client_add_fd_to_saved_fds (xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
- int64_t remote_fd, int is_dir)
+client_add_fd_to_saved_fds(xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags,
+ int64_t remote_fd, int is_dir)
{
- int ret = 0;
- uuid_t gfid = {0};
- clnt_conf_t *conf = NULL;
- clnt_fd_ctx_t *fdctx = NULL;
-
- conf = this->private;
- ret = _copy_gfid_from_inode_holders (gfid, loc, fd);
- if (ret) {
- ret = -EINVAL;
- goto out;
- }
-
- fdctx = GF_CALLOC (1, sizeof (*fdctx),
- gf_client_mt_clnt_fdctx_t);
- if (!fdctx) {
- ret = -ENOMEM;
- goto out;
- }
-
- gf_uuid_copy (fdctx->gfid, gfid);
- fdctx->is_dir = is_dir;
- fdctx->remote_fd = remote_fd;
- fdctx->flags = flags;
- fdctx->lk_ctx = fd_lk_ctx_ref (fd->lk_ctx);
- fdctx->reopen_done = client_default_reopen_done;
-
- INIT_LIST_HEAD (&fdctx->sfd_pos);
- INIT_LIST_HEAD (&fdctx->lock_list);
-
- pthread_spin_lock (&conf->fd_lock);
- {
- this_fd_set_ctx (fd, this, loc, fdctx);
-
- list_add_tail (&fdctx->sfd_pos, &conf->saved_fds);
- }
- pthread_spin_unlock (&conf->fd_lock);
+ int ret = 0;
+ uuid_t gfid = {0};
+ clnt_conf_t *conf = NULL;
+ clnt_fd_ctx_t *fdctx = NULL;
+
+ conf = this->private;
+ ret = _copy_gfid_from_inode_holders(gfid, loc, fd);
+ if (ret) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ fdctx = GF_CALLOC(1, sizeof(*fdctx), gf_client_mt_clnt_fdctx_t);
+ if (!fdctx) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ gf_uuid_copy(fdctx->gfid, gfid);
+ fdctx->is_dir = is_dir;
+ fdctx->remote_fd = remote_fd;
+ fdctx->flags = flags;
+ fdctx->lk_ctx = fd_lk_ctx_ref(fd->lk_ctx);
+ fdctx->reopen_done = client_default_reopen_done;
+
+ INIT_LIST_HEAD(&fdctx->sfd_pos);
+ INIT_LIST_HEAD(&fdctx->lock_list);
+
+ pthread_spin_lock(&conf->fd_lock);
+ {
+ this_fd_set_ctx(fd, this, loc, fdctx);
+
+ list_add_tail(&fdctx->sfd_pos, &conf->saved_fds);
+ }
+ pthread_spin_unlock(&conf->fd_lock);
out:
- return ret;
+ return ret;
}
int
-client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_open_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- clnt_local_t *local = NULL;
- call_frame_t *frame = NULL;
- fd_t *fd = NULL;
- int ret = 0;
- gfs3_open_rsp rsp = {0,};
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
-
- this = THIS;
-
- frame = myframe;
- local = frame->local;
-
- fd = local->fd;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- if (-1 != rsp.op_ret) {
- ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc,
- local->flags, rsp.fd, 0);
- if (ret) {
- rsp.op_ret = -1;
- rsp.op_errno = -ret;
- goto out;
- }
+ clnt_local_t *local = NULL;
+ call_frame_t *frame = NULL;
+ fd_t *fd = NULL;
+ int ret = 0;
+ gfs3_open_rsp rsp = {
+ 0,
+ };
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+ local = frame->local;
+
+ fd = local->fd;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ if (-1 != rsp.op_ret) {
+ ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc,
+ local->flags, rsp.fd, 0);
+ if (ret) {
+ rsp.op_ret = -1;
+ rsp.op_errno = -ret;
+ goto out;
}
+ }
- ret = client_post_open (this, &rsp, &xdata);
+ ret = client_post_open(this, &rsp, &xdata);
out:
- if (rsp.op_ret == -1) {
- gf_msg (this->name, fop_log_level (GF_FOP_OPEN,
- gf_error_to_errno (rsp.op_errno)),
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed. Path: %s (%s)",
- local->loc.path, loc_gfid_utoa (&local->loc));
- }
+ if (rsp.op_ret == -1) {
+ gf_msg(this->name,
+ fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)),
+ gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED,
+ "remote operation failed. Path: %s (%s)", local->loc.path,
+ loc_gfid_utoa(&local->loc));
+ }
- CLIENT_STACK_UNWIND (open, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), fd, xdata);
+ CLIENT_STACK_UNWIND(open, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), fd, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;
}
-
int
-client3_3_stat_cbk (struct rpc_req *req, struct iovec *iov, int count,
- void *myframe)
+client3_3_stat_cbk(struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
{
- gfs3_stat_rsp rsp = {0,};
- call_frame_t *frame = NULL;
- struct iatt iatt = {0,};
- int ret = 0;
- xlator_t *this = NULL;
- dict_t *xdata = NULL;
-
- this = THIS;
-
- frame = myframe;
-
- if (-1 == req->rpc_status) {
- rsp.op_ret = -1;
- rsp.op_errno = ENOTCONN;
- goto out;
- }
- ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
- if (ret < 0) {
- gf_msg (this->name, GF_LOG_ERROR, EINVAL,
- PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
- rsp.op_ret = -1;
- rsp.op_errno = EINVAL;
- goto out;
- }
-
- ret = client_post_stat (this, &rsp, &iatt, &xdata);
+ gfs3_stat_rsp rsp = {
+ 0,
+ };
+ call_frame_t *frame = NULL;
+ struct iatt iatt = {
+ 0,
+ };
+ int ret = 0;
+ xlator_t *this = NULL;
+ dict_t *xdata = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED,
+ "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+ ret = client_post_stat(this, &rsp, &iatt, &xdata);
out:
- if (rsp.op_ret == -1) {
- /* stale filehandles are possible during normal operations, no
- * need to spam the logs with these */
- if (rsp.op_errno == ESTALE) {
- gf_msg_debug (this->name, 0,
- "remote operation failed: %s",
- strerror (gf_error_to_errno
- (rsp.op_errno)));
- } else {
- gf_msg (this->name, GF_LOG_WARNING,
- gf_error_to_errno (rsp.op_errno),
- PC_MSG_REMOTE_OP_FAILED,
- "remote operation failed");
- }
+ if (rsp.op_ret == -1) {
+ /* stale filehandles are possible during normal operations, no
+ * need to spam the logs with these */
+ if (rsp.op_errno == ESTALE) {
+ gf_msg_debug(this->name, 0, "remote operation failed: %s",
+ strerror(gf_error_to_errno(rsp.op_errno)));
+ } else {
+ gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno),
+ PC_MSG_REMOTE_OP_FAILED, "remote operation failed");
}
+ }
- CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret,
- gf_error_to_errno (rsp.op_errno), &iatt, xdata);
+ CLIENT_STACK_UNWIND(stat, frame, rsp.op_ret,
+ gf_error_to_errno(rsp.op_errno), &iatt, xdata);
- free (rsp.xdata.xdata_val);
+ free(rsp.xdata.xdata_val);
- if (xdata)
- dict_unref (xdata);
+ if (xdata)
+ dict_unref(xdata);
- return 0;
+ return 0;