summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src/fuse-bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c43
1 files changed, 32 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;