diff options
author | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-07-28 06:42:26 -0700 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-07-28 10:38:54 -0700 |
commit | 2d85abedb2c6fb2a1c89d2074d0cc21d654cce07 (patch) | |
tree | 9342923ac5951a2f2be0e22dd0a9211bc925986d | |
parent | 51f48bc9a41a5e2004d9051ff90517b01626b08f (diff) | |
download | glusterfs-2d85abedb2c6fb2a1c89d2074d0cc21d654cce07.tar.gz glusterfs-2d85abedb2c6fb2a1c89d2074d0cc21d654cce07.tar.xz glusterfs-2d85abedb2c6fb2a1c89d2074d0cc21d654cce07.zip |
Revert "Revert "core: avoid crashes in gf_msg dup-detection code""
This reverts commit ca67ac071c56a3bd6f2b2ba3a958f0305db50a3d.
Change-Id: Iba688b524c78b84aaa0992afa5ee8e549603d990
Reviewed-on: http://review.gluster.org/11777
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | libglusterfs/src/logging.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 147ee38375..70149a2fd3 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -292,6 +292,18 @@ log_buf_init (log_buf_t *buf, const char *domain, const char *file, int errnum, uint64_t msgid, char **appmsgstr, int graph_id) { int ret = -1; + xlator_t *old_THIS; + extern xlator_t global_xlator; + + /* + * The current translator will be put in the block header for any + * memory block we allocate here. Unfortunately, these objects might + * outlive the current translator, and if we then try to dereference + * that pointer we go BOOM. Since this is really a global structure, + * use the global translator. + */ + old_THIS = THIS; + THIS = &global_xlator; if (!buf || !domain || !file || !function || !appmsgstr || !*appmsgstr) goto out; @@ -322,6 +334,7 @@ log_buf_init (log_buf_t *buf, const char *domain, const char *file, ret = 0; out: + THIS = old_THIS; return ret; } |