summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-12-06 05:31:44 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-06 03:01:59 -0800
commita53cd95827df0a9c560fdf5e07b0c23d03707b04 (patch)
tree9bfefe3967a79012b04ca03776648ead6947e222 /libglusterfs
parentea93dd6397b79842c1d8e5189ff217201c002a8d (diff)
THIS: set THIS pointers before forget/release/releasedir callbacks
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/fd.c7
-rw-r--r--libglusterfs/src/inode.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 59e702dd9de..c6b060c61a5 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -385,6 +385,7 @@ fd_destroy (fd_t *fd)
{
xlator_t *xl = NULL;
int i = 0;
+ xlator_t *old_THIS = NULL;
if (fd == NULL){
gf_log ("xlator", GF_LOG_ERROR, "invalid arugument");
@@ -402,16 +403,22 @@ fd_destroy (fd_t *fd)
for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) {
if (fd->_ctx[i].key) {
xl = (xlator_t *)(long)fd->_ctx[i].key;
+ old_THIS = THIS;
+ THIS = xl;
if (xl->cbks->releasedir)
xl->cbks->releasedir (xl, fd);
+ THIS = old_THIS;
}
}
} else {
for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) {
if (fd->_ctx[i].key) {
xl = (xlator_t *)(long)fd->_ctx[i].key;
+ old_THIS = THIS;
+ THIS = xl;
if (xl->cbks->release)
xl->cbks->release (xl, fd);
+ THIS = old_THIS;
}
}
}
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index bd068439889..5b70ce5fee1 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -276,6 +276,7 @@ __inode_destroy (inode_t *inode)
{
int index = 0;
xlator_t *xl = NULL;
+ xlator_t *old_THIS = NULL;
if (!inode->_ctx)
goto noctx;
@@ -283,8 +284,11 @@ __inode_destroy (inode_t *inode)
for (index = 0; index < inode->table->xl->ctx->xl_count; index++) {
if (inode->_ctx[index].key) {
xl = (xlator_t *)(long)inode->_ctx[index].key;
+ old_THIS = THIS;
+ THIS = xl;
if (xl->cbks->forget)
xl->cbks->forget (xl, inode);
+ THIS = old_THIS;
}
}