From be26b0da2f1a7fe336400de6a1c016716983bd38 Mon Sep 17 00:00:00 2001 From: hari gowtham Date: Wed, 11 Apr 2018 17:38:26 +0530 Subject: glusterd: volume inode/fd status broken with brick mux Problem: The values for inode/fd was populated from the ctx received from the server xlator. Without brickmux, every brick from a volume belonged to a single brick from the volume. So searching the server and populating it worked. With brickmux, a number of bricks can be confined to a single process. These bricks can be from different volumes too (if we use the max-bricks-per-process option). If they are from different volumes, using the server xlator to populate causes problem. Fix: Use the brick to validate and populate the inode/fd status. Signed-off-by: hari gowtham Change-Id: I2543fa5397ea095f8338b518460037bba3dfdbfd fixes: bz#1566067 --- libglusterfs/src/client_t.c | 54 ++++++++++++++++++++++++++------------------- libglusterfs/src/xlator.h | 3 ++- 2 files changed, 33 insertions(+), 24 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index a51fb7a88c0..63f4bbb4b06 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -744,10 +744,13 @@ gf_client_dump_fdtables_to_dict (xlator_t *this, dict_t *dict) clienttable->cliententries[count].next_free) continue; client = clienttable->cliententries[count].client; - memset(key, 0, sizeof key); - snprintf (key, sizeof key, "conn%d", count++); - fdtable_dump_to_dict (client->server_ctx.fdtable, - key, dict); + if (!strcmp (client->bound_xl->name, this->name)) { + memset(key, 0, sizeof (key)); + snprintf (key, sizeof (key), "conn%d", count++); + fdtable_dump_to_dict (client->server_ctx. + fdtable, + key, dict); + } } } UNLOCK(&clienttable->lock); @@ -860,25 +863,30 @@ gf_client_dump_inodes_to_dict (xlator_t *this, dict_t *dict) clienttable->cliententries[count].next_free) continue; client = clienttable->cliententries[count].client; - memset(key, 0, sizeof key); - if (client->bound_xl && client->bound_xl->itable) { - /* Presently every brick contains only - * one bound_xl for all connections. - * This will lead to duplicating of - * the inode lists, if listing is - * done for every connection. This - * simple check prevents duplication - * in the present case. If need arises - * the check can be improved. - */ - if (client->bound_xl == prev_bound_xl) - continue; - prev_bound_xl = client->bound_xl; - - memset (key, 0, sizeof (key)); - snprintf (key, sizeof (key), "conn%d", count); - inode_table_dump_to_dict (client->bound_xl->itable, - key, dict); + if (!strcmp (client->bound_xl->name, this->name)) { + memset(key, 0, sizeof (key)); + if (client->bound_xl && client->bound_xl-> + itable) { + /* Presently every brick contains only + * one bound_xl for all connections. + * This will lead to duplicating of + * the inode lists, if listing is + * done for every connection. This + * simple check prevents duplication + * in the present case. If need arises + * the check can be improved. + */ + if (client->bound_xl == prev_bound_xl) + continue; + prev_bound_xl = client->bound_xl; + + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "conn%d", + count); + inode_table_dump_to_dict (client-> + bound_xl->itable, + key, dict); + } } } } diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index f41ebddd9a9..2f8fed6bb64 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -922,7 +922,8 @@ typedef int32_t (*dumpop_inodectx_t) (xlator_t *this, inode_t *ino); typedef int32_t (*dumpop_fdctx_t) (xlator_t *this, fd_t *fd); -typedef int32_t (*dumpop_priv_to_dict_t) (xlator_t *this, dict_t *dict); +typedef int32_t (*dumpop_priv_to_dict_t) (xlator_t *this, dict_t *dict, + char *brickname); typedef int32_t (*dumpop_inode_to_dict_t) (xlator_t *this, dict_t *dict); -- cgit