Whamcloud - gitweb
LU-5274 llite: fix ll_statahead_thread() problems on failure 40/10940/8
authorLi Xi <lixi@ddn.com>
Wed, 2 Jul 2014 08:26:22 +0000 (16:26 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 15 Jul 2014 03:37:33 +0000 (03:37 +0000)
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 <lixi@ddn.com>
Change-Id: Ibcc527d229e8a78710ff2263eb97969c7c46ecdb
Reviewed-on: http://review.whamcloud.com/10940
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/statahead.c

index 5e2a4c7..cc290aa 100644 (file)
@@ -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;
 }