Whamcloud - gitweb
LU-5357 lod: hold thandle during lod_trans_stop 20/13420/2
authorwang di <di.wang@intel.com>
Wed, 14 Jan 2015 13:25:31 +0000 (05:25 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 3 Feb 2015 18:28:56 +0000 (18:28 +0000)
Hold thandle during lod_trans_stop, to avoid the thandle
being freed in local transaction stop.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I2448d725e35b119a61bbfb2e9567446d203bec16
Reviewed-on: http://review.whamcloud.com/13420
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_dev.c

index 8606df9..e9cf6ce 100644 (file)
@@ -591,9 +591,12 @@ static int lod_trans_stop(const struct lu_env *env, struct dt_device *dt,
        int                             rc;
        ENTRY;
 
+       thandle_get(th);
        rc = dt_trans_stop(env, th->th_dev, th);
-       if (likely(tu == NULL))
+       if (likely(tu == NULL)) {
+               thandle_put(th);
                RETURN(rc);
+       }
 
        list_for_each_entry_safe(update, tmp,
                                 &tu->tu_remote_update_list,
@@ -603,6 +606,7 @@ static int lod_trans_stop(const struct lu_env *env, struct dt_device *dt,
                if (unlikely(rc2 != 0 && rc == 0))
                        rc = rc2;
        }
+       thandle_put(th);
 
        RETURN(rc);
 }