diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/common-utils.c | 11 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs/common-utils.h | 10 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 1 |
3 files changed, 20 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 682cbf2805..9c684385f2 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -76,6 +76,8 @@ char *vol_type_str[] = { "Distributed-Disperse", }; +gf_boolean_t gf_signal_on_assert = false; + typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size); typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size); @@ -88,6 +90,14 @@ char *xattrs_to_heal[] = {"user.", GF_XATTR_MDATA_KEY, NULL}; +void gf_assert(void) +{ + if (gf_signal_on_assert) { + raise(SIGCONT); + } + +} + void gf_xxh64_wrapper(const unsigned char *data, size_t const len, unsigned long long const seed, char *xxh64) @@ -4069,6 +4079,7 @@ gf_thread_vcreate(pthread_t *thread, const pthread_attr_t *attr, sigdelset(&set, SIGSYS); sigdelset(&set, SIGFPE); sigdelset(&set, SIGABRT); + sigdelset(&set, SIGCONT); pthread_sigmask(SIG_BLOCK, &set, &old); diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h index f297fdab5c..c8014a127b 100644 --- a/libglusterfs/src/glusterfs/common-utils.h +++ b/libglusterfs/src/glusterfs/common-utils.h @@ -26,6 +26,7 @@ #include <limits.h> #include <fnmatch.h> #include <uuid/uuid.h> +#include <urcu/compiler.h> /* FreeBSD, etc. */ #ifndef __BITS_PER_LONG @@ -443,14 +444,19 @@ BIT_VALUE(unsigned char *array, unsigned int index) } \ } while (0) +void gf_assert(void); + #ifdef DEBUG #define GF_ASSERT(x) assert(x); #else #define GF_ASSERT(x) \ do { \ - if (!(x)) { \ + if (caa_unlikely(!(x))) { \ + gf_assert(); \ gf_msg_callingfn("", GF_LOG_ERROR, 0, LG_MSG_ASSERTION_FAILED, \ - "Assertion failed: " #x); \ + "Assertion failed: To attach gdb and coredump," \ + " Run the script under " \ + "\"glusterfs/extras/debug/gfcore.py\""); \ } \ } while (0) #endif diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 5f18cd56cb..24735079d2 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -1191,3 +1191,4 @@ gf_latency_new gf_latency_reset gf_latency_update gf_frame_latency_update +gf_assert |