From acbf2d5dd4782c4236373237d73980163936d17c Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 14 Jun 2011 23:54:47 +0000 Subject: features/marker: fixes in dirty inode self-heal codepath. - fix fd-leak of fd opened on the directory. - don't add (instead just assign) next offset at which readdir has to be sent to local->d_off. - assign to local->d_off before winding lookup call to get child contribution. Signed-off-by: Raghavendra G Signed-off-by: Anand Avati BUG: 2697 (Quota: add-brick creates the size go awkward, though it was perfect earlier) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2697 --- xlators/features/marker/src/marker-quota.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'xlators/features/marker') diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index 355ea1d10fe..fdcd22bc79d 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -426,6 +426,8 @@ quota_readdir_cbk (call_frame_t *frame, entry->d_name); continue; } + + offset = entry->d_off; count++; } @@ -435,6 +437,7 @@ quota_readdir_cbk (call_frame_t *frame, LOCK (&local->lock); { local->dentry_child_count = count; + local->d_off = offset; } UNLOCK (&local->lock); } @@ -447,7 +450,6 @@ quota_readdir_cbk (call_frame_t *frame, ".."))) { gf_log (this->name, GF_LOG_DEBUG, "entry = %s", entry->d_name); - offset = entry->d_off; continue; } @@ -513,17 +515,12 @@ quota_readdir_cbk (call_frame_t *frame, break; } } - gf_log (this->name, GF_LOG_DEBUG, "offset before =%"PRIu64, - local->d_off); - local->d_off +=offset; - gf_log (this->name, GF_LOG_DEBUG, "offset after = %"PRIu64, - local->d_off); - if (ret) + if (ret) { release_lock_on_dirty_inode (frame, NULL, this, 0, 0); - - else if (count == 0 ) + } else if (count == 0 ) { get_dirty_inode_size (frame, this); + } return 0; } @@ -619,6 +616,10 @@ err: release_lock_on_dirty_inode (frame, NULL, this, 0, 0); } + if (fd != NULL) { + fd_unref (fd); + } + return 0; } -- cgit