summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2012-04-30 16:18:50 +0530
committerVijay Bellur <vijay@gluster.com>2012-05-01 10:20:42 -0700
commitd09a5beae2d26803b67ab8f3de6862044a8a758c (patch)
tree771003f15ba0f346b35913bb2dd8254b1b9c3aa6
parent67ceb347c83e3b994791feb58fc607475fa1177e (diff)
libglusterfs/fd: use reallocated memory for intializing new graphs contexts
While setting fd_ctx, if we have to scale the fd contexts, then we get the xl_count of the new graph and reallocate the memory for contexts so that it is suffecient for contexts of xlators of both new as well as old graph, and then initialize the new graph xlator contexts. For that we are considering the old pointer itself, instead of using newly reallocated pointer. Change-Id: I32c18cd69c03c771b4a63e5186c65ae658e54e92 BUG: 817461 Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Reviewed-on: http://review.gluster.com/3250 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--libglusterfs/src/fd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 08e55b724..a4d3b08de 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -811,7 +811,6 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
new_xl_count = fd->xl_count + xlator->graph->xl_count;
- begin = fd->_ctx;
tmp = GF_REALLOC (fd->_ctx,
(sizeof (struct _fd_ctx)
* new_xl_count));
@@ -826,6 +825,7 @@ __fd_ctx_set (fd_t *fd, xlator_t *xlator, uint64_t value)
fd->_ctx = tmp;
+ begin = fd->_ctx;
begin += (fd->xl_count * sizeof (struct _fd_ctx));
diff = (new_xl_count - fd->xl_count )