diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/locks/src/posix.c | 6 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 6 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 12 |
3 files changed, 15 insertions, 9 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 44ca5004171..1b691c0a878 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -3480,6 +3480,7 @@ pl_ctx_get (client_t *client, xlator_t *xlator) { void *tmp = NULL; pl_ctx_t *ctx = NULL; + pl_ctx_t *setted_ctx = NULL; client_ctx_get (client, xlator, &tmp); @@ -3498,10 +3499,11 @@ pl_ctx_get (client_t *client, xlator_t *xlator) INIT_LIST_HEAD (&ctx->entrylk_lockers); INIT_LIST_HEAD (&ctx->metalk_list); - if (client_ctx_set (client, xlator, ctx) != 0) { + setted_ctx = client_ctx_set (client, xlator, ctx); + if (ctx != setted_ctx) { pthread_mutex_destroy (&ctx->lock); GF_FREE (ctx); - ctx = NULL; + ctx = setted_ctx; } out: return ctx; diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index fd860d6a133..1247e41c99e 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -52,6 +52,7 @@ iot_client_ctx_t * iot_get_ctx (xlator_t *this, client_t *client) { iot_client_ctx_t *ctx = NULL; + iot_client_ctx_t *setted_ctx = NULL; int i; if (client_ctx_get (client, this, (void **)&ctx) != 0) { @@ -62,9 +63,10 @@ iot_get_ctx (xlator_t *this, client_t *client) INIT_LIST_HEAD (&ctx[i].clients); INIT_LIST_HEAD (&ctx[i].reqs); } - if (client_ctx_set (client, this, ctx) != 0) { + setted_ctx = client_ctx_set (client, this, ctx); + if (ctx != setted_ctx) { GF_FREE (ctx); - ctx = NULL; + ctx = setted_ctx; } } } diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 290038a9e6e..37f7bca47f0 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -1170,6 +1170,7 @@ server_ctx_get (client_t *client, xlator_t *xlator) { void *tmp = NULL; server_ctx_t *ctx = NULL; + server_ctx_t *setted_ctx = NULL; client_ctx_get (client, xlator, &tmp); @@ -1194,11 +1195,12 @@ server_ctx_get (client_t *client, xlator_t *xlator) LOCK_INIT (&ctx->fdtable_lock); - if (client_ctx_set (client, xlator, ctx) != 0) { - LOCK_DESTROY (&ctx->fdtable_lock); - GF_FREE (ctx->fdtable); - GF_FREE (ctx); - ctx = NULL; + setted_ctx = client_ctx_set (client, xlator, ctx); + if (ctx != setted_ctx) { + LOCK_DESTROY (&ctx->fdtable_lock); + GF_FREE (ctx->fdtable); + GF_FREE (ctx); + ctx = setted_ctx; } out: |