summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-inode-fd-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix/src/posix-inode-fd-ops.c')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 8906584684d..651569bf041 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -5423,19 +5423,21 @@ posix_forget(xlator_t *this, inode_t *inode)
{
int ret = 0;
char *unlink_path = NULL;
- uint64_t ctx_uint = 0;
+ uint64_t ctx_uint1 = 0;
+ uint64_t ctx_uint2 = 0;
posix_inode_ctx_t *ctx = NULL;
+ posix_mdata_t *mdata = NULL;
struct posix_private *priv_posix = NULL;
priv_posix = (struct posix_private *)this->private;
if (!priv_posix)
return 0;
- ret = inode_ctx_del(inode, this, &ctx_uint);
- if (!ctx_uint)
- return 0;
+ ret = inode_ctx_del2(inode, this, &ctx_uint1, &ctx_uint2);
+ if (!ctx_uint1)
+ goto check_ctx2;
- ctx = (posix_inode_ctx_t *)(uintptr_t)ctx_uint;
+ ctx = (posix_inode_ctx_t *)(uintptr_t)ctx_uint1;
if (ctx->unlink_flag == GF_UNLINK_TRUE) {
POSIX_GET_FILE_UNLINK_PATH(priv_posix->base_path, inode->gfid,
@@ -5444,14 +5446,21 @@ posix_forget(xlator_t *this, inode_t *inode)
gf_msg(this->name, GF_LOG_ERROR, ENOMEM, P_MSG_UNLINK_FAILED,
"Failed to remove gfid :%s", uuid_utoa(inode->gfid));
ret = -1;
- goto out;
+ goto ctx_free;
}
ret = sys_unlink(unlink_path);
}
-out:
+ctx_free:
pthread_mutex_destroy(&ctx->xattrop_lock);
pthread_mutex_destroy(&ctx->write_atomic_lock);
pthread_mutex_destroy(&ctx->pgfid_lock);
GF_FREE(ctx);
+
+check_ctx2:
+ if (ctx_uint2) {
+ mdata = (posix_mdata_t *)(uintptr_t)ctx_uint2;
+ }
+
+ GF_FREE(mdata);
return ret;
}