diff options
author | Manikandan Selvaganesh <mselvaga@redhat.com> | 2015-04-06 16:21:43 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-06-15 06:26:43 -0700 |
commit | 379dbbfd683d2b0e1704c098b1f020567328122c (patch) | |
tree | 1ef1bd78d6a3bcf19915093463c8ef08b8473335 /xlators/protocol/client/src | |
parent | 554fa0c1315d0b4b78ba35a2d332d7ac0fd07d48 (diff) |
protocol/client : porting log messages to new framework
Change-Id: I9bf2ca08fef969e566a64475d0f7a16d37e66eeb
BUG: 1194640
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/10042
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r-- | xlators/protocol/client/src/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-callback.c | 16 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 330 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-helpers.c | 17 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-lk.c | 23 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-messages.h | 624 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 593 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 243 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 3 |
9 files changed, 1346 insertions, 505 deletions
diff --git a/xlators/protocol/client/src/Makefile.am b/xlators/protocol/client/src/Makefile.am index cf89d42da30..fcdf5e39303 100644 --- a/xlators/protocol/client/src/Makefile.am +++ b/xlators/protocol/client/src/Makefile.am @@ -11,7 +11,7 @@ client_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ client_la_SOURCES = client.c client-helpers.c client-rpc-fops.c \ client-handshake.c client-callback.c client-lk.c -noinst_HEADERS = client.h client-mem-types.h +noinst_HEADERS = client.h client-mem-types.h client-messages.h AM_CPPFLAGS = $(GF_CPPFLAGS) \ -I$(top_srcdir)/libglusterfs/src \ diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c index 2cbad0ca78e..ea8acc910fe 100644 --- a/xlators/protocol/client/src/client-callback.c +++ b/xlators/protocol/client/src/client-callback.c @@ -11,11 +11,12 @@ #include "client.h" #include "rpc-clnt.h" #include "defaults.h" +#include "client-messages.h" int client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, "this function should not be called"); return 0; } @@ -23,7 +24,7 @@ client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data) int client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, "this function should not be called"); return 0; } @@ -31,7 +32,7 @@ client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data) int client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR, "this function should not be called"); return 0; } @@ -46,7 +47,7 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data) struct gf_upcall_cache_invalidation ca_data = {0,}; gfs3_cbk_cache_invalidation_req ca_req = {0,}; - gf_log (THIS->name, GF_LOG_TRACE, "Upcall callback is called"); + gf_msg_trace (THIS->name, 0, "Upcall callback is called"); if (!rpc || !mydata || !data) goto out; @@ -56,7 +57,8 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data) (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req); if (ret < 0) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, -ret, + PC_MSG_CACHE_INVALIDATION_FAIL, "XDR decode of cache_invalidation failed."); goto out; } @@ -64,8 +66,8 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data) upcall_data.data = &ca_data; gf_proto_cache_invalidation_to_upcall (&ca_req, &upcall_data); - gf_log (THIS->name, GF_LOG_TRACE, "Upcall gfid = %s, ret = %d", - ca_req.gfid, ret); + gf_msg_trace (THIS->name, 0, "Upcall gfid = %s, ret = %d", + ca_req.gfid, ret); default_notify (THIS, GF_EVENT_UPCALL, &upcall_data); diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index ce7b8e714e2..8d7e6f01c46 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -19,6 +19,7 @@ #include "glusterfs3.h" #include "portmap-xdr.h" #include "rpc-common-xdr.h" +#include "client-messages.h" #define CLIENT_REOPEN_MAX_ATTEMPTS 1024 extern rpc_clnt_prog_t clnt3_3_fop_prog; @@ -47,15 +48,16 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, frame = myframe; if (!frame || !frame->this) { - gf_log (THIS->name, GF_LOG_ERROR, "frame not found with the request, " - "returning EINVAL"); + 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_log (frame->this->name, GF_LOG_WARNING, - "received RPC status error, returning ENOTCONN"); + 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; @@ -63,7 +65,8 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp); if (ret < 0) { - gf_log (frame->this->name, GF_LOG_ERROR, + 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; @@ -71,8 +74,9 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, } if (-1 == rsp.op_ret) { - gf_log (frame->this->name, GF_LOG_WARNING, - "failed to get the 'volume file' from server"); + 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; } @@ -108,7 +112,7 @@ int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data) (xdrproc_t)xdr_gf_getspec_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL, "failed to send the request"); } @@ -128,8 +132,9 @@ client_notify_parents_child_up (xlator_t *this) conf = this->private; ret = client_notify_dispatch (this, GF_EVENT_CHILD_UP, NULL); if (ret) - gf_log (this->name, GF_LOG_INFO, - "notify of CHILD_UP failed"); + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_CHILD_UP_NOTIFY_FAILED, "notify of CHILD_UP " + "failed"); return 0; } @@ -168,17 +173,18 @@ client_set_lk_version_cbk (struct rpc_req *req, struct iovec *iov, GF_VALIDATE_OR_GOTO ("client", fr, out); if (req->rpc_status == -1) { - gf_log (fr->this->name, GF_LOG_WARNING, - "received RPC status error"); + gf_msg (fr->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_set_lk_ver_rsp); if (ret < 0) - gf_log (fr->this->name, GF_LOG_WARNING, - "xdr decoding failed"); + gf_msg (fr->this->name, GF_LOG_WARNING, 0, + PC_MSG_XDR_DECODING_FAILED, "xdr decoding failed"); else - gf_log (fr->this->name, GF_LOG_INFO, + gf_msg (fr->this->name, GF_LOG_INFO, 0, + PC_MSG_LOCK_VERSION_SERVER, "Server lk version = %d", rsp.lk_ver); ret = 0; @@ -221,7 +227,7 @@ client_set_lk_version (xlator_t *this) goto out; } - gf_log (this->name, GF_LOG_DEBUG, "Sending SET_LK_VERSION"); + gf_msg_debug (this->name, 0, "Sending SET_LK_VERSION"); ret = client_submit_request (this, &req, frame, conf->handshake, @@ -233,7 +239,7 @@ out: GF_FREE (req.uid); return ret; err: - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SET_LK_VERSION_ERROR, "Failed to send SET_LK_VERSION to server"); return ret; @@ -456,19 +462,21 @@ client_reacquire_lock_cbk (struct rpc_req *req, struct iovec *iov, conf = (clnt_conf_t *) this->private; if (req->rpc_status == -1) { - gf_log ("client", GF_LOG_WARNING, + gf_msg ("client", GF_LOG_WARNING, 0, PC_MSG_CLIENT_REQ_FAIL, "request failed at rpc"); goto out; } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); goto out; } if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_ERROR, "lock request failed"); + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_LOCK_REQ_FAIL, + "lock request failed"); ret = -1; goto out; } @@ -477,10 +485,10 @@ client_reacquire_lock_cbk (struct rpc_req *req, struct iovec *iov, gf_proto_flock_to_flock (&rsp.flock, &lock); - gf_log (this->name, GF_LOG_DEBUG, "%s type lock reacquired on file " - "with gfid %s from %"PRIu64 " to %"PRIu64, - get_lk_type (lock.l_type), uuid_utoa (fdctx->gfid), - lock.l_start, lock.l_start + lock.l_len); + gf_msg_debug (this->name, 0, "%s type lock reacquired on file " + "with gfid %s from %"PRIu64 " to %"PRIu64, + get_lk_type (lock.l_type), uuid_utoa (fdctx->gfid), + lock.l_start, lock.l_start + lock.l_len); if (!clnt_fd_lk_local_error_status (this, local) && clnt_fd_lk_local_unref (this, local) == 0) { @@ -526,9 +534,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx) local = clnt_fd_lk_local_create (fdctx); if (!local) { - gf_log (this->name, GF_LOG_WARNING, "clnt_fd_lk_local_create " - "failed, aborting reacquring of locks on %s.", - uuid_utoa (fdctx->gfid)); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_LOCK_ERROR, + "clnt_fd_lk_local_create failed, aborting reacquring " + "of locks on %s.", uuid_utoa (fdctx->gfid)); clnt_reacquire_lock_error (this, fdctx, conf); goto out; } @@ -541,9 +549,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx) /* to avoid frame being blocked if lock cannot be granted. */ ret = client_cmd_to_gf_cmd (F_SETLK, &gf_cmd); if (ret) { - gf_log (this->name, GF_LOG_WARNING, - "client_cmd_to_gf_cmd failed, " - "aborting reacquiring of locks"); + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_LOCK_ERROR, "client_cmd_to_gf_cmd " + "failed, aborting reacquiring of locks"); break; } @@ -571,8 +579,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx) NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, - "reacquiring locks failed on file with gfid %s", + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_LOCK_REACQUIRE, "reacquiring locks " + "failed on file with gfid %s", uuid_utoa (fdctx->gfid)); break; } @@ -597,8 +606,8 @@ client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx) GF_VALIDATE_OR_GOTO (this->name, fdctx, out); if (client_fd_lk_list_empty (fdctx->lk_ctx, _gf_false)) { - gf_log (this->name, GF_LOG_DEBUG, - "fd lock list is empty"); + gf_msg_debug (this->name, 0, + "fd lock list is empty"); fdctx->reopen_done (fdctx, this); } else { lk_ctx = fdctx->lk_ctx; @@ -660,7 +669,7 @@ client_child_up_reopen_done (clnt_fd_ctx_t *fdctx, xlator_t *this) client_reopen_done (fdctx, this); if (fd_count == 0) { - gf_log (this->name, GF_LOG_INFO, + 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_set_lk_version (this); client_notify_parents_child_up (this); @@ -687,8 +696,9 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, fdctx = local->fdctx; if (-1 == req->rpc_status) { - gf_log (frame->this->name, GF_LOG_WARNING, - "received RPC status error, returning ENOTCONN"); + 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; @@ -696,20 +706,21 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp); if (ret < 0) { - gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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_log (frame->this->name, GF_LOG_WARNING, - "reopen on %s failed (%s)", + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed (%s)", local->loc.path, strerror (rsp.op_errno)); } else { - gf_log (frame->this->name, GF_LOG_DEBUG, - "reopen on %s succeeded (remote-fd = %"PRId64")", - local->loc.path, rsp.fd); + gf_msg_debug (frame->this->name, 0, + "reopen on %s succeeded (remote-fd = %"PRId64")", + local->loc.path, rsp.fd); } if (rsp.op_ret == -1) { @@ -736,13 +747,14 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, if (attempt_lock_recovery) { /* Delay decrementing the reopen fd count until all the locks corresponding to this fd are acquired.*/ - gf_log (this->name, GF_LOG_DEBUG, "acquiring locks " - "on %s", local->loc.path); + gf_msg_debug (this->name, 0, "acquiring locks " + "on %s", local->loc.path); ret = client_reacquire_lock (frame->this, local->fdctx); if (ret) { clnt_reacquire_lock_error (this, local->fdctx, conf); - gf_log (this->name, GF_LOG_WARNING, "acquiring locks " - "failed on %s", local->loc.path); + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_LOCK_ERROR, "acquiring locks failed " + "on %s", local->loc.path); } } @@ -776,8 +788,9 @@ client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count, if (-1 == req->rpc_status) { - gf_log (frame->this->name, GF_LOG_WARNING, - "received RPC status error, returning ENOTCONN"); + 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; @@ -785,20 +798,21 @@ client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp); if (ret < 0) { - gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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_log (frame->this->name, GF_LOG_WARNING, - "reopendir on %s failed (%s)", + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + PC_MSG_DIR_OP_FAILED, "reopendir on %s failed (%s)", local->loc.path, strerror (rsp.op_errno)); } else { - gf_log (frame->this->name, GF_LOG_INFO, - "reopendir on %s succeeded (fd = %"PRId64")", - local->loc.path, rsp.fd); + 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) { @@ -853,8 +867,8 @@ protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this) memcpy (req.gfid, fdctx->gfid, 16); - gf_log (frame->this->name, GF_LOG_DEBUG, - "attempting reopen on %s", local->loc.path); + gf_msg_debug (frame->this->name, 0, + "attempting reopen on %s", local->loc.path); frame->local = local; @@ -864,7 +878,7 @@ protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this) NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_opendir_req); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, "failed to send the re-opendir request"); } @@ -915,15 +929,15 @@ protocol_client_reopenfile (clnt_fd_ctx_t *fdctx, xlator_t *this) req.flags = gf_flags_from_flags (fdctx->flags); req.flags = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL)); - gf_log (frame->this->name, GF_LOG_DEBUG, - "attempting reopen on %s", local->loc.path); + 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_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED, "failed to send the re-open request"); } @@ -1032,9 +1046,9 @@ client_post_handshake (call_frame_t *frame, xlator_t *this) /* Delay notifying CHILD_UP to parents until all locks are recovered */ if (count > 0) { - gf_log (this->name, GF_LOG_INFO, - "%d fds open - Delaying child_up until they are re-opened", - count); + 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) { @@ -1043,8 +1057,9 @@ client_post_handshake (call_frame_t *frame, xlator_t *this) protocol_client_reopen (fdctx, this); } } else { - gf_log (this->name, GF_LOG_DEBUG, - "No fds to open - notifying all parents child up"); + gf_msg_debug (this->name, 0, + "No fds to open - notifying all parents child " + "up"); client_set_lk_version (this); client_notify_parents_child_up (this); } @@ -1074,23 +1089,24 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m conf = this->private; if (-1 == req->rpc_status) { - gf_log (frame->this->name, GF_LOG_WARNING, - "received RPC status error"); + 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_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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_log (frame->this->name, GF_LOG_WARNING, - "failed to set the volume (%s)", + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + PC_MSG_VOL_SET_FAIL, "failed to set the volume (%s)", (op_errno)? strerror (op_errno) : "--"); } @@ -1102,26 +1118,29 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m ret = dict_unserialize (rsp.dict.dict_val, rsp.dict.dict_len, &reply); if (ret < 0) { - gf_log (frame->this->name, GF_LOG_WARNING, - "failed to unserialize buffer to dict"); + 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_log (this->name, GF_LOG_WARNING, - "failed to get ERROR string from reply dict"); + 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_log (this->name, GF_LOG_WARNING, - "failed to get 'process-uuid' from reply dict"); + 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_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_SETVOLUME_FAIL, "SETVOLUME on remote-host failed: %s", remote_error ? remote_error : strerror (op_errno)); errno = op_errno; @@ -1135,7 +1154,8 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m GF_EVENT_VOLFILE_MODIFIED, NULL); if (ret) - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_VOLFILE_NOTIFY_FAILED, "notify of VOLFILE_MODIFIED failed"); } goto out; @@ -1144,20 +1164,21 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m ret = dict_get_str (this->options, "remote-subvolume", &remote_subvol); if (ret || !remote_subvol) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED, "failed to find key 'remote-subvolume' in the options"); goto out; } ret = dict_get_uint32 (reply, "clnt-lk-version", &lk_ver); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED, "failed to find key 'clnt-lk-version' in the options"); goto out; } - gf_log (this->name, GF_LOG_DEBUG, "clnt-lk-version = %d, " - "server-lk-version = %d", client_get_lk_ver (conf), lk_ver); + gf_msg_debug (this->name, 0, "clnt-lk-version = %d, " + "server-lk-version = %d", client_get_lk_ver (conf), + lk_ver); /* TODO: currently setpeer path is broken */ /* if (process_uuid && req->conn && @@ -1182,7 +1203,7 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m conf->client_id = glusterfs_leaf_position(this); - gf_log (this->name, GF_LOG_INFO, + 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); @@ -1194,27 +1215,30 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m conf->connected = 1; if (lk_ver != client_get_lk_ver (conf)) { - gf_log (this->name, GF_LOG_INFO, "Server and Client " - "lk-version numbers are not same, reopening the fds"); + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MISMATCH, + "Server and Client lk-version numbers are not same, " + "reopening the fds"); client_mark_fd_bad (this); client_post_handshake (frame, frame->this); } else { /*TODO: Traverse the saved fd list, and send release to the server on fd's that were closed during grace period */ - gf_log (this->name, GF_LOG_INFO, "Server and Client " - "lk-version numbers are same, no need to " - "reopen the fds"); + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MATCH, + "Server and Client lk-version numbers are same, no " + "need to reopen the fds"); client_notify_parents_child_up (frame->this); } out: if (auth_fail) { - gf_log (this->name, GF_LOG_INFO, "sending AUTH_FAILED event"); + 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_log (this->name, GF_LOG_INFO, - "notify of AUTH_FAILED failed"); + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_AUTH_FAILED_NOTIFY_FAILED, "notify of " + "AUTH_FAILED failed"); conf->connecting = 0; conf->connected = 0; ret = -1; @@ -1224,11 +1248,14 @@ out: * background, for now, don't hang here, * tell the parents that i am all ok.. */ - gf_log (this->name, GF_LOG_INFO, "sending CHILD_CONNECTING event"); + 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_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED, "notify of CHILD_CONNECTING failed"); conf->connecting= 1; ret = 0; @@ -1262,8 +1289,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) ret = dict_set_int32 (options, "fops-version", conf->fops->prognum); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "failed to set version-fops(%d) in handshake msg", + 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; } @@ -1272,8 +1300,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) if (conf->mgmt) { ret = dict_set_int32 (options, "mgmt-version", conf->mgmt->prognum); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "failed to set version-mgmt(%d) in handshake msg", + 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; } @@ -1298,14 +1327,15 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) this->ctx->process_uuid, this->name, this->graph->id, counter_str); if (-1 == ret) { - gf_log (this->name, GF_LOG_ERROR, - "asprintf failed while setting process_uuid"); + 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_log (this->name, GF_LOG_ERROR, + 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; @@ -1313,7 +1343,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) ret = dict_set_str (options, "client-version", PACKAGE_VERSION); if (ret < 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED, "failed to set client-version(%s) in handshake msg", PACKAGE_VERSION); } @@ -1323,27 +1353,29 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) ret = dict_set_str (options, "volfile-key", this->ctx->cmd_args.volfile_id); if (ret) - gf_log (this->name, GF_LOG_ERROR, - "failed to set 'volfile-key'"); + 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_log (this->name, GF_LOG_ERROR, - "failed to set 'volfile-checksum'"); + gf_msg (this->name, GF_LOG_ERROR, 0, + PC_MSG_DICT_SET_FAILED, "failed to set " + "'volfile-checksum'"); } ret = dict_set_int16 (options, "clnt-lk-version", client_get_lk_ver (conf)); if (ret < 0) { - gf_log (this->name, GF_LOG_WARNING, - "failed to set clnt-lk-version(%"PRIu32") in handshake msg", - client_get_lk_ver (conf)); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED, + "failed to set clnt-lk-version(%"PRIu32") in handshake " + "msg", client_get_lk_ver (conf)); } ret = dict_serialized_length (options); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR, "failed to get serialized length of dict"); ret = -1; goto fail; @@ -1353,8 +1385,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) gf_client_mt_clnt_req_buf_t); ret = dict_serialize (options, req.dict.dict_val); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "failed to serialize dictionary"); + gf_msg (this->name, GF_LOG_ERROR, 0, + PC_MSG_DICT_SERIALIZE_FAIL, "failed to serialize " + "dictionary"); goto fail; } @@ -1381,7 +1414,7 @@ select_server_supported_programs (xlator_t *this, gf_prog_detail *prog) int ret = -1; if (!this || !prog) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND, "xlator not found OR RPC program not found"); goto out; } @@ -1394,16 +1427,16 @@ select_server_supported_programs (xlator_t *this, gf_prog_detail *prog) if ((clnt3_3_fop_prog.prognum == trav->prognum) && (clnt3_3_fop_prog.progver == trav->progver)) { conf->fops = &clnt3_3_fop_prog; - gf_log (this->name, GF_LOG_INFO, - "Using Program %s, Num (%"PRId64"), " - "Version (%"PRId64")", + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_VERSION_INFO, "Using Program %s, " + "Num (%"PRId64"), Version (%"PRId64")", trav->progname, trav->prognum, trav->progver); ret = 0; } if (ret) { - gf_log (this->name, GF_LOG_TRACE, - "%s (%"PRId64") not supported", trav->progname, - trav->progver); + gf_msg_trace (this->name, 0, + "%s (%"PRId64") not supported", + trav->progname, trav->progver); } trav = trav->next; } @@ -1420,7 +1453,7 @@ server_has_portmap (xlator_t *this, gf_prog_detail *prog) int ret = -1; if (!this || !prog) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND, "xlator not found OR RPC program not found"); goto out; } @@ -1430,8 +1463,8 @@ server_has_portmap (xlator_t *this, gf_prog_detail *prog) while (trav) { if ((trav->prognum == GLUSTER_PMAP_PROGRAM) && (trav->progver == GLUSTER_PMAP_VERSION)) { - gf_log (this->name, GF_LOG_DEBUG, - "detected portmapper on server"); + gf_msg_debug (this->name, 0, + "detected portmapper on server"); ret = 0; break; } @@ -1455,32 +1488,43 @@ client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, voi frame = myframe; if (!frame || !frame->this || !frame->this->private) { - gf_log (THIS->name, GF_LOG_WARNING, - "frame not found with rpc request"); + 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_log (this->name, GF_LOG_WARNING, - "received RPC status error, try again later"); + 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_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; - gf_log (this->name, ((!conf->portmap_err_logged) ? - GF_LOG_ERROR : GF_LOG_DEBUG), - "failed to get the port number for remote subvolume. " - "Please run 'gluster volume status' on server to see " - "if brick process is running."); + 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; } @@ -1524,7 +1568,7 @@ client_query_portmap (xlator_t *this, struct rpc_clnt *rpc) ret = dict_get_str (options, "remote-subvolume", &remote_subvol); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL, "remote-subvolume not set in volfile"); goto fail; } @@ -1571,19 +1615,21 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, conf = frame->this->private; if (-1 == req->rpc_status) { - gf_log (frame->this->name, GF_LOG_WARNING, - "received RPC status error"); + 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_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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_log (frame->this->name, GF_LOG_WARNING, - "failed to get the 'versions' from server"); + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + PC_MSG_VERSION_ERROR, "failed to get the 'versions' " + "from server"); goto out; } @@ -1596,8 +1642,9 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count, /* Reply in "Name:Program-Number:Program-Version,..." format */ ret = select_server_supported_programs (frame->this, rsp.prog); if (ret) { - gf_log (frame->this->name, GF_LOG_ERROR, - "server doesn't support the version"); + gf_msg (frame->this->name, GF_LOG_ERROR, 0, + PC_MSG_VERSION_ERROR, "server doesn't support the " + "version"); goto out; } @@ -1633,7 +1680,8 @@ client_handshake (xlator_t *this, struct rpc_clnt *rpc) conf = this->private; if (!conf->handshake) { - gf_log (this->name, GF_LOG_WARNING, "handshake program not found"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND, + "handshake program not found"); goto out; } diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c index a8e39ede515..104a13d3786 100644 --- a/xlators/protocol/client/src/client-helpers.c +++ b/xlators/protocol/client/src/client-helpers.c @@ -10,6 +10,7 @@ #include "client.h" #include "fd.h" +#include "client-messages.h" int client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock) @@ -89,22 +90,26 @@ this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx) ret = fd_ctx_get (file, this, &oldaddr); if (ret >= 0) { if (loc) - gf_log (this->name, GF_LOG_INFO, + 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_log (this->name, GF_LOG_INFO, + 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_log (this->name, GF_LOG_WARNING, + 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_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_FD_SET_FAIL, "%p: failed to set remote fd", file); } out: @@ -220,9 +225,9 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd, ret = dict_unserialize (buf, trav->dict.dict_len, &entry->dict); if (ret < 0) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, EINVAL, + PC_MSG_DICT_UNSERIALIZE_FAIL, "failed to unserialize xattr dict"); - errno = EINVAL; goto out; } entry->dict->extra_free = buf; diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c index b3c36a42021..0cf2be3c562 100644 --- a/xlators/protocol/client/src/client-lk.c +++ b/xlators/protocol/client/src/client-lk.c @@ -12,6 +12,7 @@ #include "xlator.h" #include "client.h" #include "lkowner.h" +#include "client-messages.h" static void __insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock); @@ -23,7 +24,7 @@ __dump_client_lock (client_posix_lock_t *lock) this = THIS; - gf_log (this->name, GF_LOG_INFO, + 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"}", @@ -225,7 +226,8 @@ subtract_locks (client_posix_lock_t *big, client_posix_lock_t *small) } else { /* LOG-TODO : decide what more info is required here*/ - gf_log ("client-protocol", GF_LOG_CRITICAL, + 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"); } @@ -363,8 +365,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner) this = THIS; fdctx = this_fd_get_ctx (fd, this); if (!fdctx) { - gf_log (this->name, GF_LOG_WARNING, - "fdctx not valid"); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_FD_CTX_INVALID, "fdctx not valid"); ret = -1; goto out; } @@ -387,8 +389,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner) } /* FIXME: Need to actually print the locks instead of count */ - gf_log (this->name, GF_LOG_TRACE, - "Number of locks cleared=%d", count); + gf_msg_trace (this->name, 0, + "Number of locks cleared=%d", count); out: return ret; @@ -421,8 +423,8 @@ delete_granted_locks_fd (clnt_fd_ctx_t *fdctx) } /* FIXME: Need to actually print the locks instead of count */ - gf_log (this->name, GF_LOG_TRACE, - "Number of locks cleared=%d", count); + gf_msg_trace (this->name, 0, + "Number of locks cleared=%d", count); return ret; } @@ -516,7 +518,7 @@ client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock, pthread_mutex_unlock (&conf->lock); if (!fdctx) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL, "failed to get fd context. sending EBADFD"); ret = -EBADFD; goto out; @@ -551,7 +553,8 @@ client_dump_locks (char *name, inode_t *inode, ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string); if (ret) { - gf_log (THIS->name, GF_LOG_WARNING, + gf_msg (THIS->name, GF_LOG_WARNING, 0, + PC_MSG_DICT_SET_FAILED, "could not set dict with %s", CLIENT_DUMP_LOCKS); goto out; } diff --git a/xlators/protocol/client/src/client-messages.h b/xlators/protocol/client/src/client-messages.h new file mode 100644 index 00000000000..923917643bf --- /dev/null +++ b/xlators/protocol/client/src/client-messages.h @@ -0,0 +1,624 @@ +/* + Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _PC_MESSAGES_H__ +#define _PC_MESSAGES_H_ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "glfs-message-id.h" + +/*! \file client-messages.h + * \brief Protocol client log-message IDs and their descriptions + */ + +/* NOTE: Rules for message additions + * 1) Each instance of a message is _better_ left with a unique message ID, even + * if the message format is the same. Reasoning is that, if the message + * format needs to change in one instance, the other instances are not + * impacted or the new change does not change the ID of the instance being + * modified. + * 2) Addition of a message, + * - Should increment the GLFS_NUM_MESSAGES + * - Append to the list of messages defined, towards the end + * - Retain macro naming as glfs_msg_X (for readability across developers) + * NOTE: Rules for message format modifications + * 3) Check acorss the code if the message ID macro in question is reused + * anywhere. If reused then then the modifications should ensure correctness + * everywhere, or needs a new message ID as (1) above was not adhered to. If + * not used anywhere, proceed with the required modification. + * NOTE: Rules for message deletion + * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used + * anywhere, then can be deleted, but will leave a hole by design, as + * addition rules specify modification to the end of the list and not filling + * holes. + */ + +#define GLFS_PC_BASE GLFS_MSGID_COMP_PC +#define GLFS_PC_NUM_MESSAGES 63 +#define GLFS_PC_MSGID_END (GLFS_PC_BASE + GLFS_NUM_MESSAGES + 1) +/* Messages with message IDs */ +#define glfs_msg_start_x GLFS_PC_BASE, "Invalid: Start of messages" +/*------------*/ + +#define PC_MSG_TIMER_EXPIRED (GLFS_PC_BASE + 1) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DIR_OP_FAILED (GLFS_PC_BASE + 2) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FILE_OP_FAILED (GLFS_PC_BASE + 3) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_TIMER_REG (GLFS_PC_BASE + 4) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_GRACE_TIMER_CANCELLED (GLFS_PC_BASE + 5) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DICT_SET_FAILED (GLFS_PC_BASE + 6) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DICT_GET_FAILED (GLFS_PC_BASE + 7) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_NO_MEMORY (GLFS_PC_BASE + 8) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_CBK_FAILED (GLFS_PC_BASE + 9) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FUNCTION_CALL_ERROR (GLFS_PC_BASE + 10) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_INITED_ALREADY (GLFS_PC_BASE + 11) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_INIT (GLFS_PC_BASE + 12) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_DESTROY (GLFS_PC_BASE + 13) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_INVALID_CALL (GLFS_PC_BASE + 14) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_INVALID_ENTRY (GLFS_PC_BASE + 15) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_HANDSHAKE_RETURN (GLFS_PC_BASE + 16) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_UP_NOTIFY_FAILED (GLFS_PC_BASE + 17) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CLIENT_DISCONNECTED (GLFS_PC_BASE + 18) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_DOWN_NOTIFY_FAILED (GLFS_PC_BASE + 19) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_PARENT_UP (GLFS_PC_BASE + 20) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_PARENT_DOWN (GLFS_PC_BASE + 21) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_INIT_FAILED (GLFS_PC_BASE + 22) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_NOTIFY_FAILED (GLFS_PC_BASE + 23) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FD_DUPLICATE_TRY (GLFS_PC_BASE + 24) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FD_SET_FAIL (GLFS_PC_BASE + 25) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DICT_UNSERIALIZE_FAIL (GLFS_PC_BASE + 26) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FD_GET_FAIL (GLFS_PC_BASE + 27) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FD_CTX_INVALID (GLFS_PC_BASE + 28) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_FOP_SEND_FAILED (GLFS_PC_BASE + 29) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_XDR_DECODING_FAILED (GLFS_PC_BASE + 30) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_REMOTE_OP_FAILED (GLFS_PC_BASE + 31) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_RPC_STATUS_ERROR (GLFS_PC_BASE + 32) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_VOL_FILE_NOT_FOUND (GLFS_PC_BASE + 33) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_SEND_REQ_FAIL (GLFS_PC_BASE + 34) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_VERSION_SERVER (GLFS_PC_BASE + 35) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_SET_LK_VERSION_ERROR (GLFS_PC_BASE + 36) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_REQ_FAIL (GLFS_PC_BASE + 37) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CLIENT_REQ_FAIL (GLFS_PC_BASE + 38) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_ERROR (GLFS_PC_BASE + 39) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_REACQUIRE (GLFS_PC_BASE + 40) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_UP_NOTIFY (GLFS_PC_BASE + 41) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_UP_NOTIFY_DELAY (GLFS_PC_BASE + 42) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_VOL_SET_FAIL (GLFS_PC_BASE + 43) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_SETVOLUME_FAIL (GLFS_PC_BASE + 44) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_VOLFILE_NOTIFY_FAILED (GLFS_PC_BASE + 45) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_REMOTE_VOL_CONNECTED (GLFS_PC_BASE + 46) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_MISMATCH (GLFS_PC_BASE + 47) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_LOCK_MATCH (GLFS_PC_BASE + 48) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_AUTH_FAILED (GLFS_PC_BASE + 49) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_AUTH_FAILED_NOTIFY_FAILED (GLFS_PC_BASE + 50) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_CONNECTING_EVENT (GLFS_PC_BASE + 51) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED (GLFS_PC_BASE + 52) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_PROCESS_UUID_SET_FAIL (GLFS_PC_BASE + 53) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DICT_ERROR (GLFS_PC_BASE + 54) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DICT_SERIALIZE_FAIL (GLFS_PC_BASE + 55) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_PGM_NOT_FOUND (GLFS_PC_BASE + 56) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_VERSION_INFO (GLFS_PC_BASE + 57) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_PORT_NUM_ERROR (GLFS_PC_BASE + 58) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_VERSION_ERROR (GLFS_PC_BASE + 59) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_DIR_OP_SUCCESS (GLFS_PC_BASE + 60) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_BAD_FD (GLFS_PC_BASE + 61) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CLIENT_LOCK_INFO (GLFS_PC_BASE + 62) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +#define PC_MSG_CACHE_INVALIDATION_FAIL (GLFS_PC_BASE + 63) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ + +/*------------*/ +#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" + +#endif /* !_PC_MESSAGES_H_ */ diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 54699ba94ac..c85dfb43f7c 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -13,6 +13,7 @@ #include "glusterfs3-xdr.h" #include "glusterfs3.h" #include "compat-errno.h" +#include "client-messages.h" int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data); rpc_clnt_prog_t clnt3_3_fop_prog; @@ -51,16 +52,18 @@ client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, if (iobref != NULL) { ret = iobref_merge (new_iobref, iobref); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot merge iobref passed from caller " - "into new_iobref"); + gf_msg (this->name, GF_LOG_WARNING, ENOMEM, + PC_MSG_NO_MEMORY, "cannot merge " + "iobref passed from caller into " + "new_iobref"); } } ret = iobref_add (new_iobref, iobuf); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot add iobuf into iobref"); + gf_msg (this->name, GF_LOG_WARNING, ENOMEM, + PC_MSG_NO_MEMORY, "cannot add iobuf into " + "iobref"); goto unwind; } @@ -84,7 +87,7 @@ client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, payload, payloadcnt, new_iobref, frame, NULL, 0, NULL, 0, NULL); if (ret < 0) { - gf_log (this->name, GF_LOG_DEBUG, "rpc_clnt_submit failed"); + gf_msg_debug (this->name, 0, "rpc_clnt_submit failed"); } if (new_iobref) @@ -139,7 +142,8 @@ client3_3_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -162,7 +166,8 @@ out: /* no need to print the gfid, because it will be null, * since symlink operation failed. */ - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s. Path: (%s to %s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, local->loc2.path); @@ -212,7 +217,8 @@ client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -232,8 +238,9 @@ client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1 && GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_log (this->name, fop_log_level (GF_FOP_MKNOD, + gf_msg (this->name, fop_log_level (GF_FOP_MKNOD, gf_error_to_errno (rsp.op_errno)), + rsp.op_errno, PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path); @@ -280,7 +287,8 @@ client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -300,8 +308,9 @@ client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1 && GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_log (this->name, fop_log_level (GF_FOP_MKDIR, - gf_error_to_errno (rsp.op_errno)), + gf_msg (this->name, fop_log_level (GF_FOP_MKDIR, + gf_error_to_errno (rsp.op_errno)), rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path); @@ -421,7 +430,8 @@ client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -443,8 +453,9 @@ client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_OPEN, - gf_error_to_errno (rsp.op_errno)), + gf_msg (this->name, fop_log_level (GF_FOP_OPEN, + gf_error_to_errno (rsp.op_errno)), + rsp.op_errno, PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local->loc)); @@ -484,7 +495,8 @@ client3_3_stat_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -502,10 +514,17 @@ out: if (rsp.op_ret == -1) { /* stale filehandles are possible during normal operations, no * need to spam the logs with these */ - gf_log (this->name, - rsp.op_errno == ESTALE ? GF_LOG_DEBUG : GF_LOG_WARNING, - "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + 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, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", + strerror (gf_error_to_errno (rsp.op_errno))); + } } CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret, @@ -542,7 +561,8 @@ client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -558,9 +578,16 @@ client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, (gf_error_to_errno(rsp.op_errno) == ENOENT)? - GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:" - " %s", strerror (gf_error_to_errno (rsp.op_errno))); + if (gf_error_to_errno(rsp.op_errno) == ENOENT) { + gf_msg_debug (this->name, 0, "remote operation failed:" + " %s", strerror + (gf_error_to_errno (rsp.op_errno))); + } else { + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s", strerror + (gf_error_to_errno (rsp.op_errno))); + } } CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret, @@ -603,7 +630,8 @@ client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -620,11 +648,17 @@ client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, - ((gf_error_to_errno (rsp.op_errno) == ENOENT) - ? GF_LOG_DEBUG : GF_LOG_WARNING), - "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + if (gf_error_to_errno(rsp.op_errno) == ENOENT) { + gf_msg_debug (this->name, 0, "remote operation failed:" + " %s", strerror + (gf_error_to_errno (rsp.op_errno))); + } else { + gf_msg (this->name, GF_LOG_WARNING, + rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s", strerror + (gf_error_to_errno (rsp.op_errno))); + } } CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret, @@ -663,7 +697,8 @@ client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -680,7 +715,8 @@ client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret, @@ -720,7 +756,8 @@ client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -737,7 +774,9 @@ client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret, @@ -776,7 +815,8 @@ client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -792,7 +832,9 @@ client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret, @@ -834,7 +876,8 @@ client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_write_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -851,7 +894,9 @@ client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } else if (rsp.op_ret >= 0) { if (local->attempt_reopen) @@ -892,7 +937,8 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -901,9 +947,9 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, if (rsp.op_ret >= 0 && !fd_is_anonymous (local->fd)) { /* Delete all saved locks of the owner issuing flush */ ret = delete_granted_locks_owner (local->fd, &local->owner); - gf_log (this->name, GF_LOG_TRACE, - "deleting locks of owner (%s) returned %d", - lkowner_utoa (&local->owner), ret); + gf_msg_trace (this->name, 0, + "deleting locks of owner (%s) returned %d", + lkowner_utoa (&local->owner), ret); } GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), @@ -912,8 +958,10 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_FLUSH, - gf_error_to_errno (rsp.op_errno)), + gf_msg (this->name, fop_log_level (GF_FOP_FLUSH, + gf_error_to_errno (rsp.op_errno)), + rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -953,7 +1001,8 @@ client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsync_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -970,7 +1019,9 @@ client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret, @@ -1008,7 +1059,8 @@ client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1021,11 +1073,16 @@ client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: op_errno = gf_error_to_errno (rsp.op_errno); if (rsp.op_ret == -1) { - gf_log (this->name, ((op_errno == ENOTSUP) ? - GF_LOG_DEBUG : GF_LOG_WARNING), - "remote operation failed: %s", - strerror (op_errno)); + if (op_errno == ENOTSUP) { + gf_msg_debug (this->name, 0, "remote operation failed:" + " %s", strerror (op_errno)); + } else { + gf_msg (this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s", strerror (op_errno)); + } } + CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata); free (rsp.xdata.xdata_val); @@ -1063,7 +1120,8 @@ client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -1083,15 +1141,22 @@ client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, (((op_errno == ENOTSUP) || - (op_errno == ENODATA) || - (op_errno == ESTALE) || - (op_errno == ENOENT)) ? - GF_LOG_DEBUG : GF_LOG_WARNING), - "remote operation failed: %s. Path: %s (%s). Key: %s", - strerror (op_errno), - local->loc.path, loc_gfid_utoa (&local->loc), - (local->name) ? local->name : "(null)"); + if ((op_errno == ENOTSUP) || (op_errno == ENODATA) || + (op_errno == ESTALE) || (op_errno == ENOENT)) { + gf_msg_debug (this->name, 0, + "remote operation failed: %s. Path: %s " + "(%s). Key: %s", strerror (op_errno), + local->loc.path, + loc_gfid_utoa (&local->loc), + (local->name) ? local->name : "(null)"); + } else { + gf_msg (this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s. Path: %s (%s). Key: %s", + strerror (op_errno), local->loc.path, + loc_gfid_utoa (&local->loc), + (local->name) ? local->name : "(null)"); + } } CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata); @@ -1136,7 +1201,8 @@ client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -1155,13 +1221,16 @@ client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, (((op_errno == ENOTSUP) || - (op_errno == ERANGE) || - (op_errno == ENODATA) || - (op_errno == ENOENT)) ? - GF_LOG_DEBUG : GF_LOG_WARNING), + if ((op_errno == ENOTSUP) || (op_errno == ERANGE) || + (op_errno == ENODATA) || (op_errno == ENOENT)) { + gf_msg_debug (this->name, 0, "remote operation failed: %s", strerror (op_errno)); + } else { + gf_msg (this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s", strerror (op_errno)); + } } CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata); @@ -1202,7 +1271,8 @@ client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1215,11 +1285,13 @@ client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno)) - loglevel = GF_LOG_DEBUG; + loglevel = 0; else loglevel = GF_LOG_WARNING; - gf_log (this->name, loglevel, "remote operation failed: %s", + gf_msg (this->name, loglevel, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -1257,7 +1329,8 @@ client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1269,7 +1342,9 @@ client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret, @@ -1305,7 +1380,8 @@ client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1317,7 +1393,9 @@ client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret, @@ -1353,7 +1431,8 @@ client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1365,7 +1444,9 @@ client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (access, frame, rsp.op_ret, @@ -1404,7 +1485,8 @@ client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1421,7 +1503,9 @@ client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret, @@ -1459,7 +1543,8 @@ client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1475,7 +1560,9 @@ client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret, @@ -1512,7 +1599,8 @@ client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1524,10 +1612,10 @@ client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_INODELK, - gf_error_to_errno (rsp.op_errno)), - "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + gf_msg (this->name, fop_log_level (GF_FOP_INODELK, + gf_error_to_errno (rsp.op_errno)), rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: " + "%s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata); @@ -1563,7 +1651,8 @@ client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1575,10 +1664,10 @@ client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_FINODELK, - gf_error_to_errno (rsp.op_errno)), - "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + gf_msg (this->name, fop_log_level (GF_FOP_FINODELK, + gf_error_to_errno (rsp.op_errno)), rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: " + "%s", strerror (gf_error_to_errno (rsp.op_errno))); } else if (rsp.op_ret == 0) { if (local->attempt_reopen) client_attempt_reopen (local->fd, this); @@ -1616,7 +1705,8 @@ client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1628,10 +1718,10 @@ client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_ENTRYLK, - gf_error_to_errno (rsp.op_errno)), - "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK, + gf_error_to_errno (rsp.op_errno)), rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: " + "%s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret, @@ -1667,7 +1757,8 @@ client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1680,7 +1771,9 @@ client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -1721,7 +1814,8 @@ client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -1741,8 +1835,9 @@ client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, - "remote operation failed: %s. Path: %s (%s)", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: " + "%s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local->loc)); } @@ -1791,7 +1886,8 @@ client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, if (ret < 0) { rsp.op_ret = -1; op_errno = EINVAL; - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); goto out; } op_errno = rsp.op_errno; @@ -1809,7 +1905,8 @@ client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (op_errno))); } else if (rsp.op_ret == 0) { @@ -1854,7 +1951,8 @@ client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1867,10 +1965,14 @@ client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: op_errno = gf_error_to_errno (rsp.op_errno); if (rsp.op_ret == -1) { - gf_log (this->name, ((op_errno == ENOTSUP) ? - GF_LOG_DEBUG : GF_LOG_WARNING), - "remote operation failed: %s", - strerror (op_errno)); + if (op_errno == ENOTSUP) { + gf_msg_debug (this->name, 0, "remote operation failed:" + " %s", strerror (op_errno)); + } else { + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s", strerror (op_errno)); + } } CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata); @@ -1907,7 +2009,8 @@ client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1924,7 +2027,9 @@ client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret, @@ -1963,7 +2068,8 @@ client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -1980,7 +2086,9 @@ client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fallocate, frame, rsp.op_ret, @@ -2018,7 +2126,8 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_discard_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2035,7 +2144,9 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (discard, frame, rsp.op_ret, @@ -2073,7 +2184,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_zerofill_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2090,7 +2202,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -2127,7 +2240,8 @@ client3_3_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_ipc_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2139,7 +2253,8 @@ client3_3_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -2180,7 +2295,8 @@ client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2197,7 +2313,9 @@ client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret, @@ -2243,7 +2361,8 @@ client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2270,7 +2389,8 @@ client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path); @@ -2312,7 +2432,8 @@ client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2324,7 +2445,9 @@ client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret, @@ -2372,7 +2495,8 @@ client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2403,7 +2527,8 @@ client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -2446,7 +2571,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2464,7 +2590,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s remote_fd = %d", strerror (gf_error_to_errno (rsp.op_errno)), local->cmd); @@ -2512,7 +2639,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2529,7 +2657,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } @@ -2577,7 +2706,8 @@ client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2599,7 +2729,9 @@ client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, + "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret, @@ -2646,7 +2778,8 @@ client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2666,7 +2799,8 @@ client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s (%s -> %s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, local->loc2.path); @@ -2715,7 +2849,8 @@ client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2737,9 +2872,10 @@ client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, fop_log_level (GF_FOP_OPENDIR, - gf_error_to_errno (rsp.op_errno)), - "remote operation failed: %s. Path: %s (%s)", + gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR, + gf_error_to_errno (rsp.op_errno)), rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: " + "%s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local->loc)); } @@ -2784,7 +2920,8 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed"); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -2805,8 +2942,8 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, if ((!gf_uuid_is_null (inode->gfid)) && (gf_uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) { - gf_log (frame->this->name, GF_LOG_DEBUG, - "gfid changed for %s", local->loc.path); + gf_msg_debug (frame->this->name, 0, + "gfid changed for %s", local->loc.path); rsp.op_ret = -1; op_errno = ESTALE; @@ -2824,12 +2961,14 @@ out: /* any error other than ENOENT */ if (!(local->loc.name && rsp.op_errno == ENOENT) && !(rsp.op_errno == ESTALE)) - gf_log (this->name, GF_LOG_WARNING, - "remote operation failed: %s. Path: %s (%s)", + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation " + "failed: %s. Path: %s (%s)", strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa (&local->loc)); else - gf_log (this->name, GF_LOG_TRACE, "not found on remote node"); + gf_msg_trace (this->name, 0, "not found on remote " + "node"); } @@ -2873,7 +3012,8 @@ client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed"); + 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; @@ -2898,7 +3038,8 @@ client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } else if (rsp.op_ret >= 0) { @@ -2953,7 +3094,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) conf = (clnt_conf_t *) this->private; if (fdctx->remote_fd == -1) { - gf_log (this->name, GF_LOG_DEBUG, "not a valid fd"); + gf_msg_debug (this->name, 0, "not a valid fd"); goto out; } @@ -2983,7 +3124,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) if (fdctx->is_dir) { gfs3_releasedir_req req = {{0,},}; req.fd = fdctx->remote_fd; - gf_log (this->name, GF_LOG_TRACE, "sending releasedir on fd"); + gf_msg_trace (this->name, 0, "sending releasedir on fd"); client_submit_request (this, &req, fr, &clnt3_3_fop_prog, GFS3_OP_RELEASEDIR, client3_3_releasedir_cbk, @@ -2992,7 +3133,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) } else { gfs3_release_req req = {{0,},}; req.fd = fdctx->remote_fd; - gf_log (this->name, GF_LOG_TRACE, "sending release on fd"); + gf_msg_trace (this->name, 0, "sending release on fd"); client_submit_request (this, &req, fr, &clnt3_3_fop_prog, GFS3_OP_RELEASE, client3_3_release_cbk, NULL, @@ -3189,7 +3330,8 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gfs3_lookup_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3246,7 +3388,8 @@ client3_3_stat (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_stat_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3300,7 +3443,8 @@ client3_3_truncate (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_truncate_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3348,7 +3492,8 @@ client3_3_ftruncate (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_ftruncate_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3402,7 +3547,8 @@ client3_3_access (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_access_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3488,7 +3634,8 @@ client3_3_readlink (call_frame_t *frame, xlator_t *this, local->iobref, (xdrproc_t)xdr_gfs3_readlink_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3547,7 +3694,8 @@ client3_3_unlink (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_unlink_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3600,7 +3748,8 @@ client3_3_rmdir (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rmdir_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3666,7 +3815,8 @@ client3_3_symlink (call_frame_t *frame, xlator_t *this, NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_symlink_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3731,7 +3881,8 @@ client3_3_rename (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rename_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3807,7 +3958,8 @@ client3_3_link (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_link_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3874,7 +4026,8 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mknod_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -3942,7 +4095,8 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mkdir_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4012,7 +4166,8 @@ client3_3_create (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_create_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4080,7 +4235,8 @@ client3_3_open (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_open_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4154,7 +4310,7 @@ client3_3_readv (call_frame_t *frame, xlator_t *this, rsp_iobuf = NULL; if (args->size > rsp_vec.iov_len) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY, "read-size (%lu) is bigger than iobuf size (%lu)", (unsigned long)args->size, (unsigned long)rsp_vec.iov_len); @@ -4175,7 +4331,8 @@ client3_3_readv (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gfs3_read_req); if (ret) { //unwind is done in the cbk - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4248,7 +4405,8 @@ client3_3_writev (call_frame_t *frame, xlator_t *this, void *data) * do the unwind for us (see rpc_clnt_submit), so don't unwind * here in such cases. */ - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4307,7 +4465,8 @@ client3_3_flush (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_flush_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4356,7 +4515,8 @@ client3_3_fsync (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsync_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } @@ -4404,7 +4564,8 @@ client3_3_fstat (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fstat_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4469,7 +4630,8 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this, NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_opendir_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4520,7 +4682,8 @@ client3_3_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsyncdir_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4576,7 +4739,8 @@ client3_3_statfs (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_statfs_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4637,7 +4801,8 @@ client3_3_setxattr (call_frame_t *frame, xlator_t *this, NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_setxattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.dict.dict_val); @@ -4694,7 +4859,8 @@ client3_3_fsetxattr (call_frame_t *frame, xlator_t *this, NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsetxattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.dict.dict_val); @@ -4790,7 +4956,8 @@ client3_3_fgetxattr (call_frame_t *frame, xlator_t *this, NULL, 0, local->iobref, (xdrproc_t)xdr_gfs3_fgetxattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -4903,8 +5070,9 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this, args->loc->inode, dict); if (ret) { - gf_log (this->name, GF_LOG_WARNING, - "Client dump locks failed"); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "Client dump " + "locks failed"); op_errno = EINVAL; } @@ -4925,7 +5093,8 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this, NULL, 0, local->iobref, (xdrproc_t)xdr_gfs3_getxattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5033,7 +5202,8 @@ client3_3_xattrop (call_frame_t *frame, xlator_t *this, NULL, 0, local->iobref, (xdrproc_t)xdr_gfs3_xattrop_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.dict.dict_val); @@ -5136,7 +5306,8 @@ client3_3_fxattrop (call_frame_t *frame, xlator_t *this, NULL, 0, local->iobref, (xdrproc_t)xdr_gfs3_fxattrop_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.dict.dict_val); @@ -5200,7 +5371,8 @@ client3_3_removexattr (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_removexattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5250,7 +5422,8 @@ client3_3_fremovexattr (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fremovexattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5295,8 +5468,8 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, ret = client_cmd_to_gf_cmd (args->cmd, &gf_cmd); if (ret) { op_errno = EINVAL; - gf_log (this->name, GF_LOG_WARNING, - "Unknown cmd (%d)!", gf_cmd); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd); goto unwind; } @@ -5331,7 +5504,8 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5379,8 +5553,8 @@ client3_3_inodelk (call_frame_t *frame, xlator_t *this, else if (args->cmd == F_SETLKW || args->cmd == F_SETLKW64) gf_cmd = GF_LK_SETLKW; else { - gf_log (this->name, GF_LOG_WARNING, - "Unknown cmd (%d)!", gf_cmd); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd); op_errno = EINVAL; goto unwind; } @@ -5413,7 +5587,8 @@ client3_3_inodelk (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_inodelk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5461,8 +5636,8 @@ client3_3_finodelk (call_frame_t *frame, xlator_t *this, else if (args->cmd == F_SETLKW || args->cmd == F_SETLKW64) gf_cmd = GF_LK_SETLKW; else { - gf_log (this->name, GF_LOG_WARNING, - "Unknown cmd (%d)!", gf_cmd); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd); goto unwind; } @@ -5494,7 +5669,8 @@ client3_3_finodelk (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_finodelk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5553,7 +5729,8 @@ client3_3_entrylk (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_entrylk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5608,7 +5785,8 @@ client3_3_fentrylk (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fentrylk_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5656,7 +5834,8 @@ client3_3_rchecksum (call_frame_t *frame, xlator_t *this, 0, NULL, (xdrproc_t)xdr_gfs3_rchecksum_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5754,7 +5933,8 @@ client3_3_readdir (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gfs3_readdir_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5859,7 +6039,8 @@ client3_3_readdirp (call_frame_t *frame, xlator_t *this, 0, rsp_iobref, (xdrproc_t)xdr_gfs3_readdirp_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.dict.dict_val); @@ -5919,7 +6100,8 @@ client3_3_setattr (call_frame_t *frame, xlator_t *this, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_setattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -5964,7 +6146,8 @@ client3_3_fsetattr (call_frame_t *frame, xlator_t *this, void *data) NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsetattr_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -6011,7 +6194,8 @@ client3_3_fallocate(call_frame_t *frame, xlator_t *this, void *data) NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fallocate_req); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); } GF_FREE (req.xdata.xdata_val); @@ -6056,7 +6240,8 @@ client3_3_discard(call_frame_t *frame, xlator_t *this, void *data) NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t) xdr_gfs3_discard_req); if (ret) - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); GF_FREE (req.xdata.xdata_val); @@ -6102,7 +6287,8 @@ client3_3_zerofill(call_frame_t *frame, xlator_t *this, void *data) NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t) xdr_gfs3_zerofill_req); if (ret) - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); GF_FREE (req.xdata.xdata_val); @@ -6141,7 +6327,8 @@ client3_3_ipc (call_frame_t *frame, xlator_t *this, void *data) NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t) xdr_gfs3_ipc_req); if (ret) - gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, + "failed to send the fop"); GF_FREE (req.xdata.xdata_val); diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 63cc81a514d..ea0a9d873ab 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -20,6 +20,7 @@ #include "xdr-rpc.h" #include "glusterfs3.h" #include "gf-dirent.h" +#include "client-messages.h" extern rpc_clnt_prog_t clnt_handshake_prog; extern rpc_clnt_prog_t clnt_dump_prog; @@ -163,7 +164,7 @@ client_grace_timeout (void *data) } pthread_mutex_unlock (&conf->lock); - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_TIMER_EXPIRED, "client grace timer expired, updating " "the lk-version to %d", ver); @@ -183,12 +184,12 @@ client_register_grace_timer (xlator_t *this, clnt_conf_t *conf) pthread_mutex_lock (&conf->lock); { if (conf->grace_timer || !conf->grace_timer_needed) { - gf_log (this->name, GF_LOG_TRACE, - "Client grace timer is already set " - "or a grace-timer has already time out, " - "not registering a new timer"); + gf_msg_trace (this->name, 0, + "Client grace timer is already set " + "or a grace-timer has already time " + "out, not registering a new timer"); } else { - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_TIMER_REG, "Registering a grace timer"); conf->grace_timer_needed = _gf_false; @@ -242,8 +243,8 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, (procnum == GF_HNDSK_SETVOLUME))))) { /* This particular error captured/logged in functions calling this */ - gf_log (this->name, GF_LOG_DEBUG, - "connection in disconnected state"); + gf_msg_debug (this->name, 0, + "connection in disconnected state"); goto out; } @@ -262,16 +263,18 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, if (iobref != NULL) { ret = iobref_merge (new_iobref, iobref); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot merge iobref passed from caller " - "into new_iobref"); + gf_msg (this->name, GF_LOG_WARNING, ENOMEM, + PC_MSG_NO_MEMORY, "cannot merge " + "iobref passed from caller into " + "new_iobref"); } } ret = iobref_add (new_iobref, iobuf); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot add iobuf into iobref"); + gf_msg (this->name, GF_LOG_WARNING, ENOMEM, + PC_MSG_NO_MEMORY, "cannot add iobuf into " + "iobref"); goto out; } @@ -309,7 +312,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, rsp_payload, rsp_payload_count, rsp_iobref); if (ret < 0) { - gf_log (this->name, GF_LOG_DEBUG, "rpc_clnt_submit failed"); + gf_msg_debug (this->name, 0, "rpc_clnt_submit failed"); } if (!conf->send_gids) { @@ -366,14 +369,13 @@ client_releasedir (xlator_t *this, fd_t *fd) args.fd = fd; proc = &conf->fops->proctable[GF_FOP_RELEASEDIR]; - if (proc->fn) { ret = proc->fn (NULL, this, &args); } out: if (ret) - gf_log (this->name, GF_LOG_WARNING, - "releasedir fop failed"); + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_DIR_OP_FAILED, "releasedir fop failed"); return 0; } @@ -391,13 +393,12 @@ client_release (xlator_t *this, fd_t *fd) args.fd = fd; proc = &conf->fops->proctable[GF_FOP_RELEASE]; - if (proc->fn) { ret = proc->fn (NULL, this, &args); } out: if (ret) - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED, "release fop failed"); return 0; } @@ -420,7 +421,6 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LOOKUP]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -449,7 +449,6 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STAT]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -478,7 +477,6 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_TRUNCATE]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -508,7 +506,6 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FTRUNCATE]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -538,7 +535,6 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ACCESS]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -569,7 +565,6 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READLINK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -600,7 +595,6 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKNOD]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -631,7 +625,6 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKDIR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -662,7 +655,6 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, args.flags = xflag; proc = &conf->fops->proctable[GF_FOP_UNLINK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -691,7 +683,6 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RMDIR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -723,7 +714,6 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SYMLINK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -754,7 +744,6 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RENAME]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -785,7 +774,6 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LINK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -823,7 +811,6 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, args.flags = (flags & ~O_DIRECT); proc = &conf->fops->proctable[GF_FOP_CREATE]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -859,7 +846,6 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, args.flags = (flags & ~O_DIRECT); proc = &conf->fops->proctable[GF_FOP_OPEN]; - if (proc->fn) ret = proc->fn (frame, this, &args); @@ -892,7 +878,6 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READ]; - if (proc->fn) ret = proc->fn (frame, this, &args); @@ -931,7 +916,6 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_WRITE]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -958,7 +942,6 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FLUSH]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -988,7 +971,6 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNC]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1016,7 +998,6 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSTAT]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1046,7 +1027,6 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_OPENDIR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1075,7 +1055,6 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, d args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNCDIR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1103,7 +1082,6 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STATFS]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1121,13 +1099,13 @@ is_client_rpc_init_command (dict_t *dict, xlator_t *this, int dict_ret = -1; if (!strstr (this->name, "replace-brick")) { - gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick"); + gf_msg_trace (this->name, 0, "name is !replace-brick"); goto out; } dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT, value); if (dict_ret) { - gf_log (this->name, GF_LOG_TRACE, "key %s not present", - CLIENT_CMD_CONNECT); + gf_msg_trace (this->name, 0, "key %s not present", + CLIENT_CMD_CONNECT); goto out; } @@ -1146,14 +1124,14 @@ is_client_rpc_destroy_command (dict_t *dict, xlator_t *this) char *dummy = NULL; if (strncmp (this->name, "replace-brick", 13)) { - gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick"); + gf_msg_trace (this->name, 0, "name is !replace-brick"); goto out; } dict_ret = dict_get_str (dict, CLIENT_CMD_DISCONNECT, &dummy); if (dict_ret) { - gf_log (this->name, GF_LOG_TRACE, "key %s not present", - CLIENT_CMD_DISCONNECT); + gf_msg_trace (this->name, 0, "key %s not present", + CLIENT_CMD_DISCONNECT); goto out; } @@ -1183,8 +1161,9 @@ client_set_remote_options (char *value, xlator_t *this) remote_port_str = strtok_r (NULL, ":", &tmp); if (!subvol) { - gf_log (this->name, GF_LOG_WARNING, - "proper value not passed as subvolume"); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "proper value not passed as " + "subvolume"); goto out; } @@ -1195,7 +1174,7 @@ client_set_remote_options (char *value, xlator_t *this) ret = dict_set_dynstr (this->options, "remote-host", host_dup); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED, "failed to set remote-host with %s", host); goto out; } @@ -1207,7 +1186,7 @@ client_set_remote_options (char *value, xlator_t *this) ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup); if (ret) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED, "failed to set remote-host with %s", host); goto out; } @@ -1218,7 +1197,7 @@ client_set_remote_options (char *value, xlator_t *this) ret = dict_set_int32 (this->options, "remote-port", remote_port); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED, "failed to set remote-port to %d", remote_port); goto out; } @@ -1247,7 +1226,8 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, if (is_client_rpc_init_command (dict, this, &value) == _gf_true) { GF_ASSERT (value); - gf_log (this->name, GF_LOG_INFO, "client rpc init command"); + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT, + "client rpc init command"); ret = client_set_remote_options (value, this); if (ret) { (void) client_destroy_rpc (this); @@ -1263,7 +1243,8 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, } if (is_client_rpc_destroy_command (dict, this) == _gf_true) { - gf_log (this->name, GF_LOG_INFO, "client rpc destroy command"); + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY, + "client rpc destroy command"); ret = client_destroy_rpc (this); if (ret) { op_ret = 0; @@ -1286,7 +1267,6 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETXATTR]; - if (proc->fn) { ret = proc->fn (frame, this, &args); if (ret) { @@ -1321,7 +1301,6 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETXATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1352,7 +1331,6 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FGETXATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1382,7 +1360,6 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_GETXATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1413,7 +1390,6 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_XATTROP]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1444,7 +1420,6 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FXATTROP]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1474,7 +1449,6 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1502,7 +1476,6 @@ client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1531,7 +1504,6 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1562,7 +1534,6 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_INODELK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1594,7 +1565,6 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FINODELK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1627,7 +1597,6 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ENTRYLK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1661,7 +1630,6 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FENTRYLK]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1691,7 +1659,6 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RCHECKSUM]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1723,7 +1690,6 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READDIR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1756,7 +1722,6 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = dict; proc = &conf->fops->proctable[GF_FOP_READDIRP]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1786,7 +1751,6 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1815,7 +1779,6 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETATTR]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1845,7 +1808,6 @@ client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FALLOCATE]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1874,7 +1836,6 @@ client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_DISCARD]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1903,7 +1864,6 @@ client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ZEROFILL]; - if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1931,12 +1891,6 @@ client_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata) args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_IPC]; - if (!proc) { - gf_log (this->name, GF_LOG_ERROR, - "rpc procedure not found for %s", - gf_fop_list[GF_FOP_IPC]); - goto out; - } if (proc->fn) ret = proc->fn (frame, this, &args); out: @@ -1965,7 +1919,6 @@ client_getspec (call_frame_t *frame, xlator_t *this, const char *key, /* For all other xlators, getspec is an fop, hence its in fops table */ proc = &conf->fops->proctable[GF_FOP_GETSPEC]; - if (proc->fn) { /* But at protocol level, this is handshake */ ret = proc->fn (frame, this, &args); @@ -2010,7 +1963,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, this = mydata; if (!this || !this->private) { - gf_log ("client", GF_LOG_ERROR, + gf_msg ("client", GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY, (this != NULL) ? "private structure of the xlator is NULL": "xlator is NULL"); @@ -2027,20 +1980,22 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, ret = dict_get_str (this->options, "disable-handshake", &handshake); - gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); + gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT"); if ((ret < 0) || (strcasecmp (handshake, "on"))) { ret = client_handshake (this, rpc); if (ret) - gf_log (this->name, GF_LOG_WARNING, - "handshake msg returned %d", ret); + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_HANDSHAKE_RETURN, "handshake " + "msg returned %d", ret); } else { //conf->rpc->connected = 1; ret = client_notify_dispatch_uniq (this, GF_EVENT_CHILD_UP, NULL); if (ret) - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_CHILD_UP_NOTIFY_FAILED, "CHILD_UP notify failed"); } @@ -2050,7 +2005,8 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, conf->grace_timer_needed = _gf_true; if (conf->grace_timer) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_GRACE_TIMER_CANCELLED, "Cancelling the grace timer"); gf_timer_call_cancel (this->ctx, @@ -2071,19 +2027,26 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, if (!conf->skip_notify) { if (conf->connected) { - gf_log (this->name, - ((!conf->disconnect_err_logged) - ? GF_LOG_INFO : GF_LOG_DEBUG), - "disconnected from %s. Client process " - "will keep trying to connect to " - "glusterd until brick's port is " - "available", - conf->rpc->conn.name); - + if (!conf->disconnect_err_logged) { + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_CLIENT_DISCONNECTED, + "disconnected from %s. Client " + "process will keep trying to " + "connect to glusterd until " + "brick's port is available", + conf->rpc->conn.name); + } else { + gf_msg_debug (this->name, 0, + "disconnected from %s. " + "Client process will keep" + " trying to connect to " + "glusterd until brick's " + "port is available", + conf->rpc->conn.name); + } if (conf->portmap_err_logged) conf->disconnect_err_logged = 1; } - /* If the CHILD_DOWN event goes to parent xlator multiple times, the logic of parent xlator notify may get screwed up.. (eg. CHILD_MODIFIED event in @@ -2093,13 +2056,14 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, GF_EVENT_CHILD_DOWN, NULL); if (ret) - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, + PC_MSG_CHILD_DOWN_NOTIFY_FAILED, "CHILD_DOWN notify failed"); } else { if (conf->connected) - gf_log (this->name, GF_LOG_DEBUG, - "disconnected (skipped notify)"); + gf_msg_debug (this->name, 0, + "disconnected (skipped notify)"); } conf->connected = 0; @@ -2121,8 +2085,8 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, break; default: - gf_log (this->name, GF_LOG_TRACE, - "got some other RPC event %d", event); + gf_msg_trace (this->name, 0, + "got some other RPC event %d", event); break; } @@ -2144,7 +2108,7 @@ notify (xlator_t *this, int32_t event, void *data, ...) switch (event) { case GF_EVENT_PARENT_UP: { - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP, "parent translators are ready, attempting connect " "on transport"); @@ -2153,7 +2117,7 @@ notify (xlator_t *this, int32_t event, void *data, ...) } case GF_EVENT_PARENT_DOWN: - gf_log (this->name, GF_LOG_INFO, + gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN, "current graph is no longer active, destroying " "rpc_client "); @@ -2167,8 +2131,8 @@ notify (xlator_t *this, int32_t event, void *data, ...) break; default: - gf_log (this->name, GF_LOG_DEBUG, - "got %d, calling default_notify ()", event); + gf_msg_debug (this->name, 0, + "got %d, calling default_notify ()", event); default_notify (this, event, data); conf->last_sent_event = event; @@ -2186,20 +2150,23 @@ client_check_remote_host (xlator_t *this, dict_t *options) ret = dict_get_str (options, "remote-host", &remote_host); if (ret < 0) { - gf_log (this->name, GF_LOG_INFO, "Remote host is not set. " - "Assuming the volfile server as remote host."); + gf_msg (this->name, GF_LOG_INFO, EINVAL, + PC_MSG_DICT_GET_FAILED, "Remote host is not set. " + "Assuming the volfile server as remote host"); if (!this->ctx->cmd_args.volfile_server) { - gf_log (this->name, GF_LOG_ERROR, - "No remote host to connect."); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_DICT_GET_FAILED, "No remote host to " + "connect."); goto out; } ret = dict_set_str (options, "remote-host", this->ctx->cmd_args.volfile_server); if (ret == -1) { - gf_log (this->name, GF_LOG_ERROR, - "Failed to set the remote host"); + gf_msg (this->name, GF_LOG_ERROR, 0, + PC_MSG_DICT_GET_FAILED, "Failed to set the " + "remote host"); goto out; } } @@ -2229,7 +2196,8 @@ build_client_config (xlator_t *this, clnt_conf_t *conf) GF_OPTION_INIT ("remote-subvolume", conf->opt.remote_subvolume, path, out); if (!conf->opt.remote_subvolume) - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "option 'remote-subvolume' not given"); GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct, @@ -2260,8 +2228,8 @@ mem_acct_init (xlator_t *this) ret = xlator_mem_acct_init (this, gf_client_mt_end + 1); if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, "Memory accounting init" - "failed"); + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY, + "Memory accounting init failed"); return ret; } @@ -2284,12 +2252,12 @@ client_destroy_rpc (xlator_t *this) conf->rpc = rpc_clnt_unref (conf->rpc); ret = 0; - gf_log (this->name, GF_LOG_DEBUG, - "Client rpc conn destroyed"); + gf_msg_debug (this->name, 0, + "Client rpc conn destroyed"); goto out; } - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL, "RPC destroy called on already destroyed " "connection"); @@ -2306,21 +2274,24 @@ client_init_rpc (xlator_t *this) conf = this->private; if (conf->rpc) { - gf_log (this->name, GF_LOG_WARNING, - "client rpc already init'ed"); + gf_msg (this->name, GF_LOG_WARNING, 0, + PC_MSG_RPC_INITED_ALREADY, "client rpc already " + "init'ed"); ret = -1; goto out; } conf->rpc = rpc_clnt_new (this->options, this->ctx, this->name, 0); if (!conf->rpc) { - gf_log (this->name, GF_LOG_ERROR, "failed to initialize RPC"); + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED, + "failed to initialize RPC"); goto out; } ret = rpc_clnt_register_notify (conf->rpc, client_rpc_notify, this); if (ret) { - gf_log (this->name, GF_LOG_ERROR, "failed to register notify"); + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED, + "failed to register notify"); goto out; } @@ -2330,14 +2301,14 @@ client_init_rpc (xlator_t *this) ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog, this); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED, "failed to register callback program"); goto out; } ret = 0; - gf_log (this->name, GF_LOG_DEBUG, "client init successful"); + gf_msg_debug (this->name, 0, "client init successful"); out: return ret; } @@ -2362,8 +2333,8 @@ client_init_grace_timer (xlator_t *this, dict_t *options, if (!ret) gf_string2boolean (lk_heal, &conf->lk_heal); - gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s", - (conf->lk_heal) ? "on" : "off"); + gf_msg_debug (this->name, 0, "lk-heal = %s", + (conf->lk_heal) ? "on" : "off"); ret = dict_get_int32 (options, "grace-timeout", &grace_timeout); if (!ret) @@ -2375,8 +2346,8 @@ client_init_grace_timer (xlator_t *this, dict_t *options, gf_time_fmt (timestr, sizeof timestr, conf->grace_ts.tv_sec, gf_timefmt_s); - gf_log (this->name, GF_LOG_DEBUG, "Client grace timeout value = %s", - timestr); + gf_msg_debug (this->name, 0, "Client grace timeout value = %s", + timestr); ret = 0; out: @@ -2477,15 +2448,15 @@ init (xlator_t *this) clnt_conf_t *conf = NULL; if (this->children) { - gf_log (this->name, GF_LOG_ERROR, - "FATAL: client protocol translator cannot have any " - "subvolumes"); + gf_msg (this->name, GF_LOG_ERROR, EINVAL, + PC_MSG_INVALID_ENTRY, "FATAL: client protocol " + "translator cannot have any subvolumes"); goto out; } if (!this->parents) { - gf_log (this->name, GF_LOG_WARNING, - "Volume is dangling. "); + gf_msg (this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_INVALID_ENTRY, "Volume is dangling. "); } conf = GF_CALLOC (1, sizeof (*conf), gf_client_mt_clnt_conf_t); @@ -2535,7 +2506,7 @@ init (xlator_t *this) this->local_pool = mem_pool_new (clnt_local_t, 64); if (!this->local_pool) { ret = -1; - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY, "failed to create local_t's memory pool"); goto out; } diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 40200b6afc4..38f34d56fe7 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -48,7 +48,8 @@ typedef enum { goto label; \ } \ if (remote_fd == -1) { \ - gf_log (xl->name, GF_LOG_WARNING, " (%s) " \ + gf_msg (xl->name, GF_LOG_WARNING, EBADFD, \ + PC_MSG_BAD_FD, " (%s) " \ "remote_fd is -1. EBADFD", \ uuid_utoa (fd->inode->gfid)); \ op_errno = EBADFD; \ |