summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2013-01-30 13:47:31 +0530
committerAnand Avati <avati@redhat.com>2013-01-30 23:40:37 -0800
commite979c0de9dde14fe18d0ad7298c6da9cc878bbab (patch)
treec37dc5a0f29d16622d4eb902cddce57abe7891db
parent559219492477624290b4962a9f82c49bcda011d9 (diff)
libglusterfs/syncop: do not hold ref on the fd in cbk
* Do not do fd_ref in cbks of the fops which return a fd (such as open, opendir, create). Change-Id: Ic2f5b234c5c09c258494f4fb5d600a64813823ad BUG: 885008 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/4282 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--libglusterfs/src/syncop.c6
-rw-r--r--xlators/cluster/dht/src/dht-helper.c12
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c1
3 files changed, 6 insertions, 13 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 0c807ef5d..c8a9b5848 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -995,9 +995,6 @@ syncop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
args->op_ret = op_ret;
args->op_errno = op_errno;
- if (op_ret != -1)
- fd_ref (fd);
-
__wake (args);
return 0;
@@ -1148,9 +1145,6 @@ syncop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
args->op_ret = op_ret;
args->op_errno = op_errno;
- if (op_ret != -1)
- fd_ref (fd);
-
__wake (args);
return 0;
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 8a38de475..c587daca7 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -627,6 +627,9 @@ dht_migration_complete_check_task (void *data)
src_node = local->cached_subvol;
+ if (!local->loc.inode && !local->fd)
+ goto out;
+
/* getxattr on cached_subvol for 'linkto' value */
if (!local->loc.inode)
ret = syncop_fgetxattr (src_node, local->fd, &dict,
@@ -719,9 +722,6 @@ dht_migration_complete_check_task (void *data)
local->cached_subvol = dst_node;
ret = 0;
- if (!local->fd)
- goto out;
-
/* once we detect the migration complete, the fd-ctx is no more
required.. delete the ctx, and do one extra 'fd_unref' for open fd */
ret = fd_ctx_del (local->fd, this, NULL);
@@ -805,6 +805,9 @@ dht_rebalance_inprogress_task (void *data)
src_node = local->cached_subvol;
+ if (!local->loc.inode && !local->fd)
+ goto out;
+
/* getxattr on cached_subvol for 'linkto' value */
if (local->loc.inode)
ret = syncop_getxattr (src_node, &local->loc, &dict,
@@ -853,9 +856,6 @@ dht_rebalance_inprogress_task (void *data)
ret = 0;
- if (!local->fd)
- goto out;
-
if (local->loc.inode) {
ret = syncop_open (dst_node, &local->loc,
local->fd->flags, local->fd);
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 875abbe1d..65df67130 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3819,7 +3819,6 @@ fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd,
out:
loc_wipe (&loc);
- fd_unref (newfd);
return ret;
}