From d1d56f6472904c376d14e9ca7b0038ae2c2810d4 Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Tue, 11 Feb 2014 17:10:44 +0800 Subject: [PATCH] LU-4405 mdc: use ibits_known mask for lock match Before revalidating a lock on the client, mask the lock bits against the lock bits supported by the server (ibits_known), so newer clients will find valid locks given by older server versions. Xyratex-bug-id: MRP-1583 Lustre-commit: 6b557f04e55b14e11b7fce310094e71331c8b204 Lustre-change: http://review.whamcloud.com/8636 Signed-off-by: Patrick Farrell Signed-off-by: Alexey Lyashkov Signed-off-by: Bob Glossman Signed-off-by: Jian Yu Change-Id: I7088217fe28e45f1be6c8d1145b42de0f6228372 Reviewed-on: http://review.whamcloud.com/8847 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/lustre_export.h | 8 ++++++++ lustre/mdc/mdc_locks.c | 30 ++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 317470d..a1e2f65 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -388,6 +388,14 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) return ocd->ocd_connect_flags & OBD_CONNECT_DISP_STRIPE; } +static inline __u64 exp_connect_ibits(struct obd_export *exp) +{ + struct obd_connect_data *ocd; + + ocd = &exp->exp_connect_data; + return ocd->ocd_ibits_known; +} + extern struct obd_export *class_conn2export(struct lustre_handle *conn); extern struct obd_device *class_conn2obd(struct lustre_handle *conn); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 1ff473a..265b988 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -160,18 +160,20 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, } ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags, - const struct lu_fid *fid, ldlm_type_t type, - ldlm_policy_data_t *policy, ldlm_mode_t mode, - struct lustre_handle *lockh) + const struct lu_fid *fid, ldlm_type_t type, + ldlm_policy_data_t *policy, ldlm_mode_t mode, + struct lustre_handle *lockh) { - struct ldlm_res_id res_id; - ldlm_mode_t rc; - ENTRY; + struct ldlm_res_id res_id; + ldlm_mode_t rc; + ENTRY; - fid_build_reg_res_name(fid, &res_id); - rc = ldlm_lock_match(class_exp2obd(exp)->obd_namespace, flags, - &res_id, type, policy, mode, lockh, 0); - RETURN(rc); + fid_build_reg_res_name(fid, &res_id); + /* LU-4405: Clear bits not supported by server */ + policy->l_inodebits.bits &= exp_connect_ibits(exp); + rc = ldlm_lock_match(class_exp2obd(exp)->obd_namespace, flags, + &res_id, type, policy, mode, lockh, 0); + RETURN(rc); } int mdc_cancel_unused(struct obd_export *exp, @@ -1109,10 +1111,10 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, break; } - mode = ldlm_lock_match(exp->exp_obd->obd_namespace, - LDLM_FL_BLOCK_GRANTED, &res_id, - LDLM_IBITS, &policy, - LCK_CR|LCK_CW|LCK_PR|LCK_PW, &lockh, 0); + mode = mdc_lock_match(exp, LDLM_FL_BLOCK_GRANTED, fid, + LDLM_IBITS, &policy, + LCK_CR | LCK_CW | LCK_PR | LCK_PW, + &lockh); } if (mode) { -- 1.8.3.1