summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2013-07-22 19:14:56 +0530
committerVijay Bellur <vbellur@redhat.com>2013-07-23 00:26:36 -0700
commitfa787929ba37e483ad041e090a82c14e3b7de900 (patch)
tree9283292bf0948a9feeb04eefe3dc3d3356bebd43
parent950371be29d029179ac5cd0ad2dfdbfcd4467b96 (diff)
glusterfsd: Use dynamic volfile buffer
Glusterfsd used a fixed buffer to store volfiles fetched via getspec. This caused problems with large volfiles. Changining this to a dynamic buffer allows large volfiles to be loaded in memory. Change-Id: I40236dcb1c37b9a0136dfb5231cafabb3d4f00dc BUG: 986100 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/5373 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index f91cdc46ebe..4d9ddafea49 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1327,7 +1327,7 @@ out:
/* XXX: move these into @ctx */
-static char oldvolfile[131072];
+static char *oldvolfile = NULL;
static int oldvollen = 0;
static int
@@ -1522,6 +1522,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
int ret = 0;
ssize_t size = 0;
FILE *tmpfp = NULL;
+ char *volfilebuf = NULL;
frame = myframe;
ctx = frame->this->ctx;
@@ -1579,6 +1580,15 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (ret == 0) {
gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG,
"No need to re-load volfile, reconfigure done");
+ if (oldvolfile)
+ volfilebuf = GF_REALLOC (oldvolfile, size);
+ else
+ volfilebuf = GF_CALLOC (1, size, gf_common_mt_char);
+ if (!volfilebuf) {
+ ret = -1;
+ goto out;
+ }
+ oldvolfile = volfilebuf;
oldvollen = size;
memcpy (oldvolfile, rsp.spec, size);
goto out;
@@ -1595,6 +1605,15 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (ret)
goto out;
+ if (oldvolfile)
+ volfilebuf = GF_REALLOC (oldvolfile, size);
+ else
+ volfilebuf = GF_CALLOC (1, size, gf_common_mt_char);
+ if (!volfilebuf) {
+ ret = -1;
+ goto out;
+ }
+ oldvolfile = volfilebuf;
oldvollen = size;
memcpy (oldvolfile, rsp.spec, size);
if (!is_mgmt_rpc_reconnect) {
href='/cgit/glusterfs.git/tree/README.md?h=v5.0rc0&id=2db7872d5251d98d47c262ff269776bfae2d4fb9'>README.md920logstatsplain -rw-r--r--THANKS90logstatsplain d---------api104logstatsplain -rwxr-xr-xautogen.sh2003logstatsplain d---------build-aux168logstatsplain d---------cli69logstatsplain -rw-r--r--configure.ac58237logstatsplain d---------contrib634logstatsplain d---------doc388logstatsplain d---------events144logstatsplain d---------extras2556logstatsplain d---------geo-replication340logstatsplain -rw-r--r--glusterfs-api.pc.in403logstatsplain -rw-r--r--glusterfs.spec.in77331logstatsplain d---------glusterfsd69logstatsplain d---------heal69logstatsplain -rw-r--r--libgfchangelog.pc.in329logstatsplain -rw-r--r--libgfdb.pc.in267logstatsplain d---------libglusterfs69logstatsplain -rwxr-xr-xrfc.sh9980logstatsplain d---------rpc143logstatsplain -rwxr-xr-xrun-tests-in-vagrant.sh7596logstatsplain -rwxr-xr-xrun-tests.sh12155logstatsplain -rw-r--r--site.h.in1012logstatsplain d---------tests1125logstatsplain d---------tools162logstatsplain d---------xlators585logstatsplain