summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-10 07:21:33 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-13 22:10:34 -0700
commitdd149ca8e7757e6e935c6481be8fd4fee9d13790 (patch)
treead82c15854c0cd2caed4923207fd70280defaf7b /libglusterfsclient/src/libglusterfsclient.c
parentcf403ff73213bec7ce4781336e89a5bcfd9a167c (diff)
libglusterfsclient: Wait for time ample enough for all the children of distribute to initialize before sending lookup on '/'.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> 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
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index fd42926..029fe22 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -51,6 +51,7 @@
#include <stdarg.h>
#include <sys/statvfs.h>
#include "hashfn.h"
+#include <sys/select.h>
#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, "/");