summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-resolve.c
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-03-11 20:11:09 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-06-14 22:25:00 -0700
commiteca453865a1df9b9b15b57ee47d844c94db4b7ba (patch)
tree353f78ed3d44628b8accd68aece330035bd8ac77 /xlators/protocol/server/src/server-resolve.c
parent475b236dc572dbfabdbda047d80567b909c266cd (diff)
protocol/server : port log messages to a new framework
Backport of http://review.gluster.org/#/c/9874/ Cherry picked from dc089a1a51988c2b407040e1684d7b0adbd79556 > Change-Id: I7901f55d06716161cc31d2b79a600a16b5ec2ef8 > BUG: 1194640 > Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> > Reviewed-on: http://review.gluster.org/9874 > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I7901f55d06716161cc31d2b79a600a16b5ec2ef8 BUG: 1217722 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/10552 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/server/src/server-resolve.c')
-rw-r--r--xlators/protocol/server/src/server-resolve.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 461884d0ee3..a7da519488d 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -15,6 +15,7 @@
#include "server.h"
#include "server-helpers.h"
+#include "server-messages.h"
int
@@ -63,11 +64,18 @@ resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
resolve_loc = &resolve->resolve_loc;
if (op_ret == -1) {
- gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
- GF_LOG_WARNING),
- "%s/%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->pargfid), resolve_loc->name,
- strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug (this->name, 0, "%s/%s: failed to resolve"
+ " (%s)",
+ uuid_utoa (resolve_loc->pargfid),
+ resolve_loc->name, strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED, "%s/%s: failed to "
+ "resolve (%s)",
+ uuid_utoa (resolve_loc->pargfid),
+ resolve_loc->name, strerror (op_errno));
+ }
goto out;
}
@@ -104,10 +112,18 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
resolve_loc = &resolve->resolve_loc;
if (op_ret == -1) {
- gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
- GF_LOG_WARNING),
- "%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->gfid), strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug (this->name, GF_LOG_DEBUG,
+ "%s: failed to resolve (%s)",
+ uuid_utoa (resolve_loc->gfid),
+ strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED,
+ "%s: failed to resolve (%s)",
+ uuid_utoa (resolve_loc->gfid),
+ strerror (op_errno));
+ }
loc_wipe (&resolve->resolve_loc);
goto out;
}
@@ -213,8 +229,8 @@ resolve_continue (call_frame_t *frame)
else if (!gf_uuid_is_null (resolve->gfid))
ret = resolve_inode_simple (frame);
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "return value of resolve_*_simple %d", ret);
+ gf_msg_debug (this->name, 0, "return value of resolve_*_"
+ "simple %d", ret);
resolve_loc_touchup (frame);
out:
@@ -281,9 +297,9 @@ resolve_entry_simple (call_frame_t *frame)
}
if (resolve->type == RESOLVE_NOT) {
- gf_log (this->name, GF_LOG_DEBUG, "inode (pointer: %p gfid:%s"
- " found for path (%s) while type is RESOLVE_NOT",
- inode, uuid_utoa (inode->gfid), resolve->path);
+ gf_msg_debug (this->name, 0, "inode (pointer: %p gfid:%s found"
+ " for path (%s) while type is RESOLVE_NOT",
+ inode, uuid_utoa (inode->gfid), resolve->path);
resolve->op_ret = -1;
resolve->op_errno = EEXIST;
ret = -1;
@@ -420,9 +436,9 @@ out:
inode_unref (inode);
if (ret != 0)
- gf_log ("server", GF_LOG_DEBUG, "inode for the gfid (%s) is "
- "not found. anonymous fd creation failed",
- uuid_utoa (resolve->gfid));
+ gf_msg_debug ("server", 0, "inode for the gfid (%s) is "
+ "not found. anonymous fd creation failed",
+ uuid_utoa (resolve->gfid));
return ret;
}
@@ -476,7 +492,8 @@ server_resolve_fd (call_frame_t *frame)
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log ("", GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg ("", GF_LOG_INFO, ENOMEM, PS_MSG_NO_MEMORY,
+ "server_ctx_get() failed");
resolve->op_ret = -1;
resolve->op_errno = ENOMEM;
return 0;
@@ -485,7 +502,8 @@ server_resolve_fd (call_frame_t *frame)
state->fd = gf_fd_fdptr_get (serv_ctx->fdtable, fd_no);
if (!state->fd) {
- gf_log ("", GF_LOG_INFO, "fd not found in context");
+ gf_msg ("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND, "fd not "
+ "found in context");
resolve->op_ret = -1;
resolve->op_errno = EBADF;
}
@@ -519,7 +537,8 @@ server_resolve (call_frame_t *frame)
} else {
if (resolve == &state->resolve)
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+ PS_MSG_INVALID_ENTRY,
"no resolution type for %s (%s)",
resolve->path, gf_fop_list[frame->root->op]);
@@ -580,8 +599,9 @@ server_resolve_all (call_frame_t *frame)
server_resolve_done (frame);
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "Invalid pointer for state->resolve_now");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ PS_MSG_INVALID_ENTRY, "Invalid pointer for "
+ "state->resolve_now");
}
return 0;