summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2013-07-24 18:44:42 +0000
committerAnand Avati <avati@redhat.com>2013-08-03 09:48:12 -0700
commitb777fc478d74b2582671fef7cb2c55206432c2bb (patch)
tree0f41b1e7fe04124c53ac7c047339d654f2c80ad1 /xlators
parent572f5f0a85c97a4f90a33be87b96368a0d7e7a8e (diff)
fuse: fix memory leak in fuse_getxattr()
The fuse_getxattr() function was not freeing fuse_state_t resulting in a memory leak. As a result, when continuous writes (run dd command in a loop) were done from a FUSE mount point, the OOM killer killed the client process (glusterfs). Change-Id: I6ded1a4c25d26ceab0cb3b89ac81066cb51343ec BUG: 988182 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/5392 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 5f25260b6f9..c17b5ccc0f5 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -761,9 +761,11 @@ fuse_handle_gfiddir_op (xlator_t *this, fuse_state_t *state, void *msg,
case GF_FOP_LINK:
ret = fuse_handle_gfiddir_entry_op (state, fop);
+ break;
case GF_FOP_UNLINK:
ret = fuse_handle_gfiddir_entry_op (state, fop);
+ break;
default:
break;
@@ -4168,6 +4170,7 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
fuse_state_t *state = NULL;
struct fuse_private *priv = NULL;
int rv = 0;
+ int op_errno = EINVAL;
char *newkey = NULL;
priv = this->private;
@@ -4187,9 +4190,8 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
"%"PRIu64": GETXATTR %s/%"PRIu64" (%s):"
"refusing positioned getxattr",
finh->unique, state->loc.path, finh->nodeid, name);
- send_fuse_err (this, finh, EINVAL);
- FREE (finh);
- return;
+ op_errno = EINVAL;
+ goto err;
}
#endif
@@ -4202,17 +4204,15 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
if (!priv->acl) {
if ((strcmp (name, "system.posix_acl_access") == 0) ||
(strcmp (name, "system.posix_acl_default") == 0)) {
- send_fuse_err (this, finh, ENOTSUP);
- GF_FREE (finh);
- return;
+ op_errno = ENOTSUP;
+ goto err;
}
}
if (!priv->selinux) {
if (strncmp (name, "security.", 9) == 0) {
- send_fuse_err (this, finh, ENODATA);
- GF_FREE (finh);
- return;
+ op_errno = ENODATA;
+ goto err;
}
}
@@ -4220,16 +4220,19 @@ fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
rv = fuse_flip_xattr_ns (priv, name, &newkey);
if (rv) {
- send_fuse_err (this, finh, ENOMEM);
- free_fuse_state (state);
- goto out;
+ op_errno = ENOMEM;
+ goto err;
}
state->size = fgxi->size;
state->name = newkey;
fuse_resolve_and_resume (state, fuse_getxattr_resume);
- out:
+
+ return;
+ err:
+ send_fuse_err (this, finh, op_errno);
+ free_fuse_state (state);
return;
}