summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Huan <zhanghuan@open-fs.com>2017-12-05 12:54:04 +0800
committerJeff Darcy <jeff@pl.atyp.us>2017-12-06 23:46:03 +0000
commit4eb49de567c5e9f4559bfb05a6174ac8020b03ad (patch)
tree7491ba441c4d1d731039da873c4d0b3a32b13347
parent28202631fecbc3b20a55cfc5fa339663db37e955 (diff)
gfapi: fix issue when glfs_set_logging is called concurrently
glfs_set_logging changes THIS->ctx without lock, during initialization THIS refers to global_xlator. Concurrently changing it could result in global_xlator.ctx being some fs->ctx. After that fs->ctx is destroyed, global_xlator.ctx refers to an invalid pointer and that causes crash in sbusequent access. Change-Id: I6682173811799bafd525d9ab371874f3803baa0e BUG: 1521213 Signed-off-by: Zhang Huan <zhanghuan@open-fs.com>
-rw-r--r--api/src/glfs.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index d6c05b76323..9aa817b3f3e 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -929,14 +929,10 @@ pub_glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
{
int ret = -1;
char *tmplog = NULL;
- glusterfs_ctx_t *old_ctx = NULL;
DECLARE_OLD_THIS;
__GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs);
- old_ctx = THIS->ctx;
- THIS->ctx = fs->ctx;
-
if (!logfile) {
ret = gf_set_log_file_path (&fs->ctx->cmd_args, fs->ctx);
if (ret)
@@ -959,7 +955,6 @@ pub_glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
goto out;
out:
- THIS->ctx = old_ctx;
__GLFS_EXIT_FS;
invalid_fs: