Statahead/AGL status will be checked when release ll_statahead_info.
But if some reasons cause statahead/AGL cannot be started, then the
status are undefined. So need proper error handling for such failure
cases.
Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: I4dec58862ad425c19e9c6284b7183b8bcaa449f6
Reviewed-on: http://review.whamcloud.com/2268
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
rc = cfs_create_thread(ll_agl_thread, parent, 0);
if (rc < 0) {
CERROR("can't start ll_agl thread, rc: %d\n", rc);
rc = cfs_create_thread(ll_agl_thread, parent, 0);
if (rc < 0) {
CERROR("can't start ll_agl thread, rc: %d\n", rc);
+ thread_set_flags(thread, SVC_STOPPED);
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct ll_statahead_info *sai = ll_sai_get(plli->lli_sai);
struct ptlrpc_thread *thread = &sai->sai_thread;
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct ll_statahead_info *sai = ll_sai_get(plli->lli_sai);
struct ptlrpc_thread *thread = &sai->sai_thread;
+ struct ptlrpc_thread *agl_thread = &sai->sai_agl_thread;
struct page *page;
__u64 pos = 0;
int first = 0;
struct page *page;
__u64 pos = 0;
int first = 0;
out:
if (sai->sai_agl_valid) {
out:
if (sai->sai_agl_valid) {
- struct ptlrpc_thread *agl_thread = &sai->sai_agl_thread;
-
cfs_spin_lock(&plli->lli_agl_lock);
thread_set_flags(agl_thread, SVC_STOPPING);
cfs_spin_unlock(&plli->lli_agl_lock);
cfs_spin_lock(&plli->lli_agl_lock);
thread_set_flags(agl_thread, SVC_STOPPING);
cfs_spin_unlock(&plli->lli_agl_lock);
l_wait_event(agl_thread->t_ctl_waitq,
thread_is_stopped(agl_thread),
&lwi);
l_wait_event(agl_thread->t_ctl_waitq,
thread_is_stopped(agl_thread),
&lwi);
+ } else {
+ /* Set agl_thread flags anyway. */
+ thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED);
ll_dir_chain_fini(&chain);
cfs_spin_lock(&plli->lli_sa_lock);
if (!sa_received_empty(sai)) {
ll_dir_chain_fini(&chain);
cfs_spin_lock(&plli->lli_sa_lock);
if (!sa_received_empty(sai)) {
dput(parent);
lli->lli_opendir_key = NULL;
thread_set_flags(thread, SVC_STOPPED);
dput(parent);
lli->lli_opendir_key = NULL;
thread_set_flags(thread, SVC_STOPPED);
+ thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED);
ll_sai_put(sai);
LASSERT(lli->lli_sai == NULL);
RETURN(-EAGAIN);
ll_sai_put(sai);
LASSERT(lli->lli_sai == NULL);
RETURN(-EAGAIN);