From c4166b86203562b6383ddfa160bb7d925af8b72c Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Thu, 18 Aug 2011 00:12:25 +0530 Subject: features/marker: Correct behavior of local_ref/unref Change-Id: I8266754d4b53b525b13fed2383cf95d77bab47ba BUG: 3429 Reviewed-on: http://review.gluster.com/252 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/marker/src/marker-quota-helper.c | 2 ++ xlators/features/marker/src/marker-quota.c | 8 ++------ xlators/features/marker/src/marker-quota.h | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'xlators') diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c index 2d5b234d1a8..778f0a72104 100644 --- a/xlators/features/marker/src/marker-quota-helper.c +++ b/xlators/features/marker/src/marker-quota-helper.c @@ -374,6 +374,8 @@ quota_local_unref (xlator_t *this, quota_local_t *local) loc_wipe (&local->parent_loc); LOCK_DESTROY (&local->lock); + + GF_FREE (local); out: return 0; } diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 3e9a6890a6a..ac59032cad9 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -535,7 +535,7 @@ quota_readdir_cbk (call_frame_t *frame, goto out; } - newframe->local = local; + newframe->local = quota_local_ref (local); dict = dict_new (); if (!dict) { @@ -2092,9 +2092,7 @@ quota_inode_remove_done (call_frame_t *frame, void *cookie, xlator_t *this, start_quota_txn (this, &local->loc, local->ctx, local->contri); } - /* TODO: free local in quota_local_unref only*/ quota_local_unref (this, local); - GF_FREE (local); return 0; } @@ -2286,10 +2284,8 @@ reduce_parent_size (xlator_t *this, loc_t *loc, int64_t contri) ret = 0; out: - if (local != NULL) { + if (local != NULL) quota_local_unref (this, local); - GF_FREE (local); - } return ret; } diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h index dfb916bcf6e..b8bf12ce772 100644 --- a/xlators/features/marker/src/marker-quota.h +++ b/xlators/features/marker/src/marker-quota.h @@ -42,7 +42,6 @@ _frame->local = NULL; \ STACK_DESTROY (_frame->root); \ quota_local_unref (_this, _local); \ - GF_FREE (_local); \ } while (0) -- cgit