Whamcloud - gitweb
LU-4320 mdt: fixup MDS_SWAP_LAYOUTS ELC handling 29/9329/2
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 20 Feb 2014 15:58:51 +0000 (09:58 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 12 Mar 2014 15:21:48 +0000 (15:21 +0000)
In mdc_ioc_swap_layouts() cancel *any* unused locks with LAYOUT or
XATTR IBITS set on the two files. (This matches the locks acquired in
mdt_swap_layouts(). Previously only locks that conflicted with a CR
LAYOUT lock were cancelled.) Add HABEO_CLAVIS to the target handler
flags for MDS_SWAP_LAYOUTS and call ldlm_request_cancel() from
mdt_swap_layouts() to do the intended early lock cancellation before
the handler acquires its own locks.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I9d7ba9ac660b136dafa7e307177b92204a1257c3
Reviewed-on: http://review.whamcloud.com/9329
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c

index 85fd541..4e540d6 100644 (file)
@@ -2416,9 +2416,11 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,
         * with the request RPC to avoid extra RPC round trips
         */
        count = mdc_resource_get_unused(exp, &op_data->op_fid1, &cancels,
-                                       LCK_CR, MDS_INODELOCK_LAYOUT);
+                                       LCK_EX, MDS_INODELOCK_LAYOUT |
+                                       MDS_INODELOCK_XATTR);
        count += mdc_resource_get_unused(exp, &op_data->op_fid2, &cancels,
-                                        LCK_CR, MDS_INODELOCK_LAYOUT);
+                                        LCK_EX, MDS_INODELOCK_LAYOUT |
+                                        MDS_INODELOCK_XATTR);
 
        req = ptlrpc_request_alloc(class_exp2cliimp(exp),
                                   &RQF_MDS_SWAP_LAYOUTS);
index 0fa9e83..efe4614 100644 (file)
@@ -1147,6 +1147,10 @@ int mdt_swap_layouts(struct tgt_session_info *tsi)
                RETURN(-EOPNOTSUPP);
 
        info = tsi2mdt_info(tsi);
+
+       if (info->mti_dlm_req != NULL)
+               ldlm_request_cancel(req, info->mti_dlm_req, 0);
+
        if (req_capsule_get_size(info->mti_pill, &RMF_CAPA1, RCL_CLIENT))
                mdt_set_capainfo(info, 0, &info->mti_body->fid1,
                                 req_capsule_client_get(info->mti_pill,
@@ -4220,8 +4224,9 @@ TGT_MDT_HDL(HABEO_CORPUS| HABEO_REFERO | MUTABOR, MDS_HSM_STATE_SET,
 TGT_MDT_HDL(HABEO_CORPUS| HABEO_REFERO, MDS_HSM_ACTION,        mdt_hsm_action),
 TGT_MDT_HDL(HABEO_CORPUS| HABEO_REFERO, MDS_HSM_REQUEST,
                                                        mdt_hsm_request),
-TGT_MDT_HDL(HABEO_CORPUS|HABEO_REFERO | MUTABOR, MDS_SWAP_LAYOUTS,
-                                                       mdt_swap_layouts)
+TGT_MDT_HDL(HABEO_CLAVIS | HABEO_CORPUS | HABEO_REFERO | MUTABOR,
+           MDS_SWAP_LAYOUTS,
+           mdt_swap_layouts),
 };
 
 static struct tgt_handler mdt_sec_ctx_ops[] = {