From 61f1a8fa322e4309989a9a5e022cad2bda55b751 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Wed, 22 Oct 2014 12:09:01 +0530 Subject: feature/changelog: Fix changelog missing SETATTR entries. Problem: Valid SETATTR entries are missing in changelog when more than one metadata operation happen on same inode within changelog roll-over time. Cause: Metadata entries with fop num being GF_FOP_NULL are logged in changelog which is of no use. Since slice version checking is done for metadata entries to avoid logging of subsequent entries of same inode falling into same changelog, if the entry with GF_FOP_NULL is logged first, subsequent valid ones will be missed. Solution: Have a boundary condition to log only those fops whose fop number falls between GF_FOP_NULL and GF_FOP_MAXVALUE. BUG: 1159213 Change-Id: I128cad323afba7d33f48df1ee5e78cb829536211 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/8964 Reviewed-by: Aravinda VK Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar Reviewed-on: http://review.gluster.org/9028 --- xlators/features/changelog/src/changelog-helpers.h | 13 +++++++++++++ xlators/features/changelog/src/changelog.c | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'xlators/features/changelog') diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h index 9bd4a3ff37c..d8f80465922 100644 --- a/xlators/features/changelog/src/changelog-helpers.h +++ b/xlators/features/changelog/src/changelog-helpers.h @@ -539,6 +539,19 @@ int __chlog_barrier_enable (xlator_t *this, changelog_priv_t *priv); goto label; \ } while (0) +/* If it is a METADATA entry and fop num being GF_FOP_NULL, don't + * log in the changelog as it is of no use. And also if it is + * logged, since slicing version checking is done for metadata + * entries, the subsequent entries with valid fop num which falls + * to same changelog will be missed. Hence check for boundary + * condition. + */ +#define CHANGELOG_OP_BOUNDARY_CHECK(frame, label) do { \ + if (frame->root->op <= GF_FOP_NULL || \ + frame->root->op >= GF_FOP_MAXVALUE) \ + goto label; \ + } while (0) + /** * ignore internal fops for all clients except AFR self-heal daemon */ diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c index 12b39f73f3c..d2e30f7f001 100644 --- a/xlators/features/changelog/src/changelog.c +++ b/xlators/features/changelog/src/changelog.c @@ -1091,6 +1091,8 @@ changelog_fsetattr (call_frame_t *frame, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, fd->inode, fd->inode->gfid, 1); if (!frame->local) @@ -1150,6 +1152,8 @@ changelog_setattr (call_frame_t *frame, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, loc->inode, loc->inode->gfid, 1); if (!frame->local) @@ -1206,6 +1210,8 @@ changelog_fremovexattr (call_frame_t *frame, xlator_t *this, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, fd->inode, fd->inode->gfid, 1); @@ -1258,6 +1264,8 @@ changelog_removexattr (call_frame_t *frame, xlator_t *this, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, loc->inode, loc->inode->gfid, 1); @@ -1313,6 +1321,8 @@ changelog_setxattr (call_frame_t *frame, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, loc->inode, loc->inode->gfid, 1); @@ -1366,6 +1376,8 @@ changelog_fsetxattr (call_frame_t *frame, priv = this->private; CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind); + CHANGELOG_OP_BOUNDARY_CHECK (frame, wind); + CHANGELOG_INIT (this, frame->local, fd->inode, fd->inode->gfid, 1); -- cgit