summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-02-18 02:55:38 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-18 23:32:32 -0800
commitbf767b85e3e92ec4bad52c6af141299d2afa4480 (patch)
treec368a82692d71e757c327ef8e49658109c9fb0b1 /xlators/cluster/dht
parent069d7765898ef6f8d1334b23bf8ed9aee017b47a (diff)
cluster/dht : implement a fsetxattr() command
Thanks to Jeff Darcy <jdarcy(at)redhat.com> for the patch Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2319 (DHT uses wrong subvolume for fsetxattr) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2319
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c44
-rw-r--r--xlators/cluster/dht/src/dht.c1
2 files changed, 45 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 37ec5c4123b..14316b37071 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2066,6 +2066,50 @@ err:
return 0;
}
+int
+dht_fsetxattr (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, dict_t *xattr, int flags)
+{
+ xlator_t *subvol = NULL;
+ dht_local_t *local = NULL;
+ int op_errno = EINVAL;
+
+ VALIDATE_OR_GOTO (frame, err);
+ VALIDATE_OR_GOTO (this, err);
+ VALIDATE_OR_GOTO (fd, err);
+ VALIDATE_OR_GOTO (fd->inode, err);
+
+ subvol = dht_subvol_get_cached (this, fd->inode);
+ if (!subvol) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "no cached subvolume for fd=%p", fd);
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ local = dht_local_init (frame);
+ if (!local) {
+ op_errno = ENOMEM;
+ gf_log (this->name, GF_LOG_ERROR,
+ "Out of memory");
+ goto err;
+ }
+
+ local->inode = inode_ref (fd->inode);
+ local->call_cnt = 1;
+
+ STACK_WIND (frame, dht_err_cbk, subvol, subvol->fops->fsetxattr,
+ fd, xattr, flags);
+
+ return 0;
+
+err:
+ op_errno = (op_errno == -1) ? errno : op_errno;
+ DHT_STACK_UNWIND (fsetxattr, frame, -1, op_errno);
+
+ return 0;
+}
+
int
dht_setxattr (call_frame_t *frame, xlator_t *this,
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 93d01f13a54..3f81ba75509 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -491,6 +491,7 @@ struct xlator_fops fops = {
.access = dht_access,
.readlink = dht_readlink,
.setxattr = dht_setxattr,
+ .fsetxattr = dht_fsetxattr,
.getxattr = dht_getxattr,
.removexattr = dht_removexattr,
.open = dht_open,