Whamcloud - gitweb
- Fixed up some OST handler functions to always return a nonzero error when
authorpschwan <pschwan>
Fri, 12 Jul 2002 16:23:03 +0000 (16:23 +0000)
committerpschwan <pschwan>
Fri, 12 Jul 2002 16:23:03 +0000 (16:23 +0000)
  they don't set request->rq_repmsg (this should fix Eric's RPC crash)

lustre/lib/l_net.c
lustre/ost/ost_handler.c

index a76605f..3f3e557 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/lustre_net.h>
 #include <linux/lustre_dlm.h>
 
-
 int target_handle_connect(struct ptlrpc_request *req)
 {
         struct obd_device *target;
@@ -58,13 +57,13 @@ int target_handle_connect(struct ptlrpc_request *req)
         i = class_uuid2dev(uuid);
         if (i == -1) {
                 req->rq_status = -ENODEV;
-                RETURN(-NODEV);
+                RETURN(-ENODEV);
         }
 
         target = &obd_dev[i];
         if (!target) {
                 req->rq_status = -ENODEV;
-                RETURN(0);
+                RETURN(-ENODEV);
         }
 
         conn.addr = req->rq_reqmsg->addr;
@@ -78,7 +77,7 @@ int target_handle_connect(struct ptlrpc_request *req)
         req->rq_repmsg->addr = conn.addr;
         req->rq_repmsg->cookie = conn.cookie;
 
-        export = class_conn2export(&conn); 
+        export = class_conn2export(&conn);
         if (!export)
                 LBUG();
 
@@ -87,7 +86,6 @@ int target_handle_connect(struct ptlrpc_request *req)
         RETURN(0);
 }
 
-
 int target_handle_disconnect(struct ptlrpc_request *req)
 {
         struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
index 11ce4a8..0bdb86c 100644 (file)
@@ -82,20 +82,20 @@ static int ost_statfs(struct ptlrpc_request *req)
         int rc, size = sizeof(*osfs);
         ENTRY;
 
-        rc = lustre_pack_msg(1, &size, NULL, &req->rq_replen, &req->rq_repmsg);
-        if (rc)
-                RETURN(rc);
-
         rc = obd_statfs(conn, &sfs);
         if (rc) {
                 CERROR("ost: statfs failed: rc %d\n", rc);
-                GOTO(out, rc);
+                req->rq_status = rc;
+                RETURN(rc);
         }
+
+        rc = lustre_pack_msg(1, &size, NULL, &req->rq_replen, &req->rq_repmsg);
+        if (rc)
+                RETURN(rc);
+
         osfs = lustre_msg_buf(req->rq_repmsg, 0);
         memset(osfs, 0, size);
         obd_statfs_pack(osfs, &sfs);
-out:
-        req->rq_status = rc;
         RETURN(0);
 }
 
@@ -416,12 +416,12 @@ static int ost_handle(struct ptlrpc_request *req)
 
         rc = lustre_unpack_msg(req->rq_reqmsg, req->rq_reqlen);
         if (rc || OBD_FAIL_CHECK(OBD_FAIL_MDS_HANDLE_UNPACK)) {
-                CERROR("lustre_mds: Invalid request\n");
+                CERROR("lustre_ost: Invalid request\n");
                 GOTO(out, rc);
         }
 
         if (req->rq_reqmsg->type != PTL_RPC_MSG_REQUEST) {
-                CERROR("lustre_mds: wrong packet type sent %d\n",
+                CERROR("lustre_ost: wrong packet type sent %d\n",
                        req->rq_reqmsg->type);
                 GOTO(out, rc = -EINVAL);
         }
@@ -500,10 +500,15 @@ static int ost_handle(struct ptlrpc_request *req)
 out:
         //req->rq_status = rc;
         if (rc) {
-                CERROR("ost: processing error %d\n", rc);
+                CERROR("ost: processing error (opcode=%d): %d\n",
+                       req->rq_reqmsg->opc, rc);
                 ptlrpc_error(req->rq_svc, req);
         } else {
                 CDEBUG(D_INODE, "sending reply\n");
+                if (req->rq_repmsg == NULL)
+                        CERROR("handler for opcode %d returned rc=0 without "
+                               "creating rq_repmsg; needs to return rc != "
+                               "0!\n");
                 ptlrpc_reply(req->rq_svc, req);
         }