From: Niu Yawei Date: Mon, 21 Jan 2013 09:13:19 +0000 (-0500) Subject: LU-2657 recovery: don't delete objects X-Git-Tag: 1.8.9-wc1~1 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=8add7b00d42ec5b5b366063c5634ec7a9ea059da;p=fs%2Flustre-release.git LU-2657 recovery: don't delete objects In mds_lov_update_objids(), when an data object id gap is detected during recovery, it'll delete all the objects in the gap, which isn't quite correct, because we can't guarantee that the id is always increased by the transno order, furthermore, that could also bring big trouble when the lov_objid file was removed manually (to rebuild the corrupted lov_objid file). Fix type defect in filter_recov_log_unlink_cb(), where oa->o_id should be increased by each loop cycle. Signed-off-by: Niu Yawei Change-Id: I47247a584da10b1434bf7cb24f606073c6afa903 Reviewed-on: http://review.whamcloud.com/5137 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Johann Lombardi --- diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index ee1983d..9494e4c 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -258,46 +258,11 @@ int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm) } EXPORT_SYMBOL(mds_lov_prepare_objids); -/* - * write llog orphan record about lost ost object, - * Special lsm is allocated with single stripe, caller should deallocated it - * after use - */ -static int noinline mds_log_lost_precreated(struct obd_device *obd, - struct lov_stripe_md **lsmp, int *stripes, - obd_id id, obd_count count, int idx) -{ - struct lov_stripe_md *lsm = *lsmp; - int rc; - ENTRY; - - if (*lsmp == NULL) { - rc = obd_alloc_memmd(obd->u.mds.mds_lov_exp, &lsm); - if (rc < 0) - RETURN(rc); - /* need only one stripe, save old value */ - *stripes = lsm->lsm_stripe_count; - lsm->lsm_stripe_count = 1; - *lsmp = lsm; - } - - lsm->lsm_oinfo[0]->loi_id = id; - lsm->lsm_oinfo[0]->loi_gr = 0; /* needed in 2.0 */ - lsm->lsm_oinfo[0]->loi_ost_idx = idx; - - rc = mds_log_op_orphan(obd, lsm, count); - RETURN(rc); -} - void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm) { struct mds_obd *mds = &obd->u.mds; int j; struct lov_ost_data_v1 *lmm_objects; -#ifndef HAVE_DELAYED_RECOVERY - struct lov_stripe_md *lsm = NULL; - int stripes = 0; -#endif ENTRY; /* if we create file without objects - lmm is NULL */ @@ -321,29 +286,19 @@ void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm) CDEBUG(D_INODE,"update last object for ost %u" " - new "LPU64" old "LPU64"\n", i, id, data[idx]); if (id > data[idx]) { -#ifndef HAVE_DELAYED_RECOVERY int lost = id - data[idx] - 1; /* we might have lost precreated objects due to VBR */ if (lost > 0 && obd->obd_recovering) { - CDEBUG(D_HA, "GAP in objids is %u\n", lost); - if (!obd->obd_version_recov) - CWARN("Unexpected gap in objids\n"); - /* lsm is allocated if NULL */ - mds_log_lost_precreated(obd, &lsm, &stripes, - data[idx] + 1, lost, i); + CDEBUG(obd->obd_version_recov ? D_HA:D_WARNING, + "GAP in objids for OST%d, " + "next_id on disk: "LPU64", " + "id to be allocated: "LPU64", " + "lost: %d\n", i, data[idx], id, lost); } -#endif data[idx] = id; cfs_bitmap_set(mds->mds_lov_page_dirty, page); } } -#ifndef HAVE_DELAYED_RECOVERY - if (lsm) { - /* restore stripes number */ - lsm->lsm_stripe_count = stripes; - obd_free_memmd(mds->mds_lov_exp, &lsm); - } -#endif EXIT; return; } diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 19c9a79..861c5bf 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -147,7 +147,6 @@ static int filter_recov_log_unlink_cb(struct llog_ctxt *ctxt, struct obd_export *exp = ctxt->loc_obd->obd_self_export; struct llog_unlink_rec *lur; struct obdo *oa; - obd_id oid; obd_count count; int rc = 0; ENTRY; @@ -160,7 +159,6 @@ static int filter_recov_log_unlink_cb(struct llog_ctxt *ctxt, oa->o_id = lur->lur_oid; oa->o_gr = lur->lur_ogr; oa->o_lcookie = *cookie; - oid = oa->o_id; /* objid gap may require to destroy several objects in row */ count = lur->lur_count + 1; @@ -168,14 +166,14 @@ static int filter_recov_log_unlink_cb(struct llog_ctxt *ctxt, rc = filter_destroy(exp, oa, NULL, NULL, NULL); if (rc == 0) CDEBUG(D_RPCTRACE, "object "LPU64" is destroyed\n", - oid); + oa->o_id); else if (rc != -ENOENT) CEMERG("error destroying object "LPU64": %d\n", - oid, rc); + oa->o_id, rc); else rc = 0; count--; - oid++; + oa->o_id++; } OBDO_FREE(oa);