#include <linux/lustre_net.h>
#include <linux/lustre_dlm.h>
-
int target_handle_connect(struct ptlrpc_request *req)
{
struct obd_device *target;
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;
req->rq_repmsg->addr = conn.addr;
req->rq_repmsg->cookie = conn.cookie;
- export = class_conn2export(&conn);
+ export = class_conn2export(&conn);
if (!export)
LBUG();
RETURN(0);
}
-
int target_handle_disconnect(struct ptlrpc_request *req)
{
struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
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);
}
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);
}
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);
}