summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-09-30 15:41:33 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-06 23:35:03 -0700
commitea3df58fd3fffcfe6f6e703ff3358a6cf1bc0619 (patch)
treee8e2cec0ef30f396a676535ee6f77c14399e8b2e /xlators/cluster/dht
parentf8959749d26de4b13774e04ba4d01d799dc1c725 (diff)
cluster/dht: Handle 'user.ufo-test' sent by ufo in dht setxattr.
In this case, send setxattr to all the bricks to test user xattr support and return error if setxattr fails on even one of the bricks. Change-Id: I9a9b27312a650d25bbc1f57e1ab8899d63d0593d BUG: 3185 Reviewed-on: http://review.gluster.com/542 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 63e505c8c91..7cf5229aad1 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1276,6 +1276,38 @@ err:
return 0;
}
+static int
+dht_ufo_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno)
+{
+ dht_local_t *local = NULL;
+ int this_call_cnt = 0;
+ call_frame_t *prev = NULL;
+
+ local = frame->local;
+ prev = cookie;
+
+ LOCK (&frame->lock);
+ {
+ if (op_ret == -1) {
+ local->op_ret = -1;
+ local->op_errno = op_errno;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "subvolume %s returned -1 (%s)",
+ prev->this->name, strerror (op_errno));
+ goto unlock;
+ }
+ }
+unlock:
+ UNLOCK (&frame->lock);
+
+ this_call_cnt = dht_frame_return (frame);
+ if (is_last_call (this_call_cnt)) {
+ DHT_STACK_UNWIND (setxattr, frame, local->op_ret, local->op_errno);
+ }
+
+ return 0;
+}
int
@@ -1790,6 +1822,27 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
+ local->call_cnt = layout->cnt;
+
+ /* This key is sent by Unified File and Object storage
+ * to test xattr support in backend.
+ */
+ tmp = dict_get (xattr, "user.ufo-test");
+ if (tmp) {
+ if (IA_ISREG (loc->inode->ia_type)) {
+ op_errno = ENOTSUP;
+ goto err;
+ }
+ local->op_ret = 0;
+ for (i = 0; i < layout->cnt; i++) {
+ STACK_WIND (frame, dht_ufo_xattr_cbk,
+ layout->list[i].xlator,
+ layout->list[i].xlator->fops->setxattr,
+ loc, xattr, flags);
+ }
+ return 0;
+ }
+
tmp = dict_get (xattr, "distribute.migrate-data");
if (tmp) {
if (!IA_ISREG (loc->inode->ia_type)) {
@@ -1878,8 +1931,6 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->call_cnt = layout->cnt;
-
for (i = 0; i < layout->cnt; i++) {
STACK_WIND (frame, dht_err_cbk,
layout->list[i].xlator,