]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
lustre/mdc: use ibits_known mask for lock match
authorAlexey Lyashkov <alexey_lyashkov@xyratex.com>
Sat, 1 Mar 2014 02:16:34 +0000 (21:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 1 Mar 2014 03:11:20 +0000 (19:11 -0800)
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.

Signed-off-by: Patrick Farrell <paf@cray.com>
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Reviewed-on: http://review.whamcloud.com/8636
Xyratex-bug-id: MRP-1583
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4405
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre_export.h
drivers/staging/lustre/lustre/mdc/mdc_locks.c

index 2feb38b51af2d8d69da7f13f9aa966434e387726..82a230be732d10889f483700c3094c0ff3438a8a 100644 (file)
@@ -380,6 +380,14 @@ static inline bool imp_connect_lvb_type(struct obd_import *imp)
                return false;
 }
 
+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 d9017a579a322ce2dbde03ac7d3228700dcd4e71..6ef9e28c56fbf66512015640409d1c66c02e2320 100644 (file)
@@ -160,6 +160,8 @@ ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
        ldlm_mode_t 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;
@@ -1087,10 +1089,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,
+               mode = mdc_lock_match(exp, LDLM_FL_BLOCK_GRANTED, fid,
                                       LDLM_IBITS, &policy,
-                                      LCK_CR|LCK_CW|LCK_PR|LCK_PW, &lockh, 0);
+                                     LCK_CR | LCK_CW | LCK_PR | LCK_PW,
+                                     &lockh);
        }
 
        if (mode) {