diff options
author | hari gowtham <hgowtham@redhat.com> | 2018-04-11 17:38:26 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-04-19 02:54:50 +0000 |
commit | be26b0da2f1a7fe336400de6a1c016716983bd38 (patch) | |
tree | 573d0289d2556cbf99085e7888197bea2b07ee23 /libglusterfs | |
parent | 054cecc30676017f83a18847734d9fe0fcb8ea72 (diff) |
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 <hgowtham@redhat.com>
Change-Id: I2543fa5397ea095f8338b518460037bba3dfdbfd
fixes: bz#1566067
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/client_t.c | 54 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 3 |
2 files changed, 33 insertions, 24 deletions
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); |