summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c180
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.h4
-rw-r--r--xlators/cluster/afr/src/afr.c1
-rw-r--r--xlators/cluster/dht/src/dht-common.c57
-rw-r--r--xlators/cluster/dht/src/dht-common.h4
-rw-r--r--xlators/cluster/dht/src/dht.c1
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c43
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h1
-rw-r--r--xlators/performance/io-threads/src/io-threads.c49
-rw-r--r--xlators/protocol/client/src/client.c33
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c84
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c94
-rw-r--r--xlators/storage/posix/src/posix.c54
13 files changed, 594 insertions, 11 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index bb8b5f0fe5a..bd7746df347 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -1893,3 +1893,183 @@ out:
return 0;
}
+
+/* ffremovexattr */
+int
+afr_fremovexattr_unwind (call_frame_t *frame, xlator_t *this)
+{
+ afr_local_t * local = NULL;
+ call_frame_t *main_frame = NULL;
+
+ local = frame->local;
+
+ LOCK (&frame->lock);
+ {
+ if (local->transaction.main_frame)
+ main_frame = local->transaction.main_frame;
+ local->transaction.main_frame = NULL;
+ }
+ UNLOCK (&frame->lock);
+
+ if (main_frame) {
+ AFR_STACK_UNWIND (fremovexattr, main_frame,
+ local->op_ret, local->op_errno)
+ }
+ return 0;
+}
+
+
+int
+afr_fremovexattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno)
+{
+ afr_local_t * local = NULL;
+ afr_private_t * priv = NULL;
+ int call_count = -1;
+ int need_unwind = 0;
+
+ local = frame->local;
+ priv = this->private;
+
+ LOCK (&frame->lock);
+ {
+ if (op_ret != -1) {
+ if (local->success_count == 0) {
+ local->op_ret = op_ret;
+ }
+ local->success_count++;
+
+ if (local->success_count == priv->wait_count) {
+ need_unwind = 1;
+ }
+ }
+
+ local->op_errno = op_errno;
+ }
+ UNLOCK (&frame->lock);
+
+ if (need_unwind)
+ local->transaction.unwind (frame, this);
+
+ call_count = afr_frame_return (frame);
+
+ if (call_count == 0) {
+ local->transaction.resume (frame, this);
+ }
+
+ return 0;
+}
+
+
+int32_t
+afr_fremovexattr_wind (call_frame_t *frame, xlator_t *this)
+{
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
+ int call_count = -1;
+ int i = 0;
+
+ local = frame->local;
+ priv = this->private;
+
+ call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
+ priv->child_count);
+
+ if (call_count == 0) {
+ local->transaction.resume (frame, this);
+ return 0;
+ }
+
+ local->call_count = call_count;
+
+ for (i = 0; i < priv->child_count; i++) {
+ if (local->transaction.pre_op[i]) {
+ STACK_WIND_COOKIE (frame, afr_fremovexattr_wind_cbk,
+ (void *) (long) i,
+ priv->children[i],
+ priv->children[i]->fops->fremovexattr,
+ local->fd,
+ local->cont.removexattr.name);
+
+ if (!--call_count)
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+int
+afr_fremovexattr_done (call_frame_t *frame, xlator_t *this)
+{
+ afr_local_t * local = frame->local;
+
+ local->transaction.unwind (frame, this);
+
+ AFR_STACK_DESTROY (frame);
+
+ return 0;
+}
+
+
+int
+afr_fremovexattr (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, const char *name)
+{
+ afr_private_t * priv = NULL;
+ afr_local_t * local = NULL;
+ call_frame_t *transaction_frame = NULL;
+ int ret = -1;
+ int op_ret = -1;
+ int op_errno = 0;
+
+ VALIDATE_OR_GOTO (frame, out);
+ VALIDATE_OR_GOTO (this, out);
+ VALIDATE_OR_GOTO (this->private, out);
+
+ priv = this->private;
+
+ QUORUM_CHECK(fremovexattr, out);
+
+ transaction_frame = copy_frame (frame);
+ if (!transaction_frame) {
+ goto out;
+ }
+
+ ALLOC_OR_GOTO (local, afr_local_t, out);
+
+ ret = afr_local_init (local, priv, &op_errno);
+ if (ret < 0) {
+ op_errno = -ret;
+ goto out;
+ }
+
+ transaction_frame->local = local;
+
+ local->op_ret = -1;
+
+ local->cont.removexattr.name = gf_strdup (name);
+
+ local->transaction.fop = afr_fremovexattr_wind;
+ local->transaction.done = afr_fremovexattr_done;
+ local->transaction.unwind = afr_fremovexattr_unwind;
+
+ local->fd = fd_ref (fd);
+
+ local->transaction.main_frame = frame;
+ local->transaction.start = LLONG_MAX - 1;
+ local->transaction.len = 0;
+
+ afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
+
+ op_ret = 0;
+out:
+ if (op_ret == -1) {
+ if (transaction_frame)
+ AFR_STACK_DESTROY (transaction_frame);
+ AFR_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno);
+ }
+
+ return 0;
+}
diff --git a/xlators/cluster/afr/src/afr-inode-write.h b/xlators/cluster/afr/src/afr-inode-write.h
index a2c3520f99f..bdd0b48669d 100644
--- a/xlators/cluster/afr/src/afr-inode-write.h
+++ b/xlators/cluster/afr/src/afr-inode-write.h
@@ -73,4 +73,8 @@ int32_t
afr_removexattr (call_frame_t *frame, xlator_t *this,
loc_t *loc, const char *name);
+int32_t
+afr_fremovexattr (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, const char *name);
+
#endif /* __INODE_WRITE_H__ */
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 22be68a65e4..efb1742ea7e 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -400,6 +400,7 @@ struct xlator_fops fops = {
.setattr = afr_setattr,
.fsetattr = afr_fsetattr,
.removexattr = afr_removexattr,
+ .fremovexattr = afr_fremovexattr,
/* dir read */
.opendir = afr_opendir,
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index a16ed7b6c50..c26ff95974d 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2311,6 +2311,63 @@ err:
return 0;
}
+int
+dht_fremovexattr (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, const char *key)
+{
+ xlator_t *subvol = NULL;
+ int op_errno = -1;
+ dht_local_t *local = NULL;
+ dht_layout_t *layout = NULL;
+ int call_cnt = 0;
+
+ int i;
+
+ VALIDATE_OR_GOTO (frame, err);
+ VALIDATE_OR_GOTO (this, err);
+
+ local = dht_local_init (frame, NULL, fd, GF_FOP_FREMOVEXATTR);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto err;
+ }
+
+ subvol = local->cached_subvol;
+ if (!subvol) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "no cached subvolume for inode=%s",
+ uuid_utoa (fd->inode->gfid));
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ layout = local->layout;
+ if (!local->layout) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "no layout for inode=%s", uuid_utoa (fd->inode->gfid));
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ local->call_cnt = call_cnt = layout->cnt;
+ local->key = gf_strdup (key);
+
+ for (i = 0; i < call_cnt; i++) {
+ STACK_WIND (frame, dht_removexattr_cbk,
+ layout->list[i].xlator,
+ layout->list[i].xlator->fops->fremovexattr,
+ fd, key);
+ }
+
+ return 0;
+
+err:
+ op_errno = (op_errno == -1) ? errno : op_errno;
+ DHT_STACK_UNWIND (fremovexattr, frame, -1, op_errno);
+
+ return 0;
+}
+
int
dht_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 8a0765b63f9..ef78892eb04 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -524,6 +524,10 @@ int32_t dht_removexattr (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
const char *name);
+int32_t dht_fremovexattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ const char *name);
int32_t dht_lk (call_frame_t *frame,
xlator_t *this,
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 8be573f5165..ca79910d30b 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -486,6 +486,7 @@ struct xlator_fops fops = {
.lk = dht_lk,
/* Inode write operations */
+ .fremovexattr = dht_fremovexattr,
.removexattr = dht_removexattr,
.setxattr = dht_setxattr,
.fsetxattr = dht_fsetxattr,
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 4aee4963761..fad62c22969 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2959,12 +2959,21 @@ fuse_listxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
void
fuse_removexattr_resume (fuse_state_t *state)
{
- gf_log ("glusterfs-fuse", GF_LOG_TRACE,
- "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s)", state->finh->unique,
- state->loc.path, state->finh->nodeid, state->name);
+ if (state->fd) {
+ gf_log ("glusterfs-fuse", GF_LOG_TRACE,
+ "%"PRIu64": REMOVEXATTR %p/%"PRIu64" (%s)", state->finh->unique,
+ state->fd, state->finh->nodeid, state->name);
+
+ FUSE_FOP (state, fuse_err_cbk, GF_FOP_FREMOVEXATTR,
+ fremovexattr, state->fd, state->name);
+ } else {
+ gf_log ("glusterfs-fuse", GF_LOG_TRACE,
+ "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s)", state->finh->unique,
+ state->loc.path, state->finh->nodeid, state->name);
- FUSE_FOP (state, fuse_err_cbk, GF_FOP_REMOVEXATTR,
- removexattr, &state->loc, state->name);
+ FUSE_FOP (state, fuse_err_cbk, GF_FOP_REMOVEXATTR,
+ removexattr, &state->loc, state->name);
+ }
}
static void
@@ -2982,17 +2991,27 @@ fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
GET_STATE (this, finh, state);
ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL);
- if ((state->loc.inode == NULL) ||
- (ret < 0)) {
+ if (!state->loc.inode) {
gf_log ("glusterfs-fuse", GF_LOG_DEBUG,
- "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s) (fuse_loc_fill() failed)",
- finh->unique, state->loc.path, finh->nodeid, name);
+ "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s) "
+ "(fuse_loc_fill() failed (%d))",
+ finh->unique, state->loc.path, finh->nodeid, name, ret);
send_fuse_err (this, finh, ENOENT);
free_fuse_state (state);
return;
}
+ state->fd = fd_lookup (state->loc.inode, state->finh->pid);
+ if (!state->fd) {
+ gf_log ("glusterfs-fuse", GF_LOG_WARNING,
+ "%"PRIu64": REMOVEXATTR %"PRIu64" (fuse_loc_fill() failed)",
+ state->finh->unique, state->finh->nodeid);
+ send_fuse_err (state->this, state->finh, ENOENT);
+ free_fuse_state (state);
+ return;
+ }
+
ret = fuse_flip_xattr_ns (priv, name, &newkey);
if (ret) {
send_fuse_err (this, finh, ENOMEM);
@@ -3001,8 +3020,10 @@ fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
}
state->name = newkey;
- uuid_copy (state->resolve.gfid, state->loc.inode->gfid);
- state->resolve.path = gf_strdup (state->loc.path);
+ if (!state->fd) {
+ uuid_copy (state->resolve.gfid, state->loc.inode->gfid);
+ state->resolve.path = gf_strdup (state->loc.path);
+ }
fuse_resolve_and_resume (state, fuse_removexattr_resume);
return;
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index ae764a7bccc..4d80af57412 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -317,4 +317,5 @@ int fuse_flip_user_to_trusted (char *okey, char **nkey);
int fuse_xattr_alloc_default (char *okey, char **nkey);
fuse_fd_ctx_t * __fuse_fd_ctx_check_n_create (fd_t *fd, xlator_t *this);
fuse_fd_ctx_t * fuse_fd_ctx_check_n_create (fd_t *fd, xlator_t *this);
+
#endif /* _GF_FUSE_BRIDGE_H_ */
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index e4077478182..2402f86d9f6 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -240,6 +240,7 @@ iot_schedule (call_frame_t *frame, xlator_t *this, call_stub_t *stub)
case GF_FOP_FGETXATTR:
case GF_FOP_FSETXATTR:
case GF_FOP_REMOVEXATTR:
+ case GF_FOP_FREMOVEXATTR:
pri = IOT_PRI_NORMAL;
break;
@@ -1828,6 +1829,53 @@ out:
return 0;
}
+int
+iot_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno)
+{
+ STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno);
+ return 0;
+}
+
+
+int
+iot_fremovexattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name)
+{
+ STACK_WIND (frame, iot_fremovexattr_cbk, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->fremovexattr, fd, name);
+ return 0;
+}
+
+
+int
+iot_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name)
+{
+ call_stub_t *stub = NULL;
+ int ret = -1;
+
+ stub = fop_fremovexattr_stub (frame, iot_fremovexattr_wrapper, fd,
+ name);
+ if (!stub) {
+ gf_log (this->name, GF_LOG_ERROR,"cannot get fremovexattr fop"
+ "(out of memory)");
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ ret = iot_schedule (frame, this, stub);
+out:
+ if (ret < 0) {
+ STACK_UNWIND_STRICT (fremovexattr, frame, -1, -ret);
+
+ if (stub != NULL) {
+ call_stub_destroy (stub);
+ }
+ }
+ return 0;
+}
+
int
iot_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -2512,6 +2560,7 @@ struct xlator_fops fops = {
.fgetxattr = iot_fgetxattr,
.fsetxattr = iot_fsetxattr,
.removexattr = iot_removexattr,
+ .fremovexattr = iot_fremovexattr,
.readdir = iot_readdir,
.readdirp = iot_readdirp,
.inodelk = iot_inodelk,
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 8e823bec4e8..5f11987034d 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1421,6 +1421,38 @@ out:
return 0;
}
+int32_t
+client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name)
+{
+ int ret = -1;
+ clnt_conf_t *conf = NULL;
+ rpc_clnt_procedure_t *proc = NULL;
+ clnt_args_t args = {0,};
+
+ conf = this->private;
+ if (!conf || !conf->fops)
+ goto out;
+
+ args.name = name;
+ args.fd = fd;
+
+ proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR];
+ if (!proc) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "rpc procedure not found for %s",
+ gf_fop_list[GF_FOP_FREMOVEXATTR]);
+ goto out;
+ }
+ if (proc->fn)
+ ret = proc->fn (frame, this, &args);
+out:
+ if (ret)
+ STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN);
+
+ return 0;
+}
+
int32_t
client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
@@ -2303,6 +2335,7 @@ struct xlator_fops fops = {
.fsetxattr = client_fsetxattr,
.fgetxattr = client_fgetxattr,
.removexattr = client_removexattr,
+ .fremovexattr = client_fremovexattr,
.opendir = client_opendir,
.readdir = client_readdir,
.readdirp = client_readdirp,
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index d34ffc20031..0a89127b9a7 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -1040,6 +1040,44 @@ out:
}
int
+client3_1_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
+ void *myframe)
+{
+ call_frame_t *frame = NULL;
+ gf_common_rsp rsp = {0,};
+ int ret = 0;
+ xlator_t *this = NULL;
+
+ this = THIS;
+
+ frame = myframe;
+
+ if (-1 == req->rpc_status) {
+ rsp.op_ret = -1;
+ rsp.op_errno = ENOTCONN;
+ goto out;
+ }
+
+ ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+ rsp.op_ret = -1;
+ rsp.op_errno = EINVAL;
+ goto out;
+ }
+
+out:
+ if (rsp.op_ret == -1) {
+ gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+ strerror (gf_error_to_errno (rsp.op_errno)));
+ }
+ STACK_UNWIND_STRICT (fremovexattr, frame, rsp.op_ret,
+ gf_error_to_errno (rsp.op_errno));
+
+ return 0;
+}
+
+int
client3_1_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
void *myframe)
{
@@ -4582,6 +4620,50 @@ unwind:
return 0;
}
+int32_t
+client3_1_fremovexattr (call_frame_t *frame, xlator_t *this,
+ void *data)
+{
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_fremovexattr_req req = {{0,},};
+ int ret = 0;
+ int64_t remote_fd = -1;
+ int op_errno = ESTALE;
+
+ if (!frame || !this || !data)
+ goto unwind;
+
+ args = data;
+
+ if (!(args->fd && args->fd->inode))
+ goto unwind;
+
+ CLIENT_GET_REMOTE_FD(conf, args->fd, remote_fd, unwind);
+
+ memcpy (req.gfid, args->fd->inode->gfid, 16);
+ req.name = (char *)args->name;
+ req.fd = remote_fd;
+
+ conf = this->private;
+
+ ret = client_submit_request (this, &req, frame, conf->fops,
+ GFS3_OP_FREMOVEXATTR,
+ client3_1_fremovexattr_cbk, NULL,
+ NULL, 0, NULL, 0, NULL,
+ (xdrproc_t)xdr_gfs3_fremovexattr_req);
+ if (ret) {
+ op_errno = ENOTCONN;
+ goto unwind;
+ }
+
+ return 0;
+unwind:
+ gf_log (this->name, GF_LOG_WARNING, "failed to send the fop: %s", strerror (op_errno));
+ STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno);
+ return 0;
+}
+
int32_t
client3_1_lk (call_frame_t *frame, xlator_t *this,
@@ -5308,6 +5390,7 @@ rpc_clnt_procedure_t clnt3_1_fop_actors[GF_FOP_MAXVALUE] = {
[GF_FOP_RELEASE] = { "RELEASE", client3_1_release },
[GF_FOP_RELEASEDIR] = { "RELEASEDIR", client3_1_releasedir },
[GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec },
+ [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client3_1_fremovexattr },
};
/* Used From RPC-CLNT library to log proper name of procedure based on number */
@@ -5355,6 +5438,7 @@ char *clnt3_1_fop_names[GFS3_OP_MAXVALUE] = {
[GFS3_OP_READDIRP] = "READDIRP",
[GFS3_OP_RELEASE] = "RELEASE",
[GFS3_OP_RELEASEDIR] = "RELEASEDIR",
+ [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR",
};
rpc_clnt_prog_t clnt3_1_fop_prog = {
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 482c242d5ce..79aede07461 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -692,6 +692,33 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
int
+server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno)
+{
+ gf_common_rsp rsp = {0,};
+ rpcsvc_request_t *req = NULL;
+ server_state_t *state = NULL;
+
+ req = frame->local;
+ state = CALL_STATE(frame);
+
+ rsp.op_ret = op_ret;
+ rsp.op_errno = gf_errno_to_error (op_errno);
+ if (op_ret == -1)
+ gf_log (this->name, GF_LOG_INFO,
+ "%"PRId64": FREMOVEXATTR (%s) ==> %"PRId32" (%s)",
+ frame->root->unique, ((state->fd->inode) ?
+ uuid_utoa (state->fd->inode->gfid) :
+ "--"),
+ op_ret, strerror (op_errno));
+
+ server_submit_reply (frame, req, &rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_common_rsp);
+
+ return 0;
+}
+
+int
server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict)
{
@@ -2211,6 +2238,26 @@ err:
}
int
+server_fremovexattr_resume (call_frame_t *frame, xlator_t *bound_xl)
+{
+ server_state_t *state = NULL;
+
+ state = CALL_STATE (frame);
+
+ if (state->resolve.op_ret != 0)
+ goto err;
+
+ STACK_WIND (frame, server_fremovexattr_cbk,
+ bound_xl, bound_xl->fops->fremovexattr,
+ state->fd, state->name);
+ return 0;
+err:
+ server_fremovexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret,
+ state->resolve.op_errno);
+ return 0;
+}
+
+int
server_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl)
{
server_state_t *state = NULL;
@@ -3932,6 +3979,52 @@ out:
return ret;
}
+int
+server_fremovexattr (rpcsvc_request_t *req)
+{
+ server_state_t *state = NULL;
+ call_frame_t *frame = NULL;
+ gfs3_fremovexattr_req args = {{0,},};
+ int ret = -1;
+
+ if (!req)
+ return ret;
+
+ args.name = alloca (4096);
+
+ if (!xdr_to_generic (req->msg[0], &args,
+ (xdrproc_t)xdr_gfs3_fremovexattr_req)) {
+ //failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ frame = get_frame_from_request (req);
+ if (!frame) {
+ // something wrong, mostly insufficient memory
+ req->rpc_err = GARBAGE_ARGS; /* TODO */
+ goto out;
+ }
+ frame->root->op = GF_FOP_FREMOVEXATTR;
+
+ state = CALL_STATE (frame);
+ if (!state->conn->bound_xl) {
+ /* auth failure, request on subvolume without setvolume */
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = args.fd;
+ memcpy (state->resolve.gfid, args.gfid, 16);
+ state->name = gf_strdup (args.name);
+
+ ret = 0;
+ resolve_and_resume (frame, server_fremovexattr_resume);
+out:
+ return ret;
+}
+
@@ -5223,6 +5316,7 @@ rpcsvc_actor_t glusterfs3_1_fop_actors[] = {
[GFS3_OP_READDIRP] = { "READDIRP", GFS3_OP_READDIRP, server_readdirp, NULL, NULL, 0},
[GFS3_OP_RELEASE] = { "RELEASE", GFS3_OP_RELEASE, server_release, NULL, NULL, 0},
[GFS3_OP_RELEASEDIR] = { "RELEASEDIR", GFS3_OP_RELEASEDIR, server_releasedir, NULL, NULL, 0},
+ [GFS3_OP_FREMOVEXATTR] = { "FREMOVEXATTR", GFS3_OP_FREMOVEXATTR, server_fremovexattr, NULL, NULL, 0},
};
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index f895aec2b06..5cfdbd4f5ee 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -2786,6 +2786,59 @@ out:
return 0;
}
+int32_t
+posix_fremovexattr (call_frame_t *frame, xlator_t *this,
+ fd_t *fd, const char *name)
+{
+ int32_t op_ret = -1;
+ int32_t op_errno = 0;
+ struct posix_fd * pfd = NULL;
+ int _fd = -1;
+ uint64_t tmp_pfd = 0;
+ int ret = -1;
+
+ DECLARE_OLD_FS_ID_VAR;
+
+ if (!strcmp (GFID_XATTR_KEY, name)) {
+ gf_log (this->name, GF_LOG_WARNING, "Remove xattr called"
+ " on gfid for file");
+ goto out;
+ }
+
+ ret = fd_ctx_get (fd, this, &tmp_pfd);
+ if (ret < 0) {
+ op_errno = -ret;
+ gf_log (this->name, GF_LOG_WARNING,
+ "pfd is NULL from fd=%p", fd);
+ goto out;
+ }
+ pfd = (struct posix_fd *)(long)tmp_pfd;
+
+ _fd = pfd->fd;
+
+
+
+ SET_FS_ID (frame->root->uid, frame->root->gid);
+
+ op_ret = sys_fremovexattr (_fd, name);
+ if (op_ret == -1) {
+ op_errno = errno;
+ if (op_errno != ENOATTR && op_errno != EPERM)
+ gf_log (this->name, GF_LOG_ERROR,
+ "fremovexattr (for %s): %s",
+ name, strerror (op_errno));
+ goto out;
+ }
+
+ op_ret = 0;
+
+out:
+ SET_TO_OLD_FS_ID ();
+
+ STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno);
+ return 0;
+}
+
int32_t
posix_fsyncdir (call_frame_t *frame, xlator_t *this,
@@ -4037,6 +4090,7 @@ struct xlator_fops fops = {
.getxattr = posix_getxattr,
.fgetxattr = posix_fgetxattr,
.removexattr = posix_removexattr,
+ .fremovexattr = posix_fremovexattr,
.fsyncdir = posix_fsyncdir,
.access = posix_access,
.ftruncate = posix_ftruncate,