summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2012-05-11 18:11:31 +0530
committerVijay Bellur <vijay@gluster.com>2012-05-18 06:02:23 -0700
commit0cdb1d147afd644153855f6557bf7e809e5444f0 (patch)
tree43600bff8a27cd30b7d9004be2d36b57f8581605 /libglusterfs
parent7914df6c6ab6d7d3905b26c1dbc5ac07d79ef10f (diff)
libglusterfs/fd: while dumping the fd_ctx use fd->xl_count
While dumping the fd_ctx when statedump is issued fd->xl_count should be used to determine the number of xlators instead of using latest graph's count, since while creating the fd only those many slots would have been allocated as the number of xlators in the graph at that instant. Then the graph would have changed, thus the xl count. All the above things should happen before any operation is done on fd, otherwise fd_ctx_set will allocate the extra slots for the new xlators present in the graph. Also added the program which can be used to reproduce the bug. Change-Id: I11fe75d71ef5d37e29e2958d53752aa31098c313 BUG: 820887 Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Reviewed-on: http://review.gluster.com/3335 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com> Reviewed-on: http://review.gluster.com/3369
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/fd.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index db92ee00ad1..3a7a592786c 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -1030,15 +1030,13 @@ fd_ctx_dump (fd_t *fd, char *prefix)
LOCK (&fd->lock);
{
if (fd->_ctx != NULL) {
- fd_ctx = GF_CALLOC (fd->inode->table->xl->graph->xl_count,
- sizeof (*fd_ctx),
+ fd_ctx = GF_CALLOC (fd->xl_count, sizeof (*fd_ctx),
gf_common_mt_fd_ctx);
if (fd_ctx == NULL) {
goto unlock;
}
- for (i = 0; i < fd->inode->table->xl->graph->xl_count;
- i++) {
+ for (i = 0; i < fd->xl_count; i++) {
fd_ctx[i] = fd->_ctx[i];
}
}
@@ -1050,7 +1048,7 @@ unlock:
goto out;
}
- for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) {
+ for (i = 0; i < fd->xl_count; i++) {
if (fd_ctx[i].xl_key) {
xl = (xlator_t *)(long)fd_ctx[i].xl_key;
if (xl->dumpops && xl->dumpops->fdctx)