staging/lustre/ldlm: drop redundant ibits lock interoperability check
authorFan Yong <fan.yong@intel.com>
Fri, 15 Aug 2014 16:48:09 +0000 (12:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Aug 2014 16:38:42 +0000 (09:38 -0700)
In very old release (older than Lustre-1.8), if the client talks with
the server that does not support ibits lock, then the client needs to
convert it as plain lock. Such interoperability check and convertion
is out of date for a long time. Drop it.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Reviewed-on: http://review.whamcloud.com/11004
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4971
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: wangdi <di.wang@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/obd_support.h
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
drivers/staging/lustre/lustre/ldlm/ldlm_request.c
drivers/staging/lustre/lustre/ptlrpc/import.c

index 92c89925ff67c202ab949d5a988603245e1d479b..874606a45cc15f34bc2299bd56583ed53cfbc77b 100644 (file)
@@ -402,6 +402,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_TGT_LAST_REPLAY        0x710
 #define OBD_FAIL_TGT_CLIENT_ADD          0x711
 #define OBD_FAIL_TGT_RCVG_FLAG    0x712
+#define OBD_FAIL_TGT_DELAY_CONDITIONAL  0x713
 
 #define OBD_FAIL_MDC_REVALIDATE_PAUSE    0x800
 #define OBD_FAIL_MDC_ENQUEUE_PAUSE       0x801
index d022666fb705202b518e17d420e2d2d85385ba34..3143222d162f6b814aecd8068a81c29c048f2eb5 100644 (file)
@@ -613,50 +613,12 @@ EXPORT_SYMBOL(__ldlm_handle2lock);
  */
 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
 {
-       struct obd_export *exp = lock->l_export ?: lock->l_conn_export;
-
-       /* INODEBITS_INTEROP: If the other side does not support
-        * inodebits, reply with a plain lock descriptor. */
-       if ((lock->l_resource->lr_type == LDLM_IBITS) &&
-           (exp && !(exp_connect_flags(exp) & OBD_CONNECT_IBITS))) {
-               /* Make sure all the right bits are set in this lock we
-                  are going to pass to client */
-               LASSERTF(lock->l_policy_data.l_inodebits.bits ==
-                        (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
-                         MDS_INODELOCK_LAYOUT),
-                        "Inappropriate inode lock bits during conversion %llu\n",
-                        lock->l_policy_data.l_inodebits.bits);
-
-               ldlm_res2desc(lock->l_resource, &desc->l_resource);
-               desc->l_resource.lr_type = LDLM_PLAIN;
-
-               /* Convert "new" lock mode to something old client can
-                  understand */
-               if ((lock->l_req_mode == LCK_CR) ||
-                   (lock->l_req_mode == LCK_CW))
-                       desc->l_req_mode = LCK_PR;
-               else
-                       desc->l_req_mode = lock->l_req_mode;
-               if ((lock->l_granted_mode == LCK_CR) ||
-                   (lock->l_granted_mode == LCK_CW)) {
-                       desc->l_granted_mode = LCK_PR;
-               } else {
-                       /* We never grant PW/EX locks to clients */
-                       LASSERT((lock->l_granted_mode != LCK_PW) &&
-                               (lock->l_granted_mode != LCK_EX));
-                       desc->l_granted_mode = lock->l_granted_mode;
-               }
-
-               /* We do not copy policy here, because there is no
-                  policy for plain locks */
-       } else {
-               ldlm_res2desc(lock->l_resource, &desc->l_resource);
-               desc->l_req_mode = lock->l_req_mode;
-               desc->l_granted_mode = lock->l_granted_mode;
-               ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
-                                           &lock->l_policy_data,
-                                           &desc->l_policy_data);
-       }
+       ldlm_res2desc(lock->l_resource, &desc->l_resource);
+       desc->l_req_mode = lock->l_req_mode;
+       desc->l_granted_mode = lock->l_granted_mode;
+       ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
+                                   &lock->l_policy_data,
+                                   &desc->l_policy_data);
 }
 EXPORT_SYMBOL(ldlm_lock2desc);
 
index 8867dc17532526c3532e4c431116d9c4215f9987..37b86082eb731080d93d267ff2b38ab12ed864bf 100644 (file)
@@ -876,21 +876,8 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
                /* for the local lock, add the reference */
                ldlm_lock_addref_internal(lock, einfo->ei_mode);
                ldlm_lock2handle(lock, lockh);
-               if (policy != NULL) {
-                       /* INODEBITS_INTEROP: If the server does not support
-                        * inodebits, we will request a plain lock in the
-                        * descriptor (ldlm_lock2desc() below) but use an
-                        * inodebits lock internally with both bits set.
-                        */
-                       if (einfo->ei_type == LDLM_IBITS &&
-                           !(exp_connect_flags(exp) &
-                             OBD_CONNECT_IBITS))
-                               lock->l_policy_data.l_inodebits.bits =
-                                       MDS_INODELOCK_LOOKUP |
-                                       MDS_INODELOCK_UPDATE;
-                       else
+               if (policy != NULL)
                                lock->l_policy_data = *policy;
-               }
 
                if (einfo->ei_type == LDLM_EXTENT)
                        lock->l_req_extent = policy->l_extent;
index f522fc5d3a93fb8868fb41a4b929f8fc654b3dbd..771b213b17aef7e9922fd808f8a7a2287eed0d82 100644 (file)
@@ -1024,10 +1024,17 @@ finish:
 
                spin_unlock(&imp->imp_lock);
 
-               if (!ocd->ocd_ibits_known &&
-                   ocd->ocd_connect_flags & OBD_CONNECT_IBITS)
-                       CERROR("Inodebits aware server returned zero compatible"
-                              " bits?\n");
+               if ((imp->imp_connect_flags_orig & OBD_CONNECT_IBITS) &&
+                   !(ocd->ocd_connect_flags & OBD_CONNECT_IBITS)) {
+                       LCONSOLE_WARN("%s: MDS %s does not support ibits "
+                                     "lock, either very old or invalid: "
+                                     "requested %llx, replied %llx\n",
+                                     imp->imp_obd->obd_name,
+                                     imp->imp_connection->c_remote_uuid.uuid,
+                                     imp->imp_connect_flags_orig,
+                                     ocd->ocd_connect_flags);
+                       GOTO(out, rc = -EPROTO);
+               }
 
                if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
                    (ocd->ocd_version > LUSTRE_VERSION_CODE +