From ebdbf46cfa1ed53db8813dd6cc2a09e84fa3b9a7 Mon Sep 17 00:00:00 2001 From: wang di Date: Tue, 6 Aug 2013 04:26:44 -0700 Subject: [PATCH] LU-3712 lmv: choose right MDT for open by FID 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 Change-Id: If7815de8cab0cf28b521decccda3c5f0f1aed73c Reviewed-on: http://review.whamcloud.com/7253 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_intent.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 1a7fc0a..bcb9006 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -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)); -- 1.8.3.1