Whamcloud - gitweb
Branch: b1_4
authoradilger <adilger>
Fri, 29 Apr 2005 22:28:50 +0000 (22:28 +0000)
committeradilger <adilger>
Fri, 29 Apr 2005 22:28:50 +0000 (22:28 +0000)
Add a similar fix to the mds_connect() to handle NULL connect data, in
case we ever use echo_client against the MDS.

Print out the request for bad connect requests so we can get the source NID.
This was happening at NCSA for a long time and no way to find which client
was trying to conenct.

lustre/ldlm/ldlm_lib.c
lustre/mds/handler.c

index 198eb7e..4e08881 100644 (file)
@@ -545,7 +545,7 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler)
         LASSERT_REQSWAB (req, 0);
         str = lustre_msg_string(req->rq_reqmsg, 0, sizeof(tgtuuid) - 1);
         if (str == NULL) {
-                CERROR("bad target UUID for connect\n");
+                DEBUG_REQ(D_ERROR, req, "bad target UUID for connect\n");
                 GOTO(out, rc = -EINVAL);
         }
 
@@ -556,14 +556,15 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler)
         }
 
         if (!target || target->obd_stopping || !target->obd_set_up) {
-                CERROR("UUID '%s' is not available for connect\n", str);
+                DEBUG_REQ(D_ERROR, req, "UUID '%s' not available for connect\n",
+                          str);
                 GOTO(out, rc = -ENODEV);
         }
 
         LASSERT_REQSWAB (req, 1);
         str = lustre_msg_string(req->rq_reqmsg, 1, sizeof(cluuid) - 1);
         if (str == NULL) {
-                CERROR("bad client UUID for connect\n");
+                DEBUG_REQ(D_ERROR, req, "bad client UUID for connect\n");
                 GOTO(out, rc = -EINVAL);
         }
 
@@ -597,9 +598,6 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler)
         memcpy(&conn, tmp, sizeof conn);
 
         data = lustre_swab_reqbuf(req, 3, sizeof(*data), lustre_swab_connect);
-        if (data == NULL)
-                GOTO(out, rc = -EPROTO);
-
         rc = lustre_pack_reply(req, 1, &size, NULL);
         if (rc)
                 GOTO(out, rc);
@@ -655,8 +653,9 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler)
 
         /* Return only the parts of obd_connect_data that we understand, so the
          * client knows that we don't understand the rest. */
-        memcpy(lustre_msg_buf(req->rq_repmsg, 0, sizeof(*data)), data,
-               sizeof(*data));
+        if (data)
+                memcpy(lustre_msg_buf(req->rq_repmsg, 0, sizeof(*data)), data,
+                       sizeof(*data));
 
         /* If all else goes well, this is our RPC return code. */
         req->rq_status = 0;
index f7739bc..bbc69a3 100644 (file)
@@ -187,11 +187,6 @@ struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
         RETURN(retval);
 }
 
-#ifndef DCACHE_DISCONNECTED
-#define DCACHE_DISCONNECTED DCACHE_NFSD_DISCONNECTED
-#endif
-
-
 /* Look up an entry by inode number. */
 /* this function ONLY returns valid dget'd dentries with an initialized inode
    or errors */
@@ -283,8 +278,10 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd,
         LASSERT(exp);
         med = &exp->exp_mds_data;
 
-        data->ocd_connect_flags &= MDS_CONNECT_SUPPORTED;
-        exp->exp_connect_flags = data->ocd_connect_flags;
+        if (data != NULL) {
+                data->ocd_connect_flags &= MDS_CONNECT_SUPPORTED;
+                exp->exp_connect_flags = data->ocd_connect_flags;
+        }
 
         OBD_ALLOC(mcd, sizeof(*mcd));
         if (!mcd) {
@@ -296,6 +293,7 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd,
         med->med_mcd = mcd;
 
         rc = mds_client_add(obd, &obd->u.mds, med, -1);
+        GOTO(out, rc);
 
 out:
         if (rc) {
@@ -904,7 +902,7 @@ static int mds_sync(struct ptlrpc_request *req)
 
         body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
         if (body == NULL)
-                GOTO(out, rc = -EPROTO);
+                GOTO(out, rc = -EFAULT);
 
         rc = lustre_pack_reply(req, 1, &size, NULL);
         if (rc || OBD_FAIL_CHECK(OBD_FAIL_MDS_SYNC_PACK)) {
@@ -1764,7 +1762,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         }
 
         ping_evictor_start();
-        
+
         sema_init(&mds->mds_quota_info.qi_sem, 1);
         rc = qctxt_init(&mds->mds_quota_ctxt, mds->mds_sb, dqacq_handler);
         if (rc) {
@@ -1773,6 +1771,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
                 GOTO(err_fs, rc);
         }
 
+
         RETURN(0);
 
 err_fs: