Whamcloud - gitweb
LU-4405 mdc: use ibits_known mask for lock match 36/8636/5
authorAlexey Lyashkov <alexey_lyashkov@xyratex.com>
Thu, 2 Jan 2014 22:03:26 +0000 (16:03 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 11 Jan 2014 03:53:05 +0000 (03:53 +0000)
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

Signed-off-by: Patrick Farrell <paf@cray.com>
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Change-Id: I359b87e4bdc7b930e51538a4a854c47e87dd0520
Reviewed-on: http://review.whamcloud.com/8636
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre_export.h
lustre/mdc/mdc_locks.c

index 44f18f3..27ea76f 100644 (file)
@@ -389,6 +389,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);
 
index a54cf07..8920c6c 100644 (file)
@@ -159,18 +159,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,
@@ -1115,10 +1117,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) {