From: braam Date: Sun, 30 Jun 2002 03:19:02 +0000 (+0000) Subject: - small issues X-Git-Tag: 0.4.2~21 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=3924751ae33fc90b30c1198924d574d99b180684;p=fs%2Flustre-release.git - small issues - magic and versions into Lustre messages - obdo cleanups, remove unused fields. - small updates to object protocol documentation. --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 4c7b22b2..50c8c5b 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -46,6 +46,9 @@ #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; @@ -121,14 +124,12 @@ struct obdo { 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) diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 0c9d9f2..9b477e0 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -674,11 +674,6 @@ static __inline__ void obdo_cpy_md(struct obdo *dst, struct obdo *src) 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; } diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index c2245e3..98f1408 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -701,7 +701,7 @@ int mds_handle(struct ptlrpc_request *req) 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"); @@ -764,7 +764,18 @@ int mds_handle(struct ptlrpc_request *req) } 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 @@ -774,14 +785,6 @@ out: 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); } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 5612e60..a390c51 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -499,14 +499,6 @@ static inline void filter_from_inode(struct obdo *oa, struct inode *inode) 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; } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index b05d193..487d88e 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -175,23 +175,22 @@ struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, } 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); } diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index ee1e0eb..6106a4c 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -144,6 +144,7 @@ static int handle_incoming_request(struct obd_device *obddev, /* 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; @@ -151,12 +152,34 @@ static int handle_incoming_request(struct obd_device *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) {