Whamcloud - gitweb
LU-3712 lmv: choose right MDT for open by FID 53/7253/4
authorwang di <di.wang@intel.com>
Tue, 6 Aug 2013 11:26:44 +0000 (04:26 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 20 Aug 2013 03:16:29 +0000 (03:16 +0000)
If the open is by FID, LMV should locate MDT by the FID
of the file/directory, instead of its parent.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: If7815de8cab0cf28b521decccda3c5f0f1aed73c
Reviewed-on: http://review.whamcloud.com/7253
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lmv/lmv_intent.c

index 1a7fc0a..bcb9006 100644 (file)
@@ -175,7 +175,13 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
        int                     rc;
        ENTRY;
 
-       tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
+       /* Note: client might open with some random flags(sanity 33b), so we can
+        * not make sure op_fid2 is being initialized with BY_FID flag */
+       if (it->it_flags & MDS_OPEN_BY_FID && fid_is_sane(&op_data->op_fid2))
+               tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2);
+       else
+               tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
+
        if (IS_ERR(tgt))
                RETURN(PTR_ERR(tgt));