diff options
author | Amar Tumballi <amar@gluster.com> | 2012-01-17 05:57:24 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2012-01-25 02:24:20 -0800 |
commit | d7ecaaa1ed0f88869812ea17cb64a102a74c8c1c (patch) | |
tree | 4293106362bf9dec2e6260a4062239a9b7340cc0 /xlators/mount/fuse | |
parent | 6c54022f1b1c7f5f458f6a7e783203d11e7f89b5 (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>
Diffstat (limited to 'xlators/mount/fuse')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 43 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 1 |
2 files changed, 33 insertions, 11 deletions
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_ */ |