Whamcloud - gitweb
LU-5287 export: hold exp_lock when modify exp_flags 71/11871/3
authorNiu Yawei <yawei.niu@intel.com>
Thu, 11 Sep 2014 10:57:52 +0000 (06:57 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 30 Oct 2014 02:16:58 +0000 (02:16 +0000)
There are few places that changing the exp_flags without holding
exp_lock, that could overwrite other concurrent exp_flags updating.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I9c0421ffeacd6bf6feaa31dca9f9fc0e7963bc8b
Reviewed-on: http://review.whamcloud.com/11871
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_lib.c
lustre/mdt/mdt_handler.c

index 0c878dc..0eb34d7 100644 (file)
@@ -1068,8 +1068,10 @@ dont_check_exports:
         * OBD_CONNECT_MNE_SWAB flag around forever, just so long as we need
         * interop with unpatched 2.2 clients.  For newer clients, servers
         * will never do MNE swabbing, let the client handle that.  LU-1644 */
         * OBD_CONNECT_MNE_SWAB flag around forever, just so long as we need
         * interop with unpatched 2.2 clients.  For newer clients, servers
         * will never do MNE swabbing, let the client handle that.  LU-1644 */
+       spin_lock(&export->exp_lock);
        export->exp_need_mne_swab = !ptlrpc_req_need_swab(req) &&
                        !(data->ocd_connect_flags & OBD_CONNECT_MNE_SWAB);
        export->exp_need_mne_swab = !ptlrpc_req_need_swab(req) &&
                        !(data->ocd_connect_flags & OBD_CONNECT_MNE_SWAB);
+       spin_unlock(&export->exp_lock);
 #endif
 
         LASSERT(target->u.obt.obt_magic == OBT_MAGIC);
 #endif
 
         LASSERT(target->u.obt.obt_magic == OBT_MAGIC);
index 569ecf6..f244e61 100644 (file)
@@ -5046,7 +5046,9 @@ static int mdt_obd_connect(const struct lu_env *env,
                         mdt_export_stats_init(obd, lexp, localdata);
 
                /* For phase I, sync for cross-ref operation. */
                         mdt_export_stats_init(obd, lexp, localdata);
 
                /* For phase I, sync for cross-ref operation. */
+               spin_lock(&lexp->exp_lock);
                lexp->exp_keep_sync = 1;
                lexp->exp_keep_sync = 1;
+               spin_unlock(&lexp->exp_lock);
         }
 
         if (rc != 0) {
         }
 
         if (rc != 0) {