Whamcloud - gitweb
b=9879
authorgreen <green>
Tue, 6 Dec 2005 23:05:07 +0000 (23:05 +0000)
committergreen <green>
Tue, 6 Dec 2005 23:05:07 +0000 (23:05 +0000)
r=adilger

Test that we do not receive any plain lock requests from ibits-aware
clients.
Test that client and server have intersecting lock bits, and if not - server
drops IBITS compat flag. (if the flag is set and intersecting list of bits is
zero on client - just error message is issued).
We now also check that we do not return IBITS lock with sync callback to
liblustre clients.

lustre/ldlm/ldlm_lockd.c
lustre/mds/handler.c
lustre/ptlrpc/import.c

index 80d55f0..81d8602 100644 (file)
@@ -715,6 +715,13 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req,
                           "client?\n");
                 GOTO(out, rc = -EPROTO);
         }
+        if (req->rq_export->exp_connect_flags & OBD_CONNECT_IBITS &&
+            dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN) {
+                DEBUG_REQ(D_ERROR, req, "Plain lock request from ibita-aware "
+                          "client?\n");
+                GOTO(out, rc = -EPROTO);
+        }
+
 
         /* INODEBITS_INTEROP: Perform conversion from plain lock to
          * inodebits lock if client does not support them.
@@ -817,7 +824,8 @@ existing_lock:
                 else if (lock->l_granted_mode == lock->l_req_mode)
                         ldlm_add_waiting_lock(lock);
         }
-        if ((dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN) &&
+        if ((dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN ||
+            dlm_req->lock_desc.l_resource.lr_type == LDLM_IBITS) &&
              req->rq_export->exp_libclient) {
                 if (!(lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) ||
                     !(dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK)) {
index f4cded0..d6ad415 100644 (file)
@@ -256,6 +256,13 @@ static int mds_connect_internal(struct obd_export *exp, struct obd_device *obd,
                 data->ocd_connect_flags &= MDS_CONNECT_SUPPORTED;
                 data->ocd_ibits_known &= MDS_INODELOCK_FULL;
 
+                /* If no known bits (which should not happen, probably,
+                   as everybody should support LOOKUP and UPDATE bits at least)
+                   revert to compat mode with plain locks. */
+                if (!data->ocd_ibits_known &&
+                    data->ocd_connect_flags & OBD_CONNECT_IBITS)
+                        data->ocd_connect_flags &= ~OBD_CONNECT_IBITS;
+
                 if (!obd->u.mds.mds_fl_acl)
                         data->ocd_connect_flags &= ~OBD_CONNECT_ACL;
 
index 1213342..4ab7435 100644 (file)
@@ -577,6 +577,11 @@ finish:
                         ocd->ocd_connect_flags);
 
                 imp->imp_connect_data = *ocd;
+                if (!ocd->ocd_ibits_known &&
+                    ocd->ocd_connect_flags & OBD_CONNECT_IBITS)
+                        CERROR("Inodebits aware server returned zero compatible"
+                               " bits?\n");
+
                 exp = class_conn2export(&imp->imp_dlm_handle);
                 LASSERT(exp);
                 exp->exp_connect_flags = ocd->ocd_connect_flags;