From 8e13d34da223e0fc86a7cd269675b067e353f829 Mon Sep 17 00:00:00 2001 From: Li Xi Date: Wed, 2 Jul 2014 16:26:22 +0800 Subject: [PATCH] LU-5274 llite: fix ll_statahead_thread() problems on failure When ll_prep_md_op_data() fails, ll_statahead_thread() does not release reference of sai and parent dentry. It does not wake up parent thread either. This patch fixes these problems. Signed-off-by: Li Xi Change-Id: Ibcc527d229e8a78710ff2263eb97969c7c46ecdb Reviewed-on: http://review.whamcloud.com/10940 Reviewed-by: John L. Hammond Tested-by: John L. Hammond Tested-by: Jenkins Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/statahead.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 5e2a4c7..cc290aa 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -1088,7 +1088,7 @@ static int ll_statahead_thread(void *arg) op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0, LUSTRE_OPC_ANY, dir); if (IS_ERR(op_data)) - RETURN(PTR_ERR(op_data)); + GOTO(out_put, rc = PTR_ERR(op_data)); op_data->op_max_pages = ll_i2sbi(dir)->ll_md_brw_pages; @@ -1270,7 +1270,9 @@ do_it: } out: EXIT; + ll_dir_chain_fini(&chain); ll_finish_md_op_data(op_data); +out_put: if (sai->sai_agl_valid) { spin_lock(&plli->lli_agl_lock); thread_set_flags(agl_thread, SVC_STOPPING); @@ -1286,7 +1288,6 @@ out: /* Set agl_thread flags anyway. */ thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED); } - ll_dir_chain_fini(&chain); spin_lock(&plli->lli_sa_lock); if (!sa_received_empty(sai)) { thread_set_flags(thread, SVC_STOPPING); @@ -1303,9 +1304,9 @@ out: wake_up(&sai->sai_waitq); wake_up(&thread->t_ctl_waitq); ll_sai_put(sai); - dput(parent); CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %.*s\n", sai, parent->d_name.len, parent->d_name.name); + dput(parent); return rc; } -- 1.8.3.1