From: Fan Yong Date: Thu, 8 Mar 2012 02:47:07 +0000 (+0800) Subject: LU-1195 llite: error handling for statahead/AGL start failure X-Git-Tag: 2.2.51~64 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f665b5f7691740cbdae6c96c5d959dfb7659f679 LU-1195 llite: error handling for statahead/AGL start failure 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 Change-Id: I4dec58862ad425c19e9c6284b7183b8bcaa449f6 Reviewed-on: http://review.whamcloud.com/2268 Reviewed-by: Bobi Jam Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 2033633..81d2bd0 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -1075,6 +1075,7 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) 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); RETURN_EXIT; } @@ -1093,6 +1094,7 @@ static int ll_statahead_thread(void *arg) 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; @@ -1294,8 +1296,6 @@ do_it: 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); @@ -1306,8 +1306,10 @@ out: 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)) { @@ -1718,6 +1720,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, 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);