From e7a336c9bf612d793664ee7a99e8c7c53c5455a9 Mon Sep 17 00:00:00 2001 From: yury Date: Fri, 24 Nov 2006 13:29:37 +0000 Subject: [PATCH] - cleanups in lmv: - removed not needed @body initializatiion; - added assert that body field in reply should be swabbed in mdc before using it in lmv. --- lustre/cmm/cmm_split.c | 5 ++--- lustre/llite/dir.c | 6 ++++-- lustre/lmv/lmv_intent.c | 44 ++++++++++++++++++++++---------------- lustre/lmv/lmv_internal.h | 3 ++- lustre/lmv/lmv_obd.c | 7 ++++-- lustre/mdc/mdc_locks.c | 4 ++-- lustre/ptlrpc/gss/gss_svc_upcall.c | 4 ++-- 7 files changed, 42 insertions(+), 31 deletions(-) diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 8951f58..8381040 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -503,8 +503,8 @@ static int cmm_split_read_page(const struct lu_env *env, { int rc; ENTRY; - memset(kmap(rdpg->rp_pages[0]), 0, CFS_PAGE_SIZE); - kunmap(rdpg->rp_pages[0]); + memset(cfs_kmap(rdpg->rp_pages[0]), 0, CFS_PAGE_SIZE); + cfs_kunmap(rdpg->rp_pages[0]); rc = mo_readpage(env, md_object_next(mo), rdpg); RETURN(rc); } @@ -513,7 +513,6 @@ static int cmm_split_read_page(const struct lu_env *env, * This function performs migration of all pages with entries which fit into one * stripe and one hash segment. */ - static int cmm_split_process_stripe(const struct lu_env *env, struct md_object *mo, struct lu_rdpg *rdpg, diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index b07894b..853c1e5 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -158,8 +158,10 @@ static int ll_dir_readpage(struct file *file, struct page *page) if (!rc) { body = lustre_msg_buf(request->rq_repmsg, REPLY_REC_OFF, sizeof(*body)); - LASSERT(body != NULL); /* checked by md_readpage() */ - /* swabbed by md_readpage() */ + /* Checked by mdc_readpage() */ + LASSERT(body != NULL); + + /* Swabbed by mdc_readpage() */ LASSERT_REPSWABBED(request, REPLY_REC_OFF); if (body->valid & OBD_MD_FLSIZE) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index c64f05e..d1439a1 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -63,16 +63,17 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; struct ptlrpc_request *req = NULL; - struct mdt_body *body = NULL; struct lustre_handle plock; struct md_op_data *op_data; struct obd_export *tgt_exp; + struct mdt_body *body; int pmode, rc = 0; ENTRY; body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); + LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); if (!(body->valid & OBD_MD_MDS)) RETURN(0); @@ -183,12 +184,12 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, int extra_lock_flags) { struct obd_device *obd = exp->exp_obd; - struct obd_export *tgt_exp; struct lu_fid rpid = op_data->op_fid1; struct lmv_obd *lmv = &obd->u.lmv; - struct mdt_body *body = NULL; struct md_op_data *sop_data; + struct obd_export *tgt_exp; struct lmv_stripe_md *mea; + struct mdt_body *body; struct lmv_obj *obj; int rc, loop = 0; ENTRY; @@ -306,6 +307,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); /* could not find object, FID is not present in response. */ if (!(body->valid & OBD_MD_FLID)) @@ -351,9 +353,9 @@ int lmv_intent_getattr(struct obd_export *exp, struct md_op_data *op_data, struct obd_device *obd = exp->exp_obd; struct lu_fid rpid = op_data->op_fid1; struct lmv_obd *lmv = &obd->u.lmv; - struct mdt_body *body = NULL; struct md_op_data *sop_data; struct lmv_stripe_md *mea; + struct mdt_body *body; mdsno_t mds; int rc = 0; ENTRY; @@ -474,6 +476,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); /* could not find object, FID is not present in response. */ if (!(body->valid & OBD_MD_FLID)) @@ -517,11 +520,11 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; - struct mdt_body *body = NULL; struct lustre_handle *lockh; struct md_op_data *op_data; struct ldlm_lock *lock; struct mdt_body *body2; + struct mdt_body *body; struct lmv_obj *obj; int i, rc = 0; ENTRY; @@ -529,15 +532,17 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp) LASSERT(reqp); LASSERT(*reqp); - /* master is locked. we'd like to take locks on slaves and update + /* + * Master is locked. we'd like to take locks on slaves and update * attributes to be returned from the slaves it's important that lookup * is called in two cases: * - for first time (dcache has no such a resolving yet). - * ->d_revalidate() returned false. - * last case possible only if all the objs (master and all slaves aren't - * valid */ + * Last case possible only if all the objs (master and all slaves aren't + * valid. + */ OBD_ALLOC_PTR(op_data); if (op_data == NULL) @@ -546,8 +551,9 @@ 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((body->valid & OBD_MD_FLID) != 0); + LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); + LASSERT((body->valid & OBD_MD_FLID) != 0); obj = lmv_obj_grab(obd, &body->fid1); LASSERT(obj != NULL); @@ -603,7 +609,8 @@ 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); + LASSERT(body2 != NULL); + LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); obj->lo_inodes[i].li_size = body2->size; @@ -640,9 +647,9 @@ int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, struct obd_device *obd = exp->exp_obd; struct lu_fid rpid = op_data->op_fid1; struct lmv_obd *lmv = &obd->u.lmv; - struct mdt_body *body = NULL; struct md_op_data *sop_data; struct lmv_stripe_md *mea; + struct mdt_body *body; struct lmv_obj *obj; int rc, loop = 0; int mea_idx; @@ -776,15 +783,11 @@ repeat: cb_blocking, extra_lock_flags); if (rc == 0 && (mea = lmv_get_mea(*reqp, DLM_REPLY_REC_OFF))) { - /* wow! this is split dir, we'd like to handle it */ - body = lustre_msg_buf((*reqp)->rq_repmsg, - DLM_REPLY_REC_OFF, sizeof(*body)); - LASSERT(body != NULL); - LASSERT((body->valid & OBD_MD_FLID) != 0); - + /* Wow! This is split dir, we'd like to handle it. */ body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); + LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); LASSERT((body->valid & OBD_MD_FLID) != 0); obj = lmv_obj_grab(obd, &body->fid1); @@ -905,6 +908,7 @@ 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); goto update; } /* take already cached attrs into account */ @@ -965,7 +969,8 @@ 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); + LASSERT(body != NULL); + LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); update: obj->lo_inodes[i].li_size = body->size; @@ -994,7 +999,8 @@ release_lock: body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); - LASSERT(body); + LASSERT(body != NULL); + LASSERT_REPSWABBED((*reqp), DLM_REPLY_REC_OFF); body->size = size; diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 643330d..11aad07 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -155,13 +155,14 @@ 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); if (!body || !S_ISDIR(body->mode) || !body->eadatasize) return NULL; mea = lustre_msg_buf(req->rq_repmsg, offset + 1, body->eadatasize); - LASSERT(mea); + LASSERT(mea != NULL); if (mea->mea_count == 0) return NULL; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 3f6fd59..b06b2ce 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1149,6 +1149,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); lmv_obj_lock(obj); @@ -1454,17 +1455,18 @@ lmv_enqueue_remote(struct obd_export *exp, int lock_type, struct ptlrpc_request *req = it->d.lustre.it_data; struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; - struct mdt_body *body = NULL; struct lustre_handle plock; struct obd_export *tgt_exp; struct md_op_data *rdata; - int rc = 0, pmode; struct lu_fid fid_copy; + struct mdt_body *body; + int rc = 0, pmode; ENTRY; body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); + LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); if (!(body->valid & OBD_MD_MDS)) RETURN(0); @@ -1614,6 +1616,7 @@ repeat: body = lustre_msg_buf((*request)->rq_repmsg, REQ_REC_OFF, sizeof(*body)); LASSERT(body != NULL); + LASSERT_REPSWABBED((*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 90223c7..4e2c801 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -366,8 +366,8 @@ int mdc_enqueue(struct obd_export *exp, repsize[repbufcnt++] = obddev->u.cli.cl_max_mds_cookiesize; } else if (it->it_op & (IT_GETATTR | IT_LOOKUP)) { obd_valid valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE | - OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA | - OBD_MD_FLMDSCAPA | OBD_MD_MEA;; + OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA | + OBD_MD_FLMDSCAPA | OBD_MD_MEA; valid |= client_is_remote(exp) ? OBD_MD_FLRMTPERM : OBD_MD_FLACL; size[DLM_INTENT_REC_OFF] = sizeof(struct mdt_body); diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index ce49c96..e79f78b 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -976,8 +976,8 @@ int __init gss_svc_init_upcall(void) } if (atomic_read(&rsi_cache.readers) == 0) - CWARN("init channel is not opened by lsvcgssd, following " - "request might be dropped until lsvcgssd be active\n"); + CWARN("Init channel is not opened by lsvcgssd, following " + "request might be dropped until lsvcgssd is active\n"); return 0; } -- 1.8.3.1