From e73e7afe5630894faa7a2829969cd16ea99e3c71 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Thu, 10 Sep 2009 07:18:10 +0000 Subject: libglusterfsclient: Wait for time ample enough for all the children of distribute to initialize before sending lookup on '/'. Signed-off-by: Anand V. Avati BUG: 255 (libglusterfsclient should wait till all the children of distribute are initialized before sending first lookup on '/') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=255 --- libglusterfsclient/src/libglusterfsclient.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libglusterfsclient') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 23379ecff7a..bba5877897e 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -51,6 +51,7 @@ #include #include #include "hashfn.h" +#include #define LIBGF_XL_NAME "libglusterfsclient" #define LIBGLUSTERFS_INODE_TABLE_LRU_LIMIT 1000 //14057 @@ -1034,6 +1035,7 @@ glusterfs_init (glusterfs_init_params_t *init_ctx, uint32_t fakefsid) struct rlimit lim; uint32_t xl_count = 0; loc_t new_loc = {0, }; + struct timeval tv = {0, }; if (!init_ctx || (!init_ctx->specfile && !init_ctx->specfp)) { errno = EINVAL; @@ -1335,6 +1337,15 @@ glusterfs_init (glusterfs_init_params_t *init_ctx, uint32_t fakefsid) } pthread_mutex_unlock (&priv->lock); + /* + * wait for some time to allow initialization of all children of + * distribute before sending lookup on '/' + */ + + tv.tv_sec = 0; + tv.tv_usec = (100 * 1000); + select (0, NULL, NULL, NULL, &tv); + /* workaround for xlators like dht which require lookup to be sent * on / */ libgf_client_loc_fill (&new_loc, ctx, 1, 0, "/"); -- cgit