summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-12-22 01:53:33 +0000
committerVijay Bellur <vijay@dev.gluster.com>2009-12-22 02:42:33 -0800
commit6917011ee224fc41f6ca46a674d9c2df4e72913a (patch)
tree11394d6fb7b94b046c6a6a76c74d2493c7a77561
parent77d9a17a712a250c773a2bc724f16ecb3a3aa919 (diff)
properly ref/unref fd in stripe_opendir_cbk
fixes the crash due to dereferencing NULL fd pointer Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 497 (Client crashes in fuse_fd_cbk while running ltp tests) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=497
-rw-r--r--xlators/cluster/stripe/src/stripe.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 5dc3dd8b61d..66f2e0b90b3 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -2277,6 +2277,7 @@ stripe_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
int32_t callcnt = 0;
stripe_local_t *local = frame->local;
+ fd_t *local_fd = NULL;
LOCK (&frame->lock);
{
@@ -2297,8 +2298,11 @@ stripe_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
UNLOCK (&frame->lock);
if (!callcnt) {
+ local_fd = local->fd;
STACK_UNWIND (frame, local->op_ret, local->op_errno,
local->fd);
+ if (local_fd)
+ fd_unref (local_fd);
}
return 0;
@@ -2338,6 +2342,7 @@ stripe_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
}
frame->local = local;
local->call_count = priv->child_count;
+ local->fd = fd_ref (fd);
while (trav) {
STACK_WIND (frame, stripe_opendir_cbk, trav->xlator,