From d0962cccbb5e5239d2993e7c0dadfd97524f81f9 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Mon, 8 May 2017 21:10:50 +0530
Subject: [PATCH 447/473] features/changelog: Add xattr as special type in
changelog entry
When both SETATTR and SETXATTR fops are happening on gfid within the
rollover time then, SETXATTR were not logged.
In Which case we will miss the xattr fop in slave.
This patch will be fix the same
Backport of>
>Change-Id: Ia75538ad1fd2797dbcf90d20dfa89f756009243d
>BUG: 1448914
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
>Reviewed-on: https://review.gluster.org/17205
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Kotresh HR <khiremat@redhat.com>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
Change-Id: Ia75538ad1fd2797dbcf90d20dfa89f756009243d
BUG: 1426952
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/106337
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/features/changelog/src/changelog-misc.h | 7 ++++---
xlators/features/changelog/src/changelog.c | 17 +++++++++--------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/xlators/features/changelog/src/changelog-misc.h b/xlators/features/changelog/src/changelog-misc.h
index 778f79c..94d6c50 100644
--- a/xlators/features/changelog/src/changelog-misc.h
+++ b/xlators/features/changelog/src/changelog-misc.h
@@ -14,7 +14,7 @@
#include "glusterfs.h"
#include "common-utils.h"
-#define CHANGELOG_MAX_TYPE 3
+#define CHANGELOG_MAX_TYPE 4
#define CHANGELOG_FILE_NAME "CHANGELOG"
#define HTIME_FILE_NAME "HTIME"
#define CSNAP_FILE_NAME "CHANGELOG.SNAP"
@@ -95,14 +95,15 @@
strcat (path, "/csnap"); \
} while(0)
/**
- * everything after 'CHANGELOG_TYPE_ENTRY' are internal types
+ * everything after 'CHANGELOG_TYPE_METADATA_XATTR' are internal types
* (ie. none of the fops trigger this type of event), hence
- * CHANGELOG_MAX_TYPE = 3
+ * CHANGELOG_MAX_TYPE = 4
*/
typedef enum {
CHANGELOG_TYPE_DATA = 0,
CHANGELOG_TYPE_METADATA,
CHANGELOG_TYPE_ENTRY,
+ CHANGELOG_TYPE_METADATA_XATTR,
CHANGELOG_TYPE_ROLLOVER,
CHANGELOG_TYPE_FSYNC,
} changelog_log_type;
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index dddeb45..e74da78 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -1300,7 +1300,7 @@ changelog_fremovexattr_cbk (call_frame_t *frame,
CHANGELOG_COND_GOTO (priv, ((op_ret < 0) || !local), unwind);
- changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA);
+ changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA_XATTR);
unwind:
changelog_dec_fop_cnt (this, priv, local);
@@ -1354,7 +1354,7 @@ changelog_removexattr_cbk (call_frame_t *frame,
CHANGELOG_COND_GOTO (priv, ((op_ret < 0) || !local), unwind);
- changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA);
+ changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA_XATTR);
unwind:
changelog_dec_fop_cnt (this, priv, local);
@@ -1410,7 +1410,7 @@ changelog_setxattr_cbk (call_frame_t *frame,
CHANGELOG_COND_GOTO (priv, ((op_ret < 0) || !local), unwind);
- changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA);
+ changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA_XATTR);
unwind:
changelog_dec_fop_cnt (this, priv, local);
@@ -1531,7 +1531,7 @@ changelog_fsetxattr_cbk (call_frame_t *frame,
CHANGELOG_COND_GOTO (priv, ((op_ret < 0) || !local), unwind);
- changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA);
+ changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA_XATTR);
unwind:
changelog_dec_fop_cnt (this, priv, local);
@@ -1646,7 +1646,7 @@ changelog_fxattrop_cbk (call_frame_t *frame,
CHANGELOG_COND_GOTO (priv, ((op_ret < 0) || !local), unwind);
- changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA);
+ changelog_update (this, priv, local, CHANGELOG_TYPE_METADATA_XATTR);
unwind:
changelog_dec_fop_cnt (this, priv, local);
@@ -2340,9 +2340,10 @@ changelog_init (xlator_t *this, changelog_priv_t *priv)
priv->slice.tv_start = tv;
- priv->maps[CHANGELOG_TYPE_DATA] = "D ";
- priv->maps[CHANGELOG_TYPE_METADATA] = "M ";
- priv->maps[CHANGELOG_TYPE_ENTRY] = "E ";
+ priv->maps[CHANGELOG_TYPE_DATA] = "D ";
+ priv->maps[CHANGELOG_TYPE_METADATA] = "M ";
+ priv->maps[CHANGELOG_TYPE_METADATA_XATTR] = "M ";
+ priv->maps[CHANGELOG_TYPE_ENTRY] = "E ";
for (; i < CHANGELOG_MAX_TYPE; i++) {
/* start with version 1 */
--
1.8.3.1