summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-05-27 11:43:26 +0530
committerAmar Tumballi <amarts@redhat.com>2019-05-30 15:54:33 +0000
commit14d9c6179715205fb6ac816d4621dd087f5afbb2 (patch)
treed8f94f2d0461c975d57c53860508b012c870742d
parentd2576452028db3b817fc5b1f4f924a98bc22c7dc (diff)
stack: Make sure to have unique call-stacks in all cases
At the moment new stack doesn't populate frame->root->unique in all cases. This makes it difficult to debug hung frames by examining successive state dumps. Fuse and server xlators populate it whenever they can, but other xlators won't be able to assign 'unique' when they need to create a new frame/stack because they don't know what 'unique' fuse/server xlators already used. What we need is for unique to be correct. If a stack with same unique is present in successive statedumps, that means the same operation is still in progress. This makes 'finding hung frames' part of debugging hung frames easier. fixes bz#1714098 Change-Id: I3e9a8f6b4111e260106c48a2ac3a41ef29361b9e Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r--libglusterfs/src/stack.c2
-rw-r--r--xlators/features/quota/src/quotad-helpers.c3
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c15
-rw-r--r--xlators/mount/fuse/src/fuse-helpers.c1
-rw-r--r--xlators/protocol/server/src/server-helpers.c3
5 files changed, 10 insertions, 14 deletions
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index 82b35772d6e..371f60c4436 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -17,6 +17,7 @@ create_frame(xlator_t *xl, call_pool_t *pool)
{
call_stack_t *stack = NULL;
call_frame_t *frame = NULL;
+ static uint64_t unique = 0;
if (!xl || !pool) {
return NULL;
@@ -52,6 +53,7 @@ create_frame(xlator_t *xl, call_pool_t *pool)
{
list_add(&stack->all_frames, &pool->all_frames);
pool->cnt++;
+ stack->unique = unique++;
}
UNLOCK(&pool->lock);
GF_ATOMIC_INC(pool->total_count);
diff --git a/xlators/features/quota/src/quotad-helpers.c b/xlators/features/quota/src/quotad-helpers.c
index bb66a314705..51ff1d7e98d 100644
--- a/xlators/features/quota/src/quotad-helpers.c
+++ b/xlators/features/quota/src/quotad-helpers.c
@@ -76,7 +76,6 @@ quotad_aggregator_alloc_frame(rpcsvc_request_t *req)
goto out;
frame->root->state = state;
- frame->root->unique = 0;
frame->this = this;
out:
@@ -96,8 +95,6 @@ quotad_aggregator_get_frame_from_req(rpcsvc_request_t *req)
frame->root->op = req->procnum;
- frame->root->unique = req->xid;
-
frame->root->uid = req->uid;
frame->root->gid = req->gid;
frame->root->pid = req->pid;
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index e14d0b996da..5fa3ff532f9 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3277,11 +3277,11 @@ fuse_release(xlator_t *this, fuse_in_header_t *finh, void *msg,
priv = this->private;
- fuse_log_eh(this, "RELEASE(): %" PRIu64 ":, fd: %p, gfid: %s", finh->unique,
- fd, uuid_utoa(fd->inode->gfid));
+ fuse_log_eh(this, "RELEASE(): finh->unique: %" PRIu64 ":, fd: %p, gfid: %s",
+ finh->unique, fd, uuid_utoa(fd->inode->gfid));
- gf_log("glusterfs-fuse", GF_LOG_TRACE, "%" PRIu64 ": RELEASE %p",
- finh->unique, state->fd);
+ gf_log("glusterfs-fuse", GF_LOG_TRACE,
+ "finh->unique: %" PRIu64 ": RELEASE %p", finh->unique, state->fd);
fuse_fd_ctx_destroy(this, state->fd);
fd_unref(fd);
@@ -3766,11 +3766,12 @@ fuse_releasedir(xlator_t *this, fuse_in_header_t *finh, void *msg,
priv = this->private;
- fuse_log_eh(this, "RELEASEDIR (): %" PRIu64 ": fd: %p, gfid: %s",
+ fuse_log_eh(this,
+ "RELEASEDIR (): finh->unique: %" PRIu64 ": fd: %p, gfid: %s",
finh->unique, state->fd, uuid_utoa(state->fd->inode->gfid));
- gf_log("glusterfs-fuse", GF_LOG_TRACE, "%" PRIu64 ": RELEASEDIR %p",
- finh->unique, state->fd);
+ gf_log("glusterfs-fuse", GF_LOG_TRACE,
+ "finh->unique: %" PRIu64 ": RELEASEDIR %p", finh->unique, state->fd);
fuse_fd_ctx_destroy(this, state->fd);
fd_unref(state->fd);
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c
index cf4f8e17c51..5bfc40c9fcb 100644
--- a/xlators/mount/fuse/src/fuse-helpers.c
+++ b/xlators/mount/fuse/src/fuse-helpers.c
@@ -358,7 +358,6 @@ get_call_frame_for_req(fuse_state_t *state)
frame->root->uid = finh->uid;
frame->root->gid = finh->gid;
frame->root->pid = finh->pid;
- frame->root->unique = finh->unique;
set_lk_owner_from_uint64(&frame->root->lk_owner, state->lk_owner);
}
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index f6edf3f5120..5ffd5d24180 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -456,7 +456,6 @@ server_alloc_frame(rpcsvc_request_t *req)
frame->root->client = client;
frame->root->state = state; /* which socket */
- frame->root->unique = 0; /* which call */
frame->this = client->this;
out:
@@ -484,8 +483,6 @@ get_frame_from_request(rpcsvc_request_t *req)
frame->root->op = req->procnum;
- frame->root->unique = req->xid;
-
client = req->trans->xl_private;
this = req->trans->xl;
priv = this->private;