From: bobijam Date: Thu, 25 Oct 2007 03:03:57 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_7_0_51~575 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f50d3d56f80184bc21f729e1640422d6a2a31158 Branch HEAD b=13497 i=deen i=johann Description: LASSERT_{REQ,REP}SWAB macros are buggy Details : If SWAB_PARANOIA is disabled, the LASSERT_REQSWAB and LASSERT_REPSWAB macros become no-ops, which is incorrect. Drop these macros and replace them with their difinitions instead. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 0f4eec7..08114f2 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -13,6 +13,13 @@ * Note that reiserfs quotas are disabled on SLES 10 in this kernel. Severity : normal +Bugzilla : 13497 +Description: LASSERT_{REQ,REP}SWAB macros are buggy +Details : If SWAB_PARANOIA is disabled, the LASSERT_REQSWAB and + LASSERT_REPSWAB macros become no-ops, which is incorrect. Drop + these macros and replace them with their difinitions instead. + +Severity : normal Bugzilla : 13521 Description: Update kernel patches for SLES10 2.6.16.53-0.8. Details : Update which_patch & target file for SLES10 latest kernel. diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index a7ed10a..b91714c 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -443,24 +443,6 @@ static inline int lustre_rep_swabbed(struct ptlrpc_request *req, int index) return req->rq_rep_swab_mask & (1 << index); } -#define SWAB_PARANOIA 1 - -#if SWAB_PARANOIA -/* unpacking: assert idx not unpacked already */ -#define LASSERT_REQSWAB(rq, idx) lustre_set_req_swabbed(rq, idx) -#define LASSERT_REPSWAB(rq, idx) lustre_set_rep_swabbed(rq, idx) - -/* just looking: assert idx already unpacked */ -#define LASSERT_REQSWABBED(rq, idx) LASSERT(lustre_req_swabbed(rq, idx)) -#define LASSERT_REPSWABBED(rq, idx) LASSERT(lustre_rep_swabbed(rq, idx)) - -#else -#define LASSERT_REQSWAB(rq, idx) -#define LASSERT_REPSWAB(rq, idx) -#define LASSERT_REQSWABBED(rq, idx) -#define LASSERT_REPSWABBED(rq, idx) -#endif - static inline const char * ptlrpc_rqphase2str(const struct ptlrpc_request *req) { diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index c15e088..f8d8145 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -578,7 +578,7 @@ int target_handle_connect(struct ptlrpc_request *req) OBD_RACE(OBD_FAIL_TGT_CONN_RACE); - LASSERT_REQSWAB(req, REQ_REC_OFF); + lustre_set_req_swabbed(req, REQ_REC_OFF); str = lustre_msg_string(req->rq_reqmsg, REQ_REC_OFF, sizeof(tgtuuid)-1); if (str == NULL) { DEBUG_REQ(D_ERROR, req, "bad target UUID for connect"); @@ -611,7 +611,7 @@ int target_handle_connect(struct ptlrpc_request *req) Really, class_uuid2obd should take the ref. */ targref = class_incref(target); - LASSERT_REQSWAB(req, REQ_REC_OFF + 1); + lustre_set_req_swabbed(req, REQ_REC_OFF + 1); str = lustre_msg_string(req->rq_reqmsg, REQ_REC_OFF + 1, sizeof(cluuid) - 1); if (str == NULL) { diff --git a/lustre/liblustre/dir.c b/lustre/liblustre/dir.c index dc56597..0953c12 100644 --- a/lustre/liblustre/dir.c +++ b/lustre/liblustre/dir.c @@ -112,7 +112,7 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page) sizeof(*body)); LASSERT(body != NULL); /* checked by md_readpage() */ /* swabbed by md_readpage() */ - LASSERT_REPSWABBED(request, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(request, REPLY_REC_OFF)); st->st_size = body->size; } else { diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index a1d50da..891bdf7 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -149,7 +149,8 @@ int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it) body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); /* reply already checked out */ - LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); /* and swabbed down */ + /* and swabbed down */ + LASSERT(lustre_rep_swabbed(req, DLM_REPLY_REC_OFF)); /* already opened? */ if (lli->lli_open_count++) diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 00621f1..1224725 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -967,7 +967,7 @@ static int llu_readlink_internal(struct inode *inode, body = lustre_msg_buf((*request)->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED(*request, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*request, REPLY_REC_OFF)); if ((body->valid & OBD_MD_LINKNAME) == 0) { CERROR ("OBD_MD_LINKNAME not set on reply\n"); diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index b84b877..da23ebf 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -164,7 +164,7 @@ static int ll_dir_readpage(struct file *file, struct page *page) LASSERT(body != NULL); /* Swabbed by mdc_readpage() */ - LASSERT_REPSWABBED(request, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(request, REPLY_REC_OFF)); if (body->valid & OBD_MD_FLSIZE) i_size_write(inode, body->size); @@ -660,7 +660,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); /* checked by md_getattr_name */ /* swabbed by mdc_getattr_name */ - LASSERT_REPSWABBED(req, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF)); lmmsize = body->eadatasize; @@ -671,7 +671,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, lmm = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF + 1, lmmsize); LASSERT(lmm != NULL); - LASSERT_REPSWABBED(req, REPLY_REC_OFF + 1); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF + 1)); /* * This is coming from the MDS, so is probably in @@ -803,7 +803,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); /* checked by md_getattr_name */ /* swabbed by md_getattr_name */ - LASSERT_REPSWABBED(request, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(request, REPLY_REC_OFF)); } else { GOTO(out_req, rc); } diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 05afdd0..ad10402 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -387,8 +387,10 @@ static int ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli, LASSERT(och); body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); - LASSERT(body != NULL); /* reply already checked out */ - LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); /* and swabbed in md_enqueue */ + /* reply already checked out */ + LASSERT(body != NULL); + /* and swabbed in md_enqueue */ + LASSERT(lustre_rep_swabbed(req, DLM_REPLY_REC_OFF)); memcpy(&och->och_fh, &body->handle, sizeof(body->handle)); och->och_magic = OBD_CLIENT_HANDLE_MAGIC; @@ -1796,7 +1798,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); /* checked by mdc_getattr_name */ /* swabbed by mdc_getattr_name */ - LASSERT_REPSWABBED(req, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF)); lmmsize = body->eadatasize; @@ -1807,7 +1809,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, lmm = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF + 1, lmmsize); LASSERT(lmm != NULL); - LASSERT_REPSWABBED(req, REPLY_REC_OFF + 1); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF + 1)); /* * This is coming from the MDS, so is probably in diff --git a/lustre/llite/remote_perm.c b/lustre/llite/remote_perm.c index 2207bf8..ac0aec0 100644 --- a/lustre/llite/remote_perm.c +++ b/lustre/llite/remote_perm.c @@ -272,7 +272,7 @@ check: perm = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF + 1, sizeof(*perm)); LASSERT(perm); - LASSERT_REPSWABBED(req, REPLY_REC_OFF + 1); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF + 1)); rc = ll_update_remote_perm(inode, perm); up(&lli->lli_rmtperm_sem); diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index b58a5d3..7c9c1d3 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -60,7 +60,7 @@ static int ll_readlink_internal(struct inode *inode, body = lustre_msg_buf((*request)->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED(*request, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*request, REPLY_REC_OFF)); if ((body->valid & OBD_MD_LINKNAME) == 0) { CERROR("OBD_MD_LINKNAME not set on reply\n"); diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index db7deb7..c040923 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -257,7 +257,7 @@ do_getxattr: body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body); - LASSERT_REPSWABBED(req, REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, REPLY_REC_OFF)); /* only detect the xattr size */ if (size == 0) @@ -276,7 +276,7 @@ do_getxattr: } /* do not need swab xattr data */ - LASSERT_REPSWAB(req, REPLY_REC_OFF + 1); + lustre_set_rep_swabbed(req, REPLY_REC_OFF + 1); xdata = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF + 1, body->eadatasize); if (!xdata) { diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index ccc6d1b..14f68b6 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -73,7 +73,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); if (!(body->valid & OBD_MD_MDS)) RETURN(0); @@ -315,7 +315,7 @@ repeat: body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); /* could not find object, FID is not present in response. */ if (!(body->valid & OBD_MD_FLID)) @@ -484,7 +484,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); /* could not find object, FID is not present in response. */ if (!(body->valid & OBD_MD_FLID)) @@ -553,7 +553,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp) body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); LASSERT((body->valid & OBD_MD_FLID) != 0); obj = lmv_obj_grab(obd, &body->fid1); @@ -612,7 +612,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp) body2 = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body2)); LASSERT(body2 != NULL); - LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, DLM_REPLY_REC_OFF)); obj->lo_inodes[i].li_size = body2->size; @@ -790,7 +790,7 @@ repeat: body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); LASSERT((body->valid & OBD_MD_FLID) != 0); obj = lmv_obj_grab(obd, &body->fid1); @@ -915,7 +915,8 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED(mreq, DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed( + mreq, DLM_REPLY_REC_OFF)); goto update; } /* take already cached attrs into account */ @@ -978,7 +979,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp, body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, DLM_REPLY_REC_OFF)); update: obj->lo_inodes[i].li_size = body->size; @@ -1008,7 +1009,7 @@ release_lock: body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*reqp, DLM_REPLY_REC_OFF)); body->size = size; diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 7e8510f..c8b28b4 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -155,7 +155,7 @@ lmv_get_mea(struct ptlrpc_request *req, int offset) LASSERT(req); body = lustre_msg_buf(req->rq_repmsg, offset, sizeof(*body)); - LASSERT_REPSWABBED(req, offset); + LASSERT(lustre_rep_swabbed(req, offset)); if (!body || !S_ISDIR(body->mode) || !body->eadatasize) return NULL; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 7a7da61..2fe0c7a 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1196,7 +1196,7 @@ static int lmv_getattr(struct obd_export *exp, const struct lu_fid *fid, body = lustre_msg_buf((*request)->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*request), REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(*request, REPLY_REC_OFF)); lmv_obj_lock(obj); @@ -1515,7 +1515,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo, body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(req, DLM_REPLY_REC_OFF)); if (!(body->valid & OBD_MD_MDS)) RETURN(0); @@ -1659,7 +1659,7 @@ repeat: body = lustre_msg_buf((*request)->rq_repmsg, REQ_REC_OFF, sizeof(*body)); LASSERT(body != NULL); - LASSERT_REPSWABBED((*request), REQ_REC_OFF); + LASSERT(lustre_rep_swabbed(*request, REQ_REC_OFF)); if (body->valid & OBD_MD_MDS) { struct ptlrpc_request *req = NULL; diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index b9ec6d1..82ad397 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -470,7 +470,8 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, lockrep = lustre_msg_buf(req->rq_repmsg, DLM_LOCKREPLY_OFF, sizeof(*lockrep)); LASSERT(lockrep != NULL); /* checked by ldlm_cli_enqueue() */ - LASSERT_REPSWABBED(req, DLM_LOCKREPLY_OFF); /* swabbed by ldlm_cli_enqueue() */ + /* swabbed by ldlm_cli_enqueue() */ + LASSERT(lustre_rep_swabbed(req, DLM_LOCKREPLY_OFF)); it->d.lustre.it_disposition = (int)lockrep->lock_policy_res1; it->d.lustre.it_status = (int)lockrep->lock_policy_res2; @@ -771,8 +772,10 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, mdt_body = lustre_msg_buf(request->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*mdt_body)); - LASSERT(mdt_body != NULL); /* mdc_enqueue checked */ - LASSERT_REPSWABBED(request, 1); /* mdc_enqueue swabbed */ + /* mdc_enqueue checked */ + LASSERT(mdt_body != NULL); + /* mdc_enqueue swabbed */ + LASSERT(lustre_rep_swabbed(request, 1)); /* If we were revalidating a fid/name pair, mark the intent in * case we fail and get called again from lookup */ diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 3833e26..dfcb26b 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -188,7 +188,7 @@ static int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size, CDEBUG(D_NET, "mode: %o\n", body->mode); offset = REPLY_REC_OFF + 1; - LASSERT_REPSWAB(req, offset); + lustre_set_rep_swabbed(req, offset); if (body->eadatasize != 0) { /* reply indicates presence of eadata; check it's there... */ eadata = lustre_msg_buf(req->rq_repmsg, offset++, @@ -499,7 +499,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, md->body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*md->body)); LASSERT (md->body != NULL); - LASSERT_REPSWABBED(req, offset); + LASSERT(lustre_rep_swabbed(req, offset)); offset++; if (md->body->valid & OBD_MD_FLEASIZE) { @@ -522,7 +522,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, CERROR ("incorrect message: lmm == 0\n"); GOTO(out, rc = -EPROTO); } - LASSERT_REPSWABBED(req, offset); + LASSERT(lustre_rep_swabbed(req, offset)); rc = obd_unpackmd(dt_exp, &md->lsm, lmm, lmmsize); if (rc < 0) @@ -557,7 +557,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, GOTO(out, rc = -EPROTO); } - LASSERT_REPSWABBED(req, offset); + LASSERT(lustre_rep_swabbed(req, offset)); rc = obd_unpackmd(md_exp, (void *)&md->mea, lmv, lmvsize); @@ -759,7 +759,7 @@ int mdc_set_open_replay_data(struct obd_export *exp, LASSERT(rec != NULL); /* Incoming message in my byte order (it's been swabbed). */ - LASSERT_REPSWABBED(open_req, DLM_REPLY_REC_OFF); + LASSERT(lustre_rep_swabbed(open_req, DLM_REPLY_REC_OFF)); /* Outgoing messages always in my byte order. */ LASSERT(body != NULL); diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 1df9743..eebf615 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -764,8 +764,8 @@ static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode, LASSERT(offset == REQ_REC_OFF); /* non-intent */ body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body)); - LASSERT(body != NULL); /* checked by caller */ - LASSERT_REQSWABBED(req, offset); /* swabbed by caller */ + LASSERT(body != NULL); /* checked by caller */ + LASSERT(lustre_req_swabbed(req, offset)); /* swabbed by caller */ if ((S_ISREG(inode->i_mode) && (body->valid & OBD_MD_FLEASIZE)) || (S_ISDIR(inode->i_mode) && (body->valid & OBD_MD_FLDIREA))) { @@ -865,7 +865,7 @@ static int mds_getattr_lock(struct ptlrpc_request *req, int offset, RETURN(-EFAULT); } - LASSERT_REQSWAB(req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (name == NULL) { CERROR("Can't unpack name\n"); diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c index b423941..6688f9e 100644 --- a/lustre/mds/mds_lib.c +++ b/lustre/mds/mds_lib.c @@ -117,7 +117,7 @@ static int mds_setattr_unpack(struct ptlrpc_request *req, int offset, LTIME_S(attr->ia_ctime) = rec->sa_ctime; r->ur_flags = rec->sa_attr_flags; - LASSERT_REQSWAB (req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_eadatalen = lustre_msg_buflen(req->rq_reqmsg, offset + 1); if (r->ur_eadatalen) { r->ur_eadata = lustre_msg_buf(req->rq_reqmsg, offset + 1, 0); @@ -165,13 +165,13 @@ static int mds_create_unpack(struct ptlrpc_request *req, int offset, r->ur_time = rec->cr_time; r->ur_flags = rec->cr_flags; - LASSERT_REQSWAB(req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (r->ur_name == NULL) RETURN (-EFAULT); r->ur_namelen = lustre_msg_buflen(req->rq_reqmsg, offset + 1); - LASSERT_REQSWAB(req, offset + 2); + lustre_set_req_swabbed(req, offset + 2); r->ur_tgtlen = lustre_msg_buflen(req->rq_reqmsg, offset + 2); if (r->ur_tgtlen) { /* NB for now, we only seem to pass NULL terminated symlink @@ -217,7 +217,7 @@ static int mds_link_unpack(struct ptlrpc_request *req, int offset, r->ur_fid2 = &rec->lk_fid2; r->ur_time = rec->lk_time; - LASSERT_REQSWAB(req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (r->ur_name == NULL) RETURN (-EFAULT); @@ -255,7 +255,7 @@ static int mds_unlink_unpack(struct ptlrpc_request *req, int offset, r->ur_fid2 = &rec->ul_fid2; r->ur_time = rec->ul_time; - LASSERT_REQSWAB(req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (r->ur_name == NULL) RETURN(-EFAULT); @@ -293,13 +293,13 @@ static int mds_rename_unpack(struct ptlrpc_request *req, int offset, r->ur_fid2 = &rec->rn_fid2; r->ur_time = rec->rn_time; - LASSERT_REQSWAB (req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (r->ur_name == NULL) RETURN(-EFAULT); r->ur_namelen = lustre_msg_buflen(req->rq_reqmsg, offset + 1); - LASSERT_REQSWAB (req, offset + 2); + lustre_set_req_swabbed(req, offset + 2); r->ur_tgt = lustre_msg_string(req->rq_reqmsg, offset + 2, 0); if (r->ur_tgt == NULL) RETURN(-EFAULT); @@ -339,13 +339,13 @@ static int mds_open_unpack(struct ptlrpc_request *req, int offset, r->ur_time = rec->cr_time; r->ur_flags = rec->cr_flags; - LASSERT_REQSWAB(req, offset + 1); + lustre_set_req_swabbed(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); if (r->ur_name == NULL) RETURN(-EFAULT); r->ur_namelen = lustre_msg_buflen(req->rq_reqmsg, offset + 1); - LASSERT_REQSWAB(req, offset + 2); + lustre_set_req_swabbed(req, offset + 2); r->ur_eadatalen = lustre_msg_buflen(req->rq_reqmsg, offset + 2); if (r->ur_eadatalen) { r->ur_eadata = lustre_msg_buf(req->rq_reqmsg, offset + 2, 0); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index ad5ec80..34c877b 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2813,7 +2813,7 @@ static int osc_enqueue_fini(struct ptlrpc_request *req, struct obd_info *oinfo, struct ldlm_reply *rep; /* swabbed by ldlm_cli_enqueue() */ - LASSERT_REPSWABBED(req, DLM_LOCKREPLY_OFF); + LASSERT(lustre_rep_swabbed(req, DLM_LOCKREPLY_OFF)); rep = lustre_msg_buf(req->rq_repmsg, DLM_LOCKREPLY_OFF, sizeof(*rep)); LASSERT(rep != NULL); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 0beb1ac..833efef 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -960,7 +960,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) GOTO(out, rc = -EFAULT); } - LASSERT_REQSWAB(req, REQ_REC_OFF + 1); + lustre_set_req_swabbed(req, REQ_REC_OFF + 1); objcount = lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1) / sizeof(*ioo); if (objcount == 0) { diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index d41c6c9..bd35514 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -640,10 +640,9 @@ static int after_reply(struct ptlrpc_request *req) /* NB Until this point, the whole of the incoming message, * including buflens, status etc is in the sender's byte order. */ -#if SWAB_PARANOIA /* Clear reply swab mask; this is a new reply in sender's byte order */ req->rq_rep_swab_mask = 0; -#endif + rc = sptlrpc_cli_unwrap_reply(req); if (rc) { DEBUG_REQ(D_ERROR, req, "unwrap reply failed (%d):", rc); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index e97580e..e4ff115 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -983,14 +983,14 @@ void *lustre_swab_buf(struct lustre_msg *msg, int index, int min_size, void *lustre_swab_reqbuf(struct ptlrpc_request *req, int index, int min_size, void *swabber) { - LASSERT_REQSWAB(req, index); + lustre_set_req_swabbed(req, index); return lustre_swab_buf(req->rq_reqmsg, index, min_size, swabber); } void *lustre_swab_repbuf(struct ptlrpc_request *req, int index, int min_size, void *swabber) { - LASSERT_REPSWAB(req, index); + lustre_set_rep_swabbed(req, index); return lustre_swab_buf(req->rq_repmsg, index, min_size, swabber); } diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 04cd9f6..dc1106e 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -607,10 +607,9 @@ ptlrpc_server_handle_request(struct ptlrpc_service *svc, LBUG(); } -#if SWAB_PARANOIA /* Clear request swab mask; this is a new request */ request->rq_req_swab_mask = 0; -#endif + rc = lustre_unpack_msg(request->rq_reqmsg, request->rq_reqlen); if (rc != 0) { CERROR ("error unpacking request: ptl %d from %s"