summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-01-17 05:57:24 +0530
committerAnand Avati <avati@gluster.com>2012-01-25 02:24:20 -0800
commitd7ecaaa1ed0f88869812ea17cb64a102a74c8c1c (patch)
tree4293106362bf9dec2e6260a4062239a9b7340cc0
parent6c54022f1b1c7f5f458f6a7e783203d11e7f89b5 (diff)
core: add 'fremovexattr()' fop
so operations can be done on fd for extended attribute removal Change-Id: Ie026f1b53793aeb4ae33e96ea5408c7a97f34bf6 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 766571 Reviewed-on: http://review.gluster.com/778 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r--libglusterfs/src/call-stub.c76
-rw-r--r--libglusterfs/src/call-stub.h26
-rw-r--r--libglusterfs/src/defaults.c27
-rw-r--r--libglusterfs/src/defaults.h14
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--libglusterfs/src/syncop.c28
-rw-r--r--libglusterfs/src/syncop.h1
-rw-r--r--libglusterfs/src/syscall.c26
-rw-r--r--libglusterfs/src/syscall.h3
-rw-r--r--libglusterfs/src/xlator.c1
-rw-r--r--libglusterfs/src/xlator.h13
-rw-r--r--rpc/rpc-lib/src/protocol-common.h3
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.c15
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.h9
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.x6
-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
28 files changed, 842 insertions, 12 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 8b28dc9bec6..24ca3825b0d 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -1463,6 +1463,48 @@ out:
return stub;
}
+call_stub_t *
+fop_fremovexattr_stub (call_frame_t *frame,
+ fop_fremovexattr_t fn,
+ fd_t *fd,
+ const char *name)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", fd, out);
+ GF_VALIDATE_OR_GOTO ("call-stub", name, out);
+
+ stub = stub_new (frame, 1, GF_FOP_FREMOVEXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fremovexattr.fn = fn;
+ stub->args.fremovexattr.fd = fd_ref (fd);
+ stub->args.fremovexattr.name = gf_strdup (name);
+out:
+ return stub;
+}
+
+
+call_stub_t *
+fop_fremovexattr_cbk_stub (call_frame_t *frame,
+ fop_fremovexattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno)
+{
+ call_stub_t *stub = NULL;
+
+ GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
+
+ stub = stub_new (frame, 0, GF_FOP_FREMOVEXATTR);
+ GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ stub->args.fremovexattr_cbk.fn = fn;
+ stub->args.fremovexattr_cbk.op_ret = op_ret;
+ stub->args.fremovexattr_cbk.op_errno = op_errno;
+out:
+ return stub;
+}
call_stub_t *
fop_lk_stub (call_frame_t *frame,
@@ -2303,6 +2345,15 @@ call_resume_wind (call_stub_t *stub)
break;
}
+ case GF_FOP_FREMOVEXATTR:
+ {
+ stub->args.fremovexattr.fn (stub->frame,
+ stub->frame->this,
+ stub->args.fremovexattr.fd,
+ stub->args.fremovexattr.name);
+ break;
+ }
+
case GF_FOP_OPENDIR:
{
stub->args.opendir.fn (stub->frame,
@@ -2939,6 +2990,22 @@ call_resume_unwind (call_stub_t *stub)
break;
}
+ case GF_FOP_FREMOVEXATTR:
+ {
+ if (!stub->args.fremovexattr_cbk.fn)
+ STACK_UNWIND (stub->frame,
+ stub->args.fremovexattr_cbk.op_ret,
+ stub->args.fremovexattr_cbk.op_errno);
+ else
+ stub->args.fremovexattr_cbk.fn (stub->frame,
+ stub->frame->cookie,
+ stub->frame->this,
+ stub->args.fremovexattr_cbk.op_ret,
+ stub->args.fremovexattr_cbk.op_errno);
+
+ break;
+ }
+
case GF_FOP_OPENDIR:
{
if (!stub->args.opendir_cbk.fn)
@@ -3454,6 +3521,13 @@ call_stub_destroy_wind (call_stub_t *stub)
break;
}
+ case GF_FOP_FREMOVEXATTR:
+ {
+ fd_unref (stub->args.fremovexattr.fd);
+ GF_FREE ((char *)stub->args.fremovexattr.name);
+ break;
+ }
+
case GF_FOP_OPENDIR:
{
loc_wipe (&stub->args.opendir.loc);
@@ -3718,6 +3792,8 @@ call_stub_destroy_unwind (call_stub_t *stub)
case GF_FOP_REMOVEXATTR:
break;
+ case GF_FOP_FREMOVEXATTR:
+ break;
case GF_FOP_OPENDIR:
{
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index 4b03dbfe209..5e6c0a1d385 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -412,6 +412,18 @@ typedef struct {
int32_t op_ret, op_errno;
} removexattr_cbk;
+
+ /* fremovexattr */
+ struct {
+ fop_fremovexattr_t fn;
+ fd_t *fd;
+ const char *name;
+ } fremovexattr;
+ struct {
+ fop_fremovexattr_cbk_t fn;
+ int32_t op_ret, op_errno;
+ } fremovexattr_cbk;
+
/* lk */
struct {
fop_lk_t fn;
@@ -964,6 +976,20 @@ fop_removexattr_cbk_stub (call_frame_t *frame,
fop_removexattr_cbk_t fn,
int32_t op_ret,
int32_t op_errno);
+
+
+call_stub_t *
+fop_fremovexattr_stub (call_frame_t *frame,
+ fop_fremovexattr_t fn,
+ fd_t *fd,
+ const char *name);
+
+call_stub_t *
+fop_fremovexattr_cbk_stub (call_frame_t *frame,
+ fop_fremovexattr_cbk_t fn,
+ int32_t op_ret,
+ int32_t op_errno);
+
call_stub_t *
fop_lk_stub (call_frame_t *frame,
fop_lk_t fn,
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c
index 828f266b38e..df208c8805a 100644
--- a/libglusterfs/src/defaults.c
+++ b/libglusterfs/src/defaults.c
@@ -327,6 +327,15 @@ default_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
+
+int32_t
+default_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;
+}
+
int32_t
default_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock)
@@ -675,6 +684,15 @@ default_removexattr_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
int32_t
+default_fremovexattr_resume (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name)
+{
+ STACK_WIND (frame, default_fremovexattr_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fremovexattr, fd, name);
+ return 0;
+}
+
+int32_t
default_lk_resume (call_frame_t *frame, xlator_t *this, fd_t *fd,
int32_t cmd, struct gf_flock *lock)
{
@@ -1043,6 +1061,15 @@ default_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
int32_t
+default_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
+ const char *name)
+{
+ STACK_WIND (frame, default_fremovexattr_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fremovexattr, fd, name);
+ return 0;
+}
+
+int32_t
default_lk (call_frame_t *frame, xlator_t *this, fd_t *fd,
int32_t cmd, struct gf_flock *lock)
{
diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h
index fe04cbf9205..deba1557d5f 100644
--- a/libglusterfs/src/defaults.h
+++ b/libglusterfs/src/defaults.h
@@ -176,6 +176,11 @@ int32_t default_removexattr (call_frame_t *frame,
loc_t *loc,
const char *name);
+int32_t default_fremovexattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ const char *name);
+
int32_t default_lk (call_frame_t *frame,
xlator_t *this,
fd_t *fd,
@@ -390,6 +395,11 @@ int32_t default_removexattr_resume (call_frame_t *frame,
loc_t *loc,
const char *name);
+int32_t default_fremovexattr_resume (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ const char *name);
+
int32_t default_lk_resume (call_frame_t *frame,
xlator_t *this,
fd_t *fd,
@@ -624,6 +634,10 @@ default_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno);
int32_t
+default_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno);
+
+int32_t
default_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock);
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 2f68ab74106..0642973cbad 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -166,6 +166,7 @@ typedef enum {
GF_FOP_RELEASE,
GF_FOP_RELEASEDIR,
GF_FOP_GETSPEC,
+ GF_FOP_FREMOVEXATTR,
GF_FOP_MAXVALUE,
} glusterfs_fop_t;
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 2771bdea5b6..cb3b67ce79f 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -475,6 +475,34 @@ syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name)
}
int
+syncop_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ __wake (args);
+
+ return 0;
+}
+
+int
+syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_fremovexattr_cbk,
+ subvol->fops->fremovexattr, fd, name);
+
+ errno = args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno)
{
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index b4cdafd535c..57567426dab 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -186,6 +186,7 @@ int syncop_listxattr (xlator_t *subvol, loc_t *loc, dict_t **dict);
int syncop_getxattr (xlator_t *xl, loc_t *loc, dict_t **dict, const char *key);
int syncop_fgetxattr (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key);
int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name);
+int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name);
int syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode,
fd_t *fd, dict_t *dict);
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 5819218f55f..8e2d56b8d63 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -361,6 +361,32 @@ sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
int
+sys_fremovexattr (int filedes, const char *name)
+{
+
+#if defined(GF_LINUX_HOST_OS) || defined(__NetBSD__)
+ return fremovexattr (filedes, name);
+#endif
+
+ errno = ENOSYS;
+ return -1;
+#if 0 /* TODO: to port to other OSes, fill in each of below */
+#ifdef GF_BSD_HOST_OS
+ return extattr_remove_fd (filedes, EXTATTR_NAMESPACE_USER, name);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_fremovexattr (filedes, name);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return fremovexattr (filedes, name, 0);
+#endif
+#endif
+}
+
+
+int
sys_fsetxattr (int filedes, const char *name, const void *value,
size_t size, int flags)
{
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index b8a1c289600..f5325b4cd39 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -140,6 +140,9 @@ int
sys_lremovexattr (const char *path, const char *name);
int
+sys_fremovexattr (int filedes, const char *name);
+
+int
sys_access (const char *pathname, int mode);
int
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 160ac2d6322..428357633af 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -69,6 +69,7 @@ fill_defaults (xlator_t *xl)
SET_DEFAULT_FOP (fsetxattr);
SET_DEFAULT_FOP (fgetxattr);
SET_DEFAULT_FOP (removexattr);
+ SET_DEFAULT_FOP (fremovexattr);
SET_DEFAULT_FOP (opendir);
SET_DEFAULT_FOP (readdir);
SET_DEFAULT_FOP (readdirp);
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index fab3b4468d8..bc3d7a6dcf6 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -343,6 +343,12 @@ typedef int32_t (*fop_removexattr_cbk_t) (call_frame_t *frame,
int32_t op_ret,
int32_t op_errno);
+typedef int32_t (*fop_fremovexattr_cbk_t) (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno);
+
typedef int32_t (*fop_lk_cbk_t) (call_frame_t *frame,
void *cookie,
xlator_t *this,
@@ -564,6 +570,11 @@ typedef int32_t (*fop_removexattr_t) (call_frame_t *frame,
loc_t *loc,
const char *name);
+typedef int32_t (*fop_fremovexattr_t) (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ const char *name);
+
typedef int32_t (*fop_lk_t) (call_frame_t *frame,
xlator_t *this,
fd_t *fd,
@@ -665,6 +676,7 @@ struct xlator_fops {
fop_fsetxattr_t fsetxattr;
fop_fgetxattr_t fgetxattr;
fop_removexattr_t removexattr;
+ fop_fremovexattr_t fremovexattr;
fop_lk_t lk;
fop_inodelk_t inodelk;
fop_finodelk_t finodelk;
@@ -708,6 +720,7 @@ struct xlator_fops {
fop_fsetxattr_cbk_t fsetxattr_cbk;
fop_fgetxattr_cbk_t fgetxattr_cbk;
fop_removexattr_cbk_t removexattr_cbk;
+ fop_fremovexattr_cbk_t fremovexattr_cbk;
fop_lk_cbk_t lk_cbk;
fop_inodelk_cbk_t inodelk_cbk;
fop_finodelk_cbk_t finodelk_cbk;
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index c2540fa8d00..b35cdf911a5 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -64,6 +64,7 @@ enum gf_fop_procnum {
GFS3_OP_READDIRP,
GFS3_OP_RELEASE,
GFS3_OP_RELEASEDIR,
+ GFS3_OP_FREMOVEXATTR,
GFS3_OP_MAXVALUE,
} ;
@@ -193,7 +194,7 @@ enum glusterd_brick_procnum {
#define GLUSTER_CBK_VERSION 1 /* 0.0.1 */
#define GLUSTER3_1_FOP_PROGRAM 1298437 /* Completely random */
-#define GLUSTER3_1_FOP_VERSION 310 /* 3.1.0 */
+#define GLUSTER3_1_FOP_VERSION 330 /* 3.3.0 */
#define GLUSTER3_1_FOP_PROCCNT GFS3_OP_MAXVALUE
/* Second version */
diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c
index fc3237872b5..a0c6f0b0edd 100644
--- a/rpc/xdr/src/glusterfs3-xdr.c
+++ b/rpc/xdr/src/glusterfs3-xdr.c
@@ -1064,6 +1064,21 @@ xdr_gfs3_removexattr_req (XDR *xdrs, gfs3_removexattr_req *objp)
}
bool_t
+xdr_gfs3_fremovexattr_req (XDR *xdrs, gfs3_fremovexattr_req *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!xdr_opaque (xdrs, objp->gfid, 16))
+ return FALSE;
+ if (!xdr_quad_t (xdrs, &objp->fd))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->name, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_gfs3_opendir_req (XDR *xdrs, gfs3_opendir_req *objp)
{
register int32_t *buf;
diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h
index 4955b423e13..156608ff314 100644
--- a/rpc/xdr/src/glusterfs3-xdr.h
+++ b/rpc/xdr/src/glusterfs3-xdr.h
@@ -517,6 +517,13 @@ struct gfs3_removexattr_req {
};
typedef struct gfs3_removexattr_req gfs3_removexattr_req;
+struct gfs3_fremovexattr_req {
+ char gfid[16];
+ quad_t fd;
+ char *name;
+};
+typedef struct gfs3_fremovexattr_req gfs3_fremovexattr_req;
+
struct gfs3_opendir_req {
char gfid[16];
char *path;
@@ -850,6 +857,7 @@ extern bool_t xdr_gfs3_getxattr_rsp (XDR *, gfs3_getxattr_rsp*);
extern bool_t xdr_gfs3_fgetxattr_req (XDR *, gfs3_fgetxattr_req*);
extern bool_t xdr_gfs3_fgetxattr_rsp (XDR *, gfs3_fgetxattr_rsp*);
extern bool_t xdr_gfs3_removexattr_req (XDR *, gfs3_removexattr_req*);
+extern bool_t xdr_gfs3_fremovexattr_req (XDR *, gfs3_fremovexattr_req*);
extern bool_t xdr_gfs3_opendir_req (XDR *, gfs3_opendir_req*);
extern bool_t xdr_gfs3_opendir_rsp (XDR *, gfs3_opendir_rsp*);
extern bool_t xdr_gfs3_fsyncdir_req (XDR *, gfs3_fsyncdir_req*);
@@ -937,6 +945,7 @@ extern bool_t xdr_gfs3_getxattr_rsp ();
extern bool_t xdr_gfs3_fgetxattr_req ();
extern bool_t xdr_gfs3_fgetxattr_rsp ();
extern bool_t xdr_gfs3_removexattr_req ();
+extern bool_t xdr_gfs3_fremovexattr_req ();
extern bool_t xdr_gfs3_opendir_req ();
extern bool_t xdr_gfs3_opendir_rsp ();
extern bool_t xdr_gfs3_fsyncdir_req ();
diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x
index 69dc7068240..88a621034d5 100644
--- a/rpc/xdr/src/glusterfs3-xdr.x
+++ b/rpc/xdr/src/glusterfs3-xdr.x
@@ -388,6 +388,12 @@ struct gfs3_finodelk_req {
string name<>;
} ;
+ struct gfs3_fremovexattr_req {
+ opaque gfid[16];
+ hyper fd;
+ string name<>;
+} ;
+
struct gfs3_opendir_req {
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,