diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-03-14 15:54:07 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-04-03 15:22:32 -0700 |
commit | e80a04f7850144449a0d2fc4f9d40d0227f170cc (patch) | |
tree | 542a6c552963729fa421e189ac4898a18a198d86 | |
parent | 0106fce7fed3dc8f38de3bf365182bdd782b5d9c (diff) |
protocol/client: Print valid loc identifiers
Change-Id: I45f91105862a2484b8906a7a63b98ab4aaf80d05
BUG: 924643
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4683
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | libglusterfs/src/xlator.c | 16 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 1 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 62 |
3 files changed, 43 insertions, 36 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 1be4c86b2ed..348f48c4805 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -637,6 +637,21 @@ out: return ret; } +char* +loc_gfid_utoa (loc_t *loc) +{ + uuid_t gfid={0}; + + if (!loc) + goto out; + else if (!uuid_is_null (loc->gfid)) + uuid_copy (gfid, loc->gfid); + else if (loc->inode && (!uuid_is_null (loc->inode->gfid))) + uuid_copy (gfid, loc->inode->gfid); +out: + return uuid_utoa (gfid); +} + int loc_copy (loc_t *dst, loc_t *src) { @@ -676,7 +691,6 @@ err: return ret; } - int xlator_list_destroy (xlator_list_t *list) { diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index bb32797c379..071a4bdb789 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -886,6 +886,7 @@ int loc_copy (loc_t *dst, loc_t *src); #define loc_dup(src, dst) loc_copy(dst, src) void loc_wipe (loc_t *loc); int loc_path (loc_t *loc, const char *bname); +char* loc_gfid_utoa (loc_t *loc); int xlator_mem_acct_init (xlator_t *xl, int num_types); int is_gf_log_command (xlator_t *trans, const char *name, char *value); int glusterd_check_log_level (const char *value); diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index f524c1a373a..a6d0a591a88 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -185,8 +185,7 @@ out: gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s. Path: (%s to %s)", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local) ? local->loc2.path: "--"); + local->loc.path, local->loc2.path); } CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret, @@ -252,11 +251,9 @@ client3_3_mknod_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)", + "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path); } CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret, @@ -320,11 +317,9 @@ client3_3_mkdir_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)", + "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path); } CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret, @@ -466,9 +461,7 @@ out: gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path, loc_gfid_utoa (&local->loc)); } CLIENT_STACK_UNWIND (open, frame, rsp.op_ret, @@ -1106,10 +1099,8 @@ out: GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s", strerror (op_errno), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--", - (local) ? local->name : "(null)"); + 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); @@ -1750,9 +1741,7 @@ out: gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path, loc_gfid_utoa (&local->loc)); } CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret, @@ -2064,11 +2053,9 @@ 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, - "remote operation failed: %s. Path: %s (%s)", + "remote operation failed: %s. Path: %s", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path); } CLIENT_STACK_UNWIND (create, frame, rsp.op_ret, @@ -2463,10 +2450,7 @@ out: gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s (%s -> %s)", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? ((local->loc.path)? local->loc.path : - uuid_utoa (local->loc.inode->gfid)) : "--", - (local) ? ((local->loc2.path)? local->loc2.path : - local->loc2.name) : "--"); + local->loc.path, local->loc2.path); } CLIENT_STACK_UNWIND (link, frame, rsp.op_ret, @@ -2536,9 +2520,7 @@ out: gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + local->loc.path, loc_gfid_utoa (&local->loc)); } CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); @@ -2618,10 +2600,8 @@ out: if (rsp.op_errno != ENOENT) gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)", - strerror (rsp.op_errno), - (local) ? local->loc.path : "--", - (local && local->loc.inode) ? - uuid_utoa (local->loc.inode->gfid) : "--"); + 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"); @@ -2926,6 +2906,7 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this, goto unwind; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (args->loc->parent) { @@ -3442,6 +3423,7 @@ client3_3_symlink (call_frame_t *frame, xlator_t *this, goto unwind; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3591,7 +3573,9 @@ client3_3_link (call_frame_t *frame, xlator_t *this, } loc_copy (&local->loc, args->oldloc); + loc_path (&local->loc, NULL); loc_copy (&local->loc2, args->newloc); + loc_path (&local->loc2, NULL); frame->local = local; req.newbname = (char *)args->newloc->name; @@ -3646,6 +3630,7 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this, goto unwind; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) @@ -3713,6 +3698,7 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this, goto unwind; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) @@ -3781,6 +3767,7 @@ client3_3_create (call_frame_t *frame, xlator_t *this, local->flags = args->flags; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) @@ -3850,6 +3837,7 @@ client3_3_open (call_frame_t *frame, xlator_t *this, local->fd = fd_ref (args->fd); local->flags = args->flags; loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) @@ -4238,6 +4226,7 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this, local->fd = fd_ref (args->fd); loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) @@ -4644,6 +4633,7 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this, } loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); if (args->name) local->name = gf_strdup (args->name); @@ -4808,6 +4798,8 @@ client3_3_xattrop (call_frame_t *frame, xlator_t *this, else memcpy (req.gfid, args->loc->gfid, 16); + loc_copy (&local->loc, args->loc); + loc_path (&local->loc, NULL); GF_ASSERT_AND_GOTO_WITH_ERROR (this->name, !uuid_is_null (*((uuid_t*)req.gfid)), unwind, op_errno, EINVAL); |