summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.h8
-rw-r--r--libglusterfs/src/fd.c6
-rw-r--r--libglusterfs/src/inode.c4
-rw-r--r--libglusterfs/src/iobuf.c2
-rw-r--r--libglusterfs/src/mem-pool.c14
-rw-r--r--libglusterfs/src/stack.c4
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c2
-rw-r--r--rpc/rpc-transport/socket/src/socket.c4
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c2
-rw-r--r--xlators/cluster/afr/src/pump.c10
-rw-r--r--xlators/features/locks/src/posix.c2
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c4
-rw-r--r--xlators/performance/io-cache/src/io-cache.c4
-rw-r--r--xlators/performance/io-cache/src/page.c2
-rw-r--r--xlators/performance/quick-read/src/quick-read.c2
-rw-r--r--xlators/performance/read-ahead/src/page.c2
-rw-r--r--xlators/performance/write-behind/src/write-behind.c2
-rw-r--r--xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c2
-rw-r--r--xlators/protocol/legacy/transport/socket/src/socket.c4
-rw-r--r--xlators/storage/bdb/src/bctx.c2
-rw-r--r--xlators/storage/bdb/src/bdb.c2
22 files changed, 47 insertions, 41 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index b883653bf70..4371888d034 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -131,7 +131,13 @@ extern char *gf_mgmt_list[GF_MGMT_MAXVALUE];
#define GF_FILE_CONTENT_REQUESTED(_xattr_req,_content_limit) \
(dict_get_uint64 (_xattr_req, "glusterfs.content", _content_limit) == 0)
-#define GF_ASSERT(x) assert (x);
+#define GF_ASSERT(x) \
+ do { \
+ if (!(x)) { \
+ gf_log_callingfn ("", GF_LOG_ERROR, \
+ "Assertion failed: " #x); \
+ } \
+ } while (0);
static inline void
iov_free (struct iovec *vector, int count)
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 58790f4e69b..e4e75d8040f 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -384,7 +384,7 @@ fd_ref (fd_t *fd)
fd_t *
_fd_unref (fd_t *fd)
{
- assert (fd->refcount);
+ GF_ASSERT (fd->refcount);
--fd->refcount;
@@ -503,7 +503,7 @@ fd_bind (fd_t *fd)
void
fd_unref_unbind (fd_t *fd)
{
- assert (fd->refcount);
+ GF_ASSERT (fd->refcount);
LOCK (&fd->inode->lock);
{
@@ -514,7 +514,7 @@ fd_unref_unbind (fd_t *fd)
* Make sure you only call this when you know there are
* pending refs on the fd.
*/
- assert (fd->refcount);
+ GF_ASSERT (fd->refcount);
list_del_init (&fd->inode_list);
}
UNLOCK (&fd->inode->lock);
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index bdc2c6e4889..04e4560ed8f 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -306,7 +306,7 @@ __inode_unref (inode_t *inode)
if (inode->ino == 1)
return inode;
- assert (inode->ref);
+ GF_ASSERT (inode->ref);
--inode->ref;
@@ -501,7 +501,7 @@ __inode_forget (inode_t *inode, uint64_t nlookup)
if (!inode)
return NULL;
- assert (inode->nlookup >= nlookup);
+ GF_ASSERT (inode->nlookup >= nlookup);
inode->nlookup -= nlookup;
diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c
index d1afc4d36bd..a8bd192cf88 100644
--- a/libglusterfs/src/iobuf.c
+++ b/libglusterfs/src/iobuf.c
@@ -82,7 +82,7 @@ __iobuf_arena_destroy_iobufs (struct iobuf_arena *iobuf_arena)
iobuf = iobuf_arena->iobufs;
for (i = 0; i < iobuf_cnt; i++) {
- assert (iobuf->ref == 0);
+ GF_ASSERT (iobuf->ref == 0);
list_del_init (&iobuf->list);
iobuf++;
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 8f62ac3cf89..17d2e0dd2f1 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -78,15 +78,15 @@ gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr,
ptr = (char *) (*alloc_ptr);
if (!xl) {
- assert (0);
+ GF_ASSERT (0);
}
if (!(xl->mem_acct.rec)) {
- assert (0);
+ GF_ASSERT (0);
}
if (type > xl->mem_acct.num_types) {
- assert (0);
+ GF_ASSERT (0);
}
LOCK(&xl->mem_acct.rec[type].lock);
@@ -179,7 +179,7 @@ __gf_realloc (void *ptr, size_t size)
orig_ptr = (char *)ptr - 4;
- assert (*(uint32_t *)orig_ptr == GF_MEM_HEADER_MAGIC);
+ GF_ASSERT (*(uint32_t *)orig_ptr == GF_MEM_HEADER_MAGIC);
orig_ptr = orig_ptr - sizeof(xlator_t *);
xl = *((xlator_t **)orig_ptr);
@@ -261,7 +261,7 @@ __gf_free (void *free_ptr)
if (GF_MEM_HEADER_MAGIC != *(uint32_t *)ptr) {
//Possible corruption, assert here
- assert (0);
+ GF_ASSERT (0);
}
*(uint32_t *)ptr = 0;
@@ -271,7 +271,7 @@ __gf_free (void *free_ptr)
if (!xl) {
//gf_free expects xl to be available
- assert (0);
+ GF_ASSERT (0);
}
if (!xl->mem_acct.rec) {
@@ -288,7 +288,7 @@ __gf_free (void *free_ptr)
if (GF_MEM_TRAILER_MAGIC != *(uint32_t *)
((char *)free_ptr + req_size)) {
// This points to a memory overrun
- assert (0);
+ GF_ASSERT (0);
}
*(uint32_t *) ((char *)free_ptr + req_size) = 0;
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index 30a86f2e461..b2659c57fe3 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -48,7 +48,7 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...)
if (!call_frame)
return;
- assert(key_buf);
+ GF_ASSERT (key_buf);
memset(prefix, 0, sizeof(prefix));
memset(&my_frame, 0, sizeof(my_frame));
@@ -91,7 +91,7 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...)
if (!call_stack)
return;
- assert(key_buf);
+ GF_ASSERT (key_buf);
cnt = call_frames_count(&call_stack->frames);
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 0478fd515b0..f342fa0c905 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -1817,7 +1817,7 @@ rdma_ioq_new (rpc_transport_t *this, rpc_transport_data_t *data)
count = msg->rpchdrcount + msg->proghdrcount + msg->progpayloadcount;
- assert (count <= MAX_IOVEC);
+ GF_ASSERT (count <= MAX_IOVEC);
if (msg->rpchdr != NULL) {
memcpy (&entry->rpchdr[0], msg->rpchdr,
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 341c8e94a39..6289e75592b 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -496,7 +496,7 @@ __socket_ioq_new (rpc_transport_t *this, rpc_transport_msg_t *msg)
count = msg->rpchdrcount + msg->proghdrcount + msg->progpayloadcount;
- assert (count <= (MAX_IOVEC - 1));
+ GF_ASSERT (count <= (MAX_IOVEC - 1));
size = iov_length (msg->rpchdr, msg->rpchdrcount)
+ iov_length (msg->proghdr, msg->proghdrcount)
@@ -595,7 +595,7 @@ __socket_ioq_churn_entry (rpc_transport_t *this, struct ioq *entry)
if (ret == 0) {
/* current entry was completely written */
- assert (entry->pending_count == 0);
+ GF_ASSERT (entry->pending_count == 0);
__socket_ioq_entry_free (entry);
}
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 368a334230e..4ef11cb1bc8 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2451,10 +2451,10 @@ afr_priv_dump (xlator_t *this)
int i = 0;
- assert(this);
+ GF_ASSERT (this);
priv = this->private;
- assert(priv);
+ GF_ASSERT (priv);
snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name);
gf_proc_dump_add_section(key_prefix);
gf_proc_dump_build_key(key, key_prefix, "child_count");
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index c0c5e4c2c24..1bb395cc387 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1639,7 +1639,7 @@ void
afr_self_heal_type_str_get (afr_self_heal_t *self_heal_p, char *str,
size_t size)
{
- assert(str && (size > 0));
+ GF_ASSERT (str && (size > 0));
if (self_heal_p->need_metadata_self_heal) {
snprintf(str, size, " meta-data");
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 3bb9b851d30..a162d3fa164 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -135,7 +135,7 @@ pump_set_resume_path (xlator_t *this, const char *path)
priv = this->private;
pump_priv = priv->pump_private;
- assert (pump_priv);
+ GF_ASSERT (pump_priv);
LOCK (&pump_priv->resume_path_lock);
{
@@ -231,7 +231,7 @@ pump_save_path (xlator_t *this, const char *path)
priv = this->private;
pump_priv = priv->pump_private;
- assert (priv->root_inode);
+ GF_ASSERT (priv->root_inode);
build_root_loc (priv->root_inode, &loc);
@@ -424,7 +424,7 @@ gf_pump_traverse_directory (loc_t *loc)
this = THIS;
priv = this->private;
- assert (loc->inode);
+ GF_ASSERT (loc->inode);
fd = fd_create (loc->inode, PUMP_PID);
if (!fd) {
@@ -587,7 +587,7 @@ pump_complete_migration (xlator_t *this)
priv = this->private;
pump_priv = priv->pump_private;
- assert (priv->root_inode);
+ GF_ASSERT (priv->root_inode);
build_root_loc (priv->root_inode, &loc);
@@ -683,7 +683,7 @@ pump_task (void *data)
this = THIS;
priv = this->private;
- assert (priv->root_inode);
+ GF_ASSERT (priv->root_inode);
build_root_loc (priv->root_inode, &loc);
xattr_req = dict_new ();
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index f03fb06e0c4..dacc2b04eed 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1835,7 +1835,7 @@ int
pl_dump_inode (xlator_t *this)
{
- assert(this);
+ GF_ASSERT (this);
if (this->itable) {
inode_table_dump(this->itable,
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 6578710ea07..8ddf9ee171b 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3558,7 +3558,7 @@ init (xlator_t *this_xl)
ret = dict_get_str (options, ZR_DIRECT_IO_OPT, &value_string);
if (ret == 0) {
ret = gf_string2boolean (value_string, &priv->direct_io_mode);
- assert (ret == 0);
+ GF_ASSERT (ret == 0);
}
priv->strict_volfile_check = 0;
@@ -3566,7 +3566,7 @@ init (xlator_t *this_xl)
if (ret == 0) {
ret = gf_string2boolean (value_string,
&priv->strict_volfile_check);
- assert (ret == 0);
+ GF_ASSERT (ret == 0);
}
priv->fuse_dump_fd = -1;
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 787c073e5e0..e76764bcb6a 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -1938,10 +1938,10 @@ ioc_priv_dump (xlator_t *this)
char key_prefix[GF_DUMP_MAX_BUF_LEN];
char key[GF_DUMP_MAX_BUF_LEN];
- assert (this);
+ GF_ASSERT (this);
priv = this->private;
- assert (priv);
+ GF_ASSERT (priv);
gf_proc_dump_build_key (key_prefix, "xlator.performance.io-cache",
"priv");
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 07757c0c1a6..47a8fbb6606 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -779,7 +779,7 @@ ioc_frame_return (call_frame_t *frame)
int32_t wait_count = 0;
local = frame->local;
- assert (local->wait_count > 0);
+ GF_ASSERT (local->wait_count > 0);
ioc_local_lock (local);
{
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 965f943799b..3bd0a615424 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -161,7 +161,7 @@ qr_fd_ctx_free (qr_fd_ctx_t *qr_fd_ctx)
goto out;
}
- assert (list_empty (&qr_fd_ctx->waiting_ops));
+ GF_ASSERT (list_empty (&qr_fd_ctx->waiting_ops));
GF_FREE (qr_fd_ctx->path);
GF_FREE (qr_fd_ctx);
diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c
index 5e69add2df5..925bc253d65 100644
--- a/xlators/performance/read-ahead/src/page.c
+++ b/xlators/performance/read-ahead/src/page.c
@@ -423,7 +423,7 @@ ra_frame_return (call_frame_t *frame)
int32_t wait_count = 0;
local = frame->local;
- assert (local->wait_count > 0);
+ GF_ASSERT (local->wait_count > 0);
ra_local_lock (local);
{
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 70335f6227a..d693b596b50 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2516,7 +2516,7 @@ wb_release (xlator_t *this, fd_t *fd)
if (file != NULL) {
LOCK (&file->lock);
{
- assert (list_empty (&file->request));
+ GF_ASSERT (list_empty (&file->request));
}
UNLOCK (&file->lock);
diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
index 9020f58dbe8..92034cd1519 100644
--- a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
+++ b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c
@@ -500,7 +500,7 @@ ib_verbs_ioq_new (char *buf, int len, struct iovec *vector,
/* TODO: use mem-pool */
entry = GF_CALLOC (1, sizeof (*entry), gf_ibv_mt_ib_verbs_ioq_t);
- assert (count <= (MAX_IOVEC-2));
+ GF_ASSERT (count <= (MAX_IOVEC-2));
entry->header.colonO[0] = ':';
entry->header.colonO[1] = 'O';
diff --git a/xlators/protocol/legacy/transport/socket/src/socket.c b/xlators/protocol/legacy/transport/socket/src/socket.c
index 0ba329ba73e..c101a8715cf 100644
--- a/xlators/protocol/legacy/transport/socket/src/socket.c
+++ b/xlators/protocol/legacy/transport/socket/src/socket.c
@@ -343,7 +343,7 @@ __socket_ioq_new (transport_t *this, char *buf, int len,
if (!entry)
return NULL;
- assert (count <= (MAX_IOVEC-2));
+ GF_ASSERT (count <= (MAX_IOVEC-2));
entry->header.colonO[0] = ':';
entry->header.colonO[1] = 'O';
@@ -423,7 +423,7 @@ __socket_ioq_churn_entry (transport_t *this, struct ioq *entry)
if (ret == 0) {
/* current entry was completely written */
- assert (entry->pending_count == 0);
+ GF_ASSERT (entry->pending_count == 0);
__socket_ioq_entry_free (entry);
}
diff --git a/xlators/storage/bdb/src/bctx.c b/xlators/storage/bdb/src/bctx.c
index d7d0932c914..e87b2e7a98d 100644
--- a/xlators/storage/bdb/src/bctx.c
+++ b/xlators/storage/bdb/src/bctx.c
@@ -167,7 +167,7 @@ __bctx_activate (bctx_t *bctx)
static bctx_t *
__bdb_ctx_unref (bctx_t *bctx)
{
- assert (bctx->ref);
+ GF_ASSERT (bctx->ref);
--bctx->ref;
diff --git a/xlators/storage/bdb/src/bdb.c b/xlators/storage/bdb/src/bdb.c
index 8ef409a53b1..f8c5ee270a0 100644
--- a/xlators/storage/bdb/src/bdb.c
+++ b/xlators/storage/bdb/src/bdb.c
@@ -3230,7 +3230,7 @@ notify (xlator_t *this,
case GF_EVENT_PARENT_UP:
{
/* Tell the parent that bdb xlator is up */
- assert ((this->private != NULL) &&
+ GF_ASSERT ((this->private != NULL) &&
(BDB_ENV(this) != NULL));
default_notify (this, GF_EVENT_CHILD_UP, data);
}