diff options
| -rw-r--r-- | api/src/glfs.c | 4 | ||||
| -rw-r--r-- | glusterfsd/src/glusterfsd.c | 3 | ||||
| -rw-r--r-- | libglusterfs/src/dict.c | 6 | ||||
| -rw-r--r-- | libglusterfs/src/glusterfs/dict.h | 2 | ||||
| -rw-r--r-- | libglusterfs/src/graph.c | 2 | ||||
| -rw-r--r-- | libglusterfs/src/graph.y | 2 | ||||
| -rw-r--r-- | libglusterfs/src/libglusterfs.sym | 1 | ||||
| -rw-r--r-- | libglusterfs/src/xlator.c | 1 | ||||
| -rw-r--r-- | tests/bugs/core/bug-1650403.t | 112 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 | 
10 files changed, 117 insertions, 20 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index f9d0937f2b3..b741f6e8b46 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -197,7 +197,7 @@ create_master(struct glfs *fs)      master->ctx = fs->ctx;      master->private = fs; -    master->options = get_new_dict(); +    master->options = dict_new();      if (!master->options)          goto err; @@ -1549,7 +1549,7 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_inode_get_oldpstat, 3.7.16);  struct glfs_object *  pub_glfs_upcall_lease_get_object(struct glfs_upcall_lease *arg)  { -        return arg->object; +    return arg->object;  }  GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_lease_get_object, 4.1.6); diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 42731660485..df5b9ed0b31 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -725,7 +725,7 @@ create_fuse_mount(glusterfs_ctx_t *ctx)      }      master->ctx = ctx; -    master->options = get_new_dict(); +    master->options = dict_new();      if (!master->options)          goto err; @@ -2644,7 +2644,6 @@ out:                  /* Take dict ref for every graph xlator to avoid dict leak                     at the time of graph destroying                  */ -                gluster_graph_take_reference(graph->first);                  glusterfs_graph_fini(graph);                  glusterfs_graph_destroy(graph);              } diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index 6d3ed4ba9b3..83647b0174a 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -110,12 +110,6 @@ get_new_dict_full(int size_hint)  }  dict_t * -get_new_dict(void) -{ -    return get_new_dict_full(1); -} - -dict_t *  dict_new(void)  {      dict_t *dict = get_new_dict_full(1); diff --git a/libglusterfs/src/glusterfs/dict.h b/libglusterfs/src/glusterfs/dict.h index 161362bb5cb..52b833fd559 100644 --- a/libglusterfs/src/glusterfs/dict.h +++ b/libglusterfs/src/glusterfs/dict.h @@ -270,8 +270,6 @@ int  dict_remove_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp);  dict_t *  dict_copy(dict_t *this, dict_t *new); -dict_t * -get_new_dict(void);  int  dict_keys_join(void *value, int size, dict_t *dict,                 int (*filter_fn)(char *key)); diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index 6b50cdbfddf..2dad92a5c53 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -181,7 +181,7 @@ glusterfs_graph_insert(glusterfs_graph_t *graph, glusterfs_ctx_t *ctx,      ixl->ctx = ctx;      ixl->graph = graph; -    ixl->options = get_new_dict(); +    ixl->options = dict_new();      if (!ixl->options)          goto err; diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index 80ae526d79b..5b929856c5f 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -164,7 +164,7 @@ new_volume (char *name)                  goto out;          } -        curr->options = get_new_dict (); +        curr->options = dict_new ();          if (!curr->options) {                  GF_FREE (curr->name); diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 464493d6cfc..e03cc987c81 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -547,7 +547,6 @@ get_checksum_for_path  get_file_mtime  get_host_name  get_mem_size -get_new_dict  get_path_name  get_struct_variable  get_vol_type diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 3dc0c648177..bd568660863 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -895,7 +895,6 @@ xlator_mem_free(xlator_t *xl)          return 0;      if (xl->options) { -        dict_ref(xl->options);          dict_unref(xl->options);          xl->options = NULL;      } diff --git a/tests/bugs/core/bug-1650403.t b/tests/bugs/core/bug-1650403.t new file mode 100644 index 00000000000..dadf9ddcc4c --- /dev/null +++ b/tests/bugs/core/bug-1650403.t @@ -0,0 +1,112 @@ +#!/bin/bash + +SCRIPT_TIMEOUT=500 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../traps.rc + +cleanup; + +NUM_VOLS=5 +MOUNT_BASE=$(dirname $M0) + +# GlusterD reports that bricks are started when in fact their attach requests +# might still need to be retried.  That's a bit of a hack, but there's no +# feasible way to wait at that point (in attach_brick) and the rest of the +# code is unprepared to deal with transient errors so the whole "brick start" +# would fail.  Meanwhile, glusterfsd can only handle attach requests at a +# rather slow rate.  After GlusterD tries to start a couple of hundred bricks, +# glusterfsd can fall behind and we start getting mount failures.  Arguably, +# those are spurious because we will eventually catch up.  We're just not +# ready *yet*.  More to the point, even if the errors aren't spurious that's +# not what we're testing right now.  Therefore, we give glusterfsd a bit more +# breathing room for this test than we would otherwise. +MOUNT_TIMEOUT=15 + +get_brick_base () { +	printf "%s/vol%02d" $B0 $1 +} + +get_mount_point () { +	printf "%s/vol%02d" $MOUNT_BASE $1 +} + +function count_up_bricks { +        vol=$1; +        $CLI --xml volume status $vol | grep '<status>1' | wc -l +} + +create_volume () { + +	local vol_name=$(printf "%s-vol%02d" $V0 $1) + +	local brick_base=$(get_brick_base $1) +	local cmd="$CLI volume create $vol_name replica 3" +	local b +	for b in $(seq 0 5); do +		local this_brick=${brick_base}/brick$b +		mkdir -p $this_brick +		cmd="$cmd $H0:$this_brick" +	done +	TEST $cmd +	TEST $CLI volume start $vol_name +	# check for 6 bricks and 1 shd daemon to be up and running +        EXPECT_WITHIN 120 7 count_up_bricks $vol_name +	local mount_point=$(get_mount_point $1) +	mkdir -p $mount_point +	TEST $GFS -s $H0 --volfile-id=$vol_name $mount_point +} + +cleanup_func () { +	local v +	for v in $(seq 1 $NUM_VOLS); do +		local mount_point=$(get_mount_point $v) +		force_umount $mount_point +		rm -rf $mount_point +		local vol_name=$(printf "%s-vol%02d" $V0 $v) +		$CLI volume stop $vol_name +		$CLI volume delete $vol_name +		rm -rf $(get_brick_base $1) & +	done &> /dev/null +	wait +} +push_trapfunc cleanup_func + +TEST glusterd +TEST $CLI volume set all cluster.brick-multiplex on + +# Our infrastructure can't handle an arithmetic expression here.  The formula +# is (NUM_VOLS-1)*5 because it sees each TEST/EXPECT once but needs the other +# NUM_VOLS-1 and there are 5 such statements in each iteration. +TESTS_EXPECTED_IN_LOOP=24 +for i in $(seq 1 $NUM_VOLS); do +	create_volume $i +	TEST dd if=/dev/zero of=$(get_mount_point $i)/a_file bs=4k count=1 +        # Unmounting to reduce memory footprint on regression hosts +        mnt_point=$(get_mount_point $i) +        EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $mnt_point +done + +glustershd_pid=$(cat $GLUSTERD_PIDFILEDIR/glustershd/glustershd.pid || echo -1); +start=`pmap -x $glustershd_pid | grep total | awk -F " " '{print $4}'` +echo "Memory consumption for glustershd process" +for i in $(seq 1 50); do +        pmap -x $glustershd_pid | grep total +        for j in $(seq 1 $NUM_VOLS); do +                vol_name=$(printf "%s-vol%02d" $V0 $j) +                gluster v set $vol_name cluster.self-heal-daemon off > /dev/null +                gluster v set $vol_name cluster.self-heal-daemon on  > /dev/null +        done +done + +end=`pmap -x $glustershd_pid | grep total | awk -F " " '{print $4}'` +diff=$((end-start)) + +# If memory consumption is more than 10M it means some leak in reconfigure +# code path + +TEST [ $diff -lt 10000 ] + +trap - EXIT +cleanup diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 81d559ee338..de675f22761 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -9340,15 +9340,11 @@ glusterd_check_topology_identical(const char *filename1, const char *filename2,      if (grph1 == NULL)          goto out; -    gluster_graph_take_reference(grph1->first); -      /* create the graph for filename2 */      grph2 = glusterfs_graph_construct(fp2);      if (grph2 == NULL)          goto out; -    gluster_graph_take_reference(grph2->first); -      /* compare the graph topology */      *identical = is_graph_topology_equal(grph1, grph2);      ret = 0; /* SUCCESS */  | 
