summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/stripe
diff options
context:
space:
mode:
authorAlexander Bersenev <bay@hackerdom.ru>2012-05-16 13:02:06 +0600
committerAnand Avati <avati@redhat.com>2012-05-17 15:00:52 -0700
commit8c7e1cfdebc6591bbedbe2e1b98b7b3279e6519c (patch)
tree63ced708a6e4a23172149698157930b287c0b122 /xlators/cluster/stripe
parent834fa2fd36fed9b5ccd03079f780e6c5ae58f317 (diff)
Fixed a memory leak in stripe translator.
When iobuf is created it has reference count = 1. After iobref_add (local->iobref, iobuf); reference count becomes 2. After iobref_unref(local->iobref); it becomes 1 and never becomes 0. So iobuf never deletes and this causes a memory leak. I emulated it, creating files on brick manually. After 5 mins of: while true; do dd if=file of=/dev/zero bs=16384; done top showed me this: 4618 root 20 0 1721m 1.5g 1868 S 0.0 16.2 5:41.77 glusterfs 1.5 gb of memory has leaked. For what this if for? Can it be true in the normal conditions? if ((local->replies[i].op_ret < local->replies[i].requested_size) && (local->stbuf_size > (local->offset + op_ret))) { May be delete it entirely? Change-Id: I17c115ab566e5bba662dd809e0c747db3c0310c8 BUG: 822378 Signed-off-by: Alexander Bersenev <bay@hackerdom.ru> Reviewed-on: http://review.gluster.com/3340 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/stripe')
-rw-r--r--xlators/cluster/stripe/src/stripe.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index c64e8bfcb6d..a98e14e9508 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -3097,9 +3097,11 @@ stripe_readv_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto done;
}
memset (iobuf->ptr, 0, vec[count].iov_len);
- iobref_add (local->iobref, iobuf);
vec[count].iov_base = iobuf->ptr;
+ iobref_add (local->iobref, iobuf);
+ iobuf_unref(iobuf);
+
op_ret += vec[count].iov_len;
count++;
}