#define PTL_RPC_MSG_REQUEST 4711
#define PTL_RPC_MSG_ERR 4712
+#define PTLRPC_MSG_MAGIC (cpu_to_le32(0x0BD00BD0))
+#define PTLRPC_MSG_VERSION (cpu_to_le32(0x00040001))
+
struct lustre_handle {
__u64 addr;
__u64 cookie;
obd_uid o_uid;
obd_gid o_gid;
obd_flag o_flags;
- obd_flag o_obdflags;
obd_count o_nlink;
obd_count o_generation;
+ obd_rdev o_rdev;
obd_flag o_valid; /* hot fields in this obdo */
+ obd_flag o_obdflags;
char o_inline[OBD_INLINESZ];
- char o_obdmd[OBD_OBDMDSZ];
- struct list_head o_list;
- struct obd_ops *o_op;
};
#define OBD_MD_FLALL (0xffffffff)
memcpy(dst->o_inline, src->o_inline, sizeof(src->o_inline));
dst->o_obdflags |= OBD_FL_INLINEDATA;
}
- if ( src->o_valid & OBD_MD_FLOBDMD &&
- src->o_obdflags & OBD_FL_OBDMDEXISTS) {
- memcpy(dst->o_obdmd, src->o_obdmd, sizeof(src->o_obdmd));
- dst->o_obdflags |= OBD_FL_OBDMDEXISTS;
- }
dst->o_valid |= src->o_valid;
}
CDEBUG(D_INODE, "disconnect\n");
OBD_FAIL_RETURN(OBD_FAIL_MDS_DISCONNECT_NET, 0);
rc = target_handle_disconnect(req);
- break;
+ goto out;
case MDS_GETSTATUS:
CDEBUG(D_INODE, "getstatus\n");
}
EXIT;
-out:
+
+ if (!rc) {
+ struct mds_obd *mds = mds_req2mds(req);
+ req->rq_repmsg->last_rcvd = HTON__u64(mds->mds_last_rcvd);
+ req->rq_repmsg->last_committed =
+ HTON__u64(mds->mds_last_committed);
+ CDEBUG(D_INFO, "last_rcvd %Lu, last_committed %Lu, xid %d\n",
+ (unsigned long long)mds->mds_last_rcvd,
+ (unsigned long long)mds->mds_last_committed,
+ cpu_to_le32(req->rq_xid));
+ }
+ out:
/* Still not 100% sure whether we should reply with the server
* last_rcvd or that of this client. I'm not sure it even makes
* a difference on a per-client basis, because last_rcvd is global
CERROR("mds: processing error %d\n", rc);
ptlrpc_error(req->rq_svc, req);
} else {
- struct mds_obd *mds = mds_req2mds(req);
- req->rq_repmsg->last_rcvd = HTON__u64(mds->mds_last_rcvd);
- req->rq_repmsg->last_committed =
- HTON__u64(mds->mds_last_committed);
- CDEBUG(D_INFO, "last_rcvd %Lu, last_committed %Lu, xid %d\n",
- (unsigned long long)mds->mds_last_rcvd,
- (unsigned long long)mds->mds_last_committed,
- cpu_to_le32(req->rq_xid));
CDEBUG(D_NET, "sending reply\n");
ptlrpc_reply(req->rq_svc, req);
}
oa->o_valid |= OBD_MD_FLINLINE;
}
- if (filter_has_obdmd(inode)) {
- /* XXX this will change when we don't store the obdmd in data */
- CDEBUG(D_INFO, "copying obdmd from inode to obdo\n");
- memcpy(oa->o_obdmd, inode->u.ext2_i.i_data,
- MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
- oa->o_obdflags |= OBD_FL_OBDMDEXISTS;
- oa->o_valid |= OBD_MD_FLOBDMD;
- }
#endif
EXIT;
}
}
request->rq_type = PTL_RPC_TYPE_REQUEST;
+ request->rq_client = cl;
request->rq_connection = ptlrpc_connection_addref(conn);
- request->rq_reqmsg->opc = HTON__u32(opcode);
- request->rq_reqmsg->type = HTON__u32(PTL_RPC_MSG_REQUEST);
-
INIT_LIST_HEAD(&request->rq_list);
INIT_LIST_HEAD(&request->rq_multi);
-
/* this will be dec()d once in req_finished, once in free_committed */
atomic_set(&request->rq_refcount, 2);
spin_lock(&conn->c_lock);
request->rq_xid = HTON__u32(++conn->c_xid_out);
- request->rq_xid = conn->c_xid_out;
spin_unlock(&conn->c_lock);
- request->rq_client = cl;
+ request->rq_reqmsg->magic = PTLRPC_MSG_MAGIC;
+ request->rq_reqmsg->version = PTLRPC_MSG_VERSION;
+ request->rq_reqmsg->opc = HTON__u32(opcode);
+ request->rq_reqmsg->type = HTON__u32(PTL_RPC_MSG_REQUEST);
RETURN(request);
}
/* FIXME: If we move to an event-driven model, we should put the request
* on the stack of mds_handle instead. */
start = event->mem_desc.start;
+
memset(&request, 0, sizeof(request));
request.rq_svc = svc;
request.rq_obd = obddev;
request.rq_reqmsg = event->mem_desc.start + event->offset;
request.rq_reqlen = event->mem_desc.length;
+ if (request.rq_reqlen < sizeof(struct lustre_msg)) {
+ CERROR("incomplete request: ptl %d from %Lx xid %Ld\n",
+ svc->srv_req_portal, event->initiator.nid,
+ request.rq_xid);
+ return -EINVAL;
+ }
+
+ if (request.rq_reqmsg->magic != PTLRPC_MSG_MAGIC) {
+ CERROR("wrong lustre_msg magic: ptl %d from %Lx xid %Ld\n",
+ svc->srv_req_portal, event->initiator.nid,
+ request.rq_xid);
+ return -EINVAL;
+ }
+
+ if (request.rq_reqmsg->version != PTLRPC_MSG_VERSION) {
+ CERROR("wrong lustre_msg version: ptl %d from %Lx xid %Ld\n",
+ svc->srv_req_portal, event->initiator.nid,
+ request.rq_xid);
+ return -EINVAL;
+ }
+
CDEBUG(D_NET, "got req %Ld\n", request.rq_xid);
peer.peer_nid = event->initiator.nid;
/* FIXME: this NI should be the incoming NI.
* We don't know how to find that from here. */
peer.peer_ni = svc->srv_self.peer_ni;
+
request.rq_export = gen_client((struct obd_conn *) request.rq_reqmsg);
if (request.rq_export) {