gfapi: Mark fs->init status done in glfs_init_done for the case of glfs_init_async.
This seen when we call glfs_init_async. The glfs_init_done function, calls the call-back function without assigning 1 to fs->init. The problem occurs when we call glfs_read or a similar api next time which checks if fs->init is 1 and will enter into an infinite wait if it is zero. Change-Id: I34a3d1652c80e737f5b05082a3fbb6e5978b14cd BUG: 839950 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.org/4445 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
26d9d2bd27
commit
34d8edf58a
@ -473,20 +473,31 @@ glfs_init_wait (struct glfs *fs)
|
||||
void
|
||||
glfs_init_done (struct glfs *fs, int ret)
|
||||
{
|
||||
if (fs->init_cbk) {
|
||||
fs->init_cbk (fs, ret);
|
||||
return;
|
||||
glfs_init_cbk init_cbk;
|
||||
|
||||
if (!fs) {
|
||||
gf_log ("glfs", GF_LOG_ERROR,
|
||||
"fs is NULL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
init_cbk = fs->init_cbk;
|
||||
|
||||
pthread_mutex_lock (&fs->mutex);
|
||||
{
|
||||
fs->init = 1;
|
||||
fs->ret = ret;
|
||||
fs->err = errno;
|
||||
|
||||
pthread_cond_broadcast (&fs->cond);
|
||||
if (!init_cbk)
|
||||
pthread_cond_broadcast (&fs->cond);
|
||||
}
|
||||
pthread_mutex_unlock (&fs->mutex);
|
||||
|
||||
if (init_cbk)
|
||||
init_cbk (fs, ret);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user