From 226c228ff8effd6cc5edcb3326907b1faf69eaea Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Wed, 9 Sep 2009 00:39:09 +0000 Subject: libglusterfsclient: Add inode_ctx NULL check during iattr cache validation Signed-off-by: Anand V. Avati BUG: 253 (Global bug for libglusterfsclient NULL checks and CALLOC handling fixes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=253 --- libglusterfsclient/src/libglusterfsclient.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 1dfe33327b8..8f7ae8809e3 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -587,6 +587,12 @@ libgf_is_iattr_cache_valid (libglusterfs_client_ctx_t *ctx, inode_t *inode, return 0; inode_ctx = libgf_get_inode_ctx (inode); + if (!inode_ctx) { + gf_log (LIBGF_XL_NAME, GF_LOG_ERROR, "No inode context" + " present\n"); + return 0; + } + pthread_mutex_lock (&inode_ctx->lock); { current = time (NULL); -- cgit