|
|
cb8e9e |
From fe73255f5283baec514cc7f6a31f042d34bca0fa Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Saravanakumar Arumugam <sarumuga@redhat.com>
|
|
|
cb8e9e |
Date: Tue, 9 Jun 2015 17:49:58 +0530
|
|
|
cb8e9e |
Subject: [PATCH 58/73] features/changelog: Avoid setattr fop logging during rename
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Problem:
|
|
|
cb8e9e |
When a file is renamed and the (renamed)file's Hashing
|
|
|
cb8e9e |
falls into a different brick, DHT creates a special file(linkto file)
|
|
|
cb8e9e |
in the brick(Hashed subvolume) and carries out setattr operation
|
|
|
cb8e9e |
on that file.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Currently, Changelog records this(setattr) operation in Hashed
|
|
|
cb8e9e |
subvolume. glusterfind in turn records this operation
|
|
|
cb8e9e |
as MODIFY operation.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
So, there is a NEW entry in Cached subvolume and MODIFY entry
|
|
|
cb8e9e |
in Hashed subvolume for the same file.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Solution:
|
|
|
cb8e9e |
Avoid logging setattr operation carried out, by
|
|
|
cb8e9e |
marking the operation as internal fop using xdata.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
In changelog translator, check whether setattr is set
|
|
|
cb8e9e |
as internal fop and skip accordingly.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: I21b09afb5a638b88a4ccb822442216680b7b74fd
|
|
|
cb8e9e |
BUG: 1226889
|
|
|
cb8e9e |
Reviewed-On: http://review.gluster.org/c/10984
|
|
|
cb8e9e |
Reviewed-On: http://review.gluster.org/c/11183
|
|
|
cb8e9e |
Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50535
|
|
|
cb8e9e |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/cluster/dht/src/dht-common.h | 18 ++++++++++++++++++
|
|
|
cb8e9e |
xlators/cluster/dht/src/dht-linkfile.c | 23 ++++++++++++++++-------
|
|
|
cb8e9e |
xlators/cluster/dht/src/dht-rename.c | 16 ----------------
|
|
|
cb8e9e |
xlators/features/changelog/src/changelog.c | 2 ++
|
|
|
cb8e9e |
4 files changed, 36 insertions(+), 23 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
|
|
|
cb8e9e |
index 0351819..c04e85d 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/dht/src/dht-common.h
|
|
|
cb8e9e |
+++ b/xlators/cluster/dht/src/dht-common.h
|
|
|
cb8e9e |
@@ -582,6 +582,24 @@ typedef struct dht_migrate_info {
|
|
|
cb8e9e |
} while (0)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#define is_greater_time(a, an, b, bn) (((a) < (b)) || (((a) == (b)) && ((an) < (bn))))
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+#define DHT_MARK_FOP_INTERNAL(xattr) do { \
|
|
|
cb8e9e |
+ int tmp = -1; \
|
|
|
cb8e9e |
+ if (!xattr) { \
|
|
|
cb8e9e |
+ xattr = dict_new (); \
|
|
|
cb8e9e |
+ if (!xattr) \
|
|
|
cb8e9e |
+ break; \
|
|
|
cb8e9e |
+ } \
|
|
|
cb8e9e |
+ tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \
|
|
|
cb8e9e |
+ if (tmp) { \
|
|
|
cb8e9e |
+ gf_msg (this->name, GF_LOG_ERROR, 0, \
|
|
|
cb8e9e |
+ DHT_MSG_DICT_SET_FAILED, \
|
|
|
cb8e9e |
+ "Failed to set dictionary value: key = %s," \
|
|
|
cb8e9e |
+ " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \
|
|
|
cb8e9e |
+ local->loc.path); \
|
|
|
cb8e9e |
+ } \
|
|
|
cb8e9e |
+ } while (0)
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
dht_layout_t *dht_layout_new (xlator_t *this, int cnt);
|
|
|
cb8e9e |
dht_layout_t *dht_layout_get (xlator_t *this, inode_t *inode);
|
|
|
cb8e9e |
dht_layout_t *dht_layout_for_subvol (xlator_t *this, xlator_t *subvol);
|
|
|
cb8e9e |
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
|
|
|
cb8e9e |
index 14df318..923dde0 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/dht/src/dht-linkfile.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/dht/src/dht-linkfile.c
|
|
|
cb8e9e |
@@ -312,12 +312,13 @@ dht_linkfile_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
cb8e9e |
int
|
|
|
cb8e9e |
dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
- int ret = -1;
|
|
|
cb8e9e |
- call_frame_t *copy = NULL;
|
|
|
cb8e9e |
- dht_local_t *local = NULL;
|
|
|
cb8e9e |
- dht_local_t *copy_local = NULL;
|
|
|
cb8e9e |
- xlator_t *subvol = NULL;
|
|
|
cb8e9e |
- struct iatt stbuf = {0,};
|
|
|
cb8e9e |
+ int ret = -1;
|
|
|
cb8e9e |
+ call_frame_t *copy = NULL;
|
|
|
cb8e9e |
+ dht_local_t *local = NULL;
|
|
|
cb8e9e |
+ dht_local_t *copy_local = NULL;
|
|
|
cb8e9e |
+ xlator_t *subvol = NULL;
|
|
|
cb8e9e |
+ struct iatt stbuf = {0,};
|
|
|
cb8e9e |
+ dict_t *xattr = NULL;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
local = frame->local;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -327,6 +328,8 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this)
|
|
|
cb8e9e |
if (local->stbuf.ia_type == IA_INVAL)
|
|
|
cb8e9e |
return 0;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ DHT_MARK_FOP_INTERNAL (xattr);
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
gf_uuid_copy (local->loc.gfid, local->stbuf.ia_gfid);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
copy = copy_frame (frame);
|
|
|
cb8e9e |
@@ -348,8 +351,14 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
STACK_WIND (copy, dht_linkfile_setattr_cbk, subvol,
|
|
|
cb8e9e |
subvol->fops->setattr, ©_local->loc,
|
|
|
cb8e9e |
- &stbuf, (GF_SET_ATTR_UID | GF_SET_ATTR_GID), NULL);
|
|
|
cb8e9e |
+ &stbuf, (GF_SET_ATTR_UID | GF_SET_ATTR_GID), xattr);
|
|
|
cb8e9e |
ret = 0;
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
+ if ((ret < 0) && (copy))
|
|
|
cb8e9e |
+ DHT_STACK_DESTROY (copy);
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ if (xattr)
|
|
|
cb8e9e |
+ dict_unref (xattr);
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
|
|
|
cb8e9e |
index 4e4e986..097ae9a 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/dht/src/dht-rename.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/dht/src/dht-rename.c
|
|
|
cb8e9e |
@@ -369,22 +369,6 @@ dht_rename_track_for_changelog (xlator_t *this, dict_t *xattr,
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-#define DHT_MARK_FOP_INTERNAL(xattr) do { \
|
|
|
cb8e9e |
- int tmp = -1; \
|
|
|
cb8e9e |
- if (!xattr) { \
|
|
|
cb8e9e |
- xattr = dict_new (); \
|
|
|
cb8e9e |
- if (!xattr) \
|
|
|
cb8e9e |
- break; \
|
|
|
cb8e9e |
- } \
|
|
|
cb8e9e |
- tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \
|
|
|
cb8e9e |
- if (tmp) { \
|
|
|
cb8e9e |
- gf_msg (this->name, GF_LOG_ERROR, 0, \
|
|
|
cb8e9e |
- DHT_MSG_DICT_SET_FAILED, \
|
|
|
cb8e9e |
- "Failed to set dictionary value: key = %s," \
|
|
|
cb8e9e |
- " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \
|
|
|
cb8e9e |
- local->loc.path); \
|
|
|
cb8e9e |
- } \
|
|
|
cb8e9e |
- }while (0)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#define DHT_MARKER_DONT_ACCOUNT(xattr) do { \
|
|
|
cb8e9e |
int tmp = -1; \
|
|
|
cb8e9e |
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
|
|
|
cb8e9e |
index ed58979..bea7334 100644
|
|
|
cb8e9e |
--- a/xlators/features/changelog/src/changelog.c
|
|
|
cb8e9e |
+++ b/xlators/features/changelog/src/changelog.c
|
|
|
cb8e9e |
@@ -1220,6 +1220,8 @@ changelog_setattr (call_frame_t *frame,
|
|
|
cb8e9e |
priv = this->private;
|
|
|
cb8e9e |
CHANGELOG_NOT_ACTIVE_THEN_GOTO (frame, priv, wind);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO (frame, xdata, wind);
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
CHANGELOG_OP_BOUNDARY_CHECK (frame, wind);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
CHANGELOG_INIT (this, frame->local,
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|