From: xie xingguo Date: Mon, 4 Jan 2016 03:43:12 +0000 (+0800) Subject: os: fix threads leak on error exit X-Git-Tag: v10.0.3~82^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8d70b8bd481b7856478dc3872032fb8b88ed1dd0;p=ceph.git os: fix threads leak on error exit Fixes: #14186 Signed-off-by: xie xingguo --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 30a97214e1e..d1f0df799b2 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -1605,16 +1605,7 @@ int FileStore::mount() << "wasn't configured?" << dendl; } - // stop sync thread - lock.Lock(); - stop = true; - sync_cond.Signal(); - lock.Unlock(); - sync_thread.join(); - - wbthrottle.stop(); - - goto close_current_fd; + goto stop_sync; } } @@ -1623,7 +1614,7 @@ int FileStore::mount() if (g_conf->filestore_debug_omap_check && !object_map->check(err2)) { derr << err2.str() << dendl; ret = -EINVAL; - goto close_current_fd; + goto stop_sync; } } @@ -1654,6 +1645,15 @@ int FileStore::mount() // all okay. return 0; +stop_sync: + // stop sync thread + lock.Lock(); + stop = true; + sync_cond.Signal(); + lock.Unlock(); + sync_thread.join(); + + wbthrottle.stop(); close_current_fd: VOID_TEMP_FAILURE_RETRY(::close(current_fd)); current_fd = -1;