From: tappro Date: Fri, 17 Jul 2009 07:35:46 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_220~4 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=2df78a6bed71281526a86611e30bfb11b2f545a3 Branch HEAD b=17666 i=shadow i=fanyong Port patch from 1.8. It tracks objid gaps and delete objects from gap on OST using llog unlink records. --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 22712d9..7cc39e1 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -2281,7 +2281,7 @@ struct llog_create_rec { struct llog_rec_hdr lcr_hdr; struct ll_fid lcr_fid; obd_id lcr_oid; - obd_count lcr_ogen; + obd_count lcr_ogr; __u32 padding; struct llog_rec_tail lcr_tail; } __attribute__((packed)); @@ -2297,15 +2297,15 @@ struct llog_orphan_rec { struct llog_unlink_rec { struct llog_rec_hdr lur_hdr; obd_id lur_oid; - obd_count lur_ogen; - __u32 padding; + obd_count lur_ogr; + obd_count lur_count; struct llog_rec_tail lur_tail; } __attribute__((packed)); struct llog_setattr_rec { struct llog_rec_hdr lsr_hdr; obd_id lsr_oid; - obd_count lsr_ogen; + obd_count lsr_ogr; __u32 lsr_uid; __u32 lsr_gid; __u32 padding; @@ -2315,7 +2315,7 @@ struct llog_setattr_rec { struct llog_setattr64_rec { struct llog_rec_hdr lsr_hdr; obd_id lsr_oid; - obd_count lsr_ogen; + obd_count lsr_ogr; __u32 padding; __u32 lsr_uid; __u32 lsr_uid_h; diff --git a/lustre/include/lustre_mds.h b/lustre/include/lustre_mds.h index 1fefb2b..b0b9a6a 100644 --- a/lustre/include/lustre_mds.h +++ b/lustre/include/lustre_mds.h @@ -74,6 +74,8 @@ struct mds_capa_info { int mds_lov_write_objids(struct obd_device *obd); int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm); void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm); +int mds_log_op_unlink(struct obd_device *, struct lov_mds_md *, int, + struct llog_cookie *, int); #define MDD_OBD_NAME "mdd_obd" diff --git a/lustre/lov/lov_log.c b/lustre/lov/lov_log.c index 23441a8..0300c02 100644 --- a/lustre/lov/lov_log.c +++ b/lustre/lov/lov_log.c @@ -92,19 +92,19 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec, case MDS_UNLINK_REC: { struct llog_unlink_rec *lur = (struct llog_unlink_rec *)rec; lur->lur_oid = loi->loi_id; - lur->lur_ogen = loi->loi_gr; + lur->lur_ogr = loi->loi_gr; break; } case MDS_SETATTR_REC: { struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec; lsr->lsr_oid = loi->loi_id; - lsr->lsr_ogen = loi->loi_gr; + lsr->lsr_ogr = loi->loi_gr; break; } case MDS_SETATTR64_REC: { struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec; lsr->lsr_oid = loi->loi_id; - lsr->lsr_ogen = loi->loi_gr; + lsr->lsr_ogr = loi->loi_gr; break; } default: diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index bb2e1a8..bbf079a 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -644,7 +644,7 @@ int mdd_lov_destroy(const struct lu_env *env, struct mdd_device *mdd, } ma->ma_valid = MA_LOV; - + rc = mdd_unlink_log(env, mdd, obj, ma); if (rc) { CWARN("mds unlink log for "DFID" failed: %d\n", @@ -659,54 +659,13 @@ int mdd_lov_destroy(const struct lu_env *env, struct mdd_device *mdd, RETURN(rc); } -int mdd_log_op_unlink(struct obd_device *obd, - struct lov_mds_md *lmm, int lmm_size, - struct llog_cookie *logcookies, int cookies_size) -{ - struct mds_obd *mds = &obd->u.mds; - struct lov_stripe_md *lsm = NULL; - struct llog_unlink_rec *lur; - struct llog_ctxt *ctxt; - int rc; - ENTRY; - - if (IS_ERR(mds->mds_osc_obd)) - RETURN(PTR_ERR(mds->mds_osc_obd)); - - rc = obd_unpackmd(mds->mds_osc_exp, &lsm, lmm, lmm_size); - if (rc < 0) - RETURN(rc); - rc = obd_checkmd(mds->mds_osc_exp, obd->obd_self_export, lsm); - if (rc) - GOTO(out, rc); - /* first prepare unlink log record */ - OBD_ALLOC(lur, sizeof(*lur)); - if (!lur) - GOTO(out, rc = -ENOMEM); - lur->lur_hdr.lrh_len = lur->lur_tail.lrt_len = sizeof(*lur); - lur->lur_hdr.lrh_type = MDS_UNLINK_REC; - - ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT); - rc = llog_add(ctxt, &lur->lur_hdr, lsm, logcookies, - cookies_size / sizeof(struct llog_cookie)); - llog_ctxt_put(ctxt); - - OBD_FREE(lur, sizeof(*lur)); - GOTO(out, rc); -out: - obd_free_memmd(mds->mds_osc_exp, &lsm); - return rc; -} - int mdd_unlink_log(const struct lu_env *env, struct mdd_device *mdd, struct mdd_object *mdd_cobj, struct md_attr *ma) { - struct obd_device *obd = mdd2obd_dev(mdd); - LASSERT(ma->ma_valid & MA_LOV); if ((ma->ma_cookie_size > 0) && - (mdd_log_op_unlink(obd, ma->ma_lmm, ma->ma_lmm_size, + (mds_log_op_unlink(mdd2obd_dev(mdd), ma->ma_lmm, ma->ma_lmm_size, ma->ma_cookie, ma->ma_cookie_size) > 0)) { CDEBUG(D_HA, "DEBUG: unlink log is added for object "DFID"\n", PFID(mdd_object_fid(mdd_cobj))); @@ -716,8 +675,8 @@ int mdd_unlink_log(const struct lu_env *env, struct mdd_device *mdd, } int mdd_log_op_setattr(struct obd_device *obd, __u32 uid, __u32 gid, - struct lov_mds_md *lmm, int lmm_size, - struct llog_cookie *logcookies, int cookies_size) + struct lov_mds_md *lmm, int lmm_size, + struct llog_cookie *logcookies, int cookies_size) { struct mds_obd *mds = &obd->u.mds; struct lov_stripe_md *lsm = NULL; diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 309a48e..3c27e16 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -48,6 +48,7 @@ int mds_llog_init(struct obd_device *obd, struct obd_llog_group *olg, struct obd_device *tgt, int *index); int mds_llog_finish(struct obd_device *obd, int count); int mds_changelog_llog_init(struct obd_device *obd, struct obd_device *tgt); +int mds_log_op_orphan(struct obd_device *, struct lov_stripe_md *, obd_count); /* mds/mds_lov.c */ int mds_lov_connect(struct obd_device *obd, char * lov_name); diff --git a/lustre/mds/mds_log.c b/lustre/mds/mds_log.c index 0a305b2..17393d2 100644 --- a/lustre/mds/mds_log.c +++ b/lustre/mds/mds_log.c @@ -262,3 +262,71 @@ int mds_llog_finish(struct obd_device *obd, int count) RETURN(rc); } + +static int mds_llog_add_unlink(struct obd_device *obd, + struct lov_stripe_md *lsm, obd_count count, + struct llog_cookie *logcookie, int cookies) +{ + struct llog_unlink_rec *lur; + struct llog_ctxt *ctxt; + int rc; + + rc = obd_checkmd(obd->u.mds.mds_osc_exp, obd->obd_self_export, lsm); + if (rc) + RETURN(rc); + /* first prepare unlink log record */ + OBD_ALLOC_PTR(lur); + if (!lur) + RETURN(rc = -ENOMEM); + lur->lur_hdr.lrh_len = lur->lur_tail.lrt_len = sizeof(*lur); + lur->lur_hdr.lrh_type = MDS_UNLINK_REC; + lur->lur_count = count; + + ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT); + rc = llog_add(ctxt, &lur->lur_hdr, lsm, logcookie, cookies); + llog_ctxt_put(ctxt); + + OBD_FREE_PTR(lur); + RETURN(rc); +} + +int mds_log_op_unlink(struct obd_device *obd, + struct lov_mds_md *lmm, int lmm_size, + struct llog_cookie *logcookies, int cookies_size) +{ + struct mds_obd *mds = &obd->u.mds; + struct lov_stripe_md *lsm = NULL; + int rc; + ENTRY; + + if (IS_ERR(mds->mds_osc_obd)) + RETURN(PTR_ERR(mds->mds_osc_obd)); + + rc = obd_unpackmd(mds->mds_osc_exp, &lsm, lmm, lmm_size); + if (rc < 0) + RETURN(rc); + rc = mds_llog_add_unlink(obd, lsm, 0, logcookies, + cookies_size / sizeof(struct llog_cookie)); + obd_free_memmd(mds->mds_osc_exp, &lsm); + RETURN(rc); +} +EXPORT_SYMBOL(mds_log_op_unlink); + +int mds_log_op_orphan(struct obd_device *obd, struct lov_stripe_md *lsm, + obd_count count) +{ + struct mds_obd *mds = &obd->u.mds; + struct llog_cookie logcookie; + int rc; + ENTRY; + + if (IS_ERR(mds->mds_osc_obd)) + RETURN(PTR_ERR(mds->mds_osc_obd)); + + rc = obd_checkmd(mds->mds_osc_exp, obd->obd_self_export, lsm); + if (rc) + RETURN(rc); + rc = mds_llog_add_unlink(obd, lsm, count - 1, &logcookie, 1); + RETURN(rc); +} + diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 507d4a4..e57a1e2 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -256,11 +256,44 @@ 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 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_osc_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 = mdt_to_obd_objgrp(obd->u.mds.mds_id); + 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 *obj; + struct lov_stripe_md *lsm = NULL; + int stripes = 0; int count; ENTRY; @@ -271,14 +304,15 @@ void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm) switch (le32_to_cpu(lmm->lmm_magic)) { case LOV_MAGIC_V1: count = le32_to_cpu(((struct lov_mds_md_v1*)lmm)->lmm_stripe_count); - obj = &(((struct lov_mds_md_v1*)lmm)->lmm_objects[0]); + obj = ((struct lov_mds_md_v1*)lmm)->lmm_objects; break; case LOV_MAGIC_V3: count = le32_to_cpu(((struct lov_mds_md_v3*)lmm)->lmm_stripe_count); - obj = &(((struct lov_mds_md_v3*)lmm)->lmm_objects[0]); + obj = ((struct lov_mds_md_v3*)lmm)->lmm_objects; break; default: - CERROR("Unknow lmm type %X !\n", le32_to_cpu(lmm->lmm_magic)); + CERROR("Unknow lmm type %X !\n", + le32_to_cpu(lmm->lmm_magic)); return; } @@ -294,10 +328,25 @@ 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]) { + 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) + CERROR("Unexpected gap in objids\n"); + /* lsm is allocated if NULL */ + mds_log_lost_precreated(obd, &lsm, &stripes, + data[idx]+1, lost, i); + } data[idx] = id; cfs_bitmap_set(mds->mds_lov_page_dirty, page); } } + if (lsm) { + /* restore stripes number */ + lsm->lsm_stripe_count = stripes; + obd_free_memmd(mds->mds_osc_exp, &lsm); + } EXIT; return; } @@ -309,7 +358,7 @@ static int mds_lov_update_from_read(struct mds_obd *mds, obd_id *data, __u32 i; __u32 stripes; - for(i = 0; i < count; i++) { + for (i = 0; i < count; i++) { if (data[i] == 0) continue; @@ -323,7 +372,8 @@ static int mds_lov_update_from_read(struct mds_obd *mds, obd_id *data, mds->mds_max_cookiesize = stripes * sizeof(struct llog_cookie); CDEBUG(D_CONFIG, "updated max_mdsize/max_cookiesize for %d stripes: " - "%d/%d\n", stripes, mds->mds_max_mdsize, mds->mds_max_cookiesize); + "%d/%d\n", stripes, mds->mds_max_mdsize, + mds->mds_max_cookiesize); EXIT; return 0; diff --git a/lustre/obdclass/llog_swab.c b/lustre/obdclass/llog_swab.c index a6a430d..1602044 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -138,7 +138,8 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail) struct llog_unlink_rec *lur = (struct llog_unlink_rec *)rec; __swab64s(&lur->lur_oid); - __swab32s(&lur->lur_ogen); + __swab32s(&lur->lur_ogr); + __swab32s(&lur->lur_count); break; } @@ -146,7 +147,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail) struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec; __swab64s(&lsr->lsr_oid); - __swab32s(&lsr->lsr_ogen); + __swab32s(&lsr->lsr_ogr); __swab32s(&lsr->lsr_uid); __swab32s(&lsr->lsr_gid); break; @@ -179,7 +180,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail) struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec; __swab64s(&lsr->lsr_oid); - __swab32s(&lsr->lsr_ogen); + __swab32s(&lsr->lsr_ogr); __swab32s(&lsr->lsr_uid); __swab32s(&lsr->lsr_gid); diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 61f84a3..a8caad3 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -117,7 +117,7 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, struct obd_llog_group *olg; struct llog_ctxt *ctxt; int rc; - + /* we have to find context for right group */ if (error != 0 || obd->obd_stopping) { CDEBUG(D_INODE, "not cancel logcookie err %d stopping %d \n", @@ -126,11 +126,11 @@ void filter_cancel_cookies_cb(struct obd_device *obd, __u64 transno, } olg = filter_find_olg(obd, cookie->lgc_lgl.lgl_ogr); - if (!olg) { + if (!olg) { CDEBUG(D_HA, "unknown group "LPU64"!\n", cookie->lgc_lgl.lgl_ogr); GOTO(out, rc = 0); } - + ctxt = llog_group_get_ctxt(olg, cookie->lgc_subsys + 1); if (!ctxt) { CERROR("no valid context for group "LPU64"\n", @@ -154,35 +154,41 @@ static int filter_recov_log_unlink_cb(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec, struct llog_cookie *cookie) { - struct obd_device *obd = ctxt->loc_obd; - struct obd_export *exp = obd->obd_self_export; + 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; lur = (struct llog_unlink_rec *)rec; OBDO_ALLOC(oa); - if (oa == NULL) + if (oa == NULL) RETURN(-ENOMEM); oa->o_valid |= OBD_MD_FLCOOKIE; oa->o_id = lur->lur_oid; - oa->o_gr = lur->lur_ogen; + oa->o_gr = lur->lur_ogr; oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP; oa->o_lcookie = *cookie; oid = oa->o_id; - - rc = filter_destroy(exp, oa, NULL, NULL, NULL, NULL); - OBDO_FREE(oa); - if (rc == -ENOENT) { - CDEBUG(D_RPCTRACE, "object already removed, send cookie\n"); - llog_cancel(ctxt, NULL, 1, cookie, 0); - RETURN(0); + /* objid gap may require to destroy several objects in row */ + count = lur->lur_count + 1; + + while (count > 0) { + rc = filter_destroy(exp, oa, NULL, NULL, NULL, NULL); + if (rc == 0) + CDEBUG(D_RPCTRACE, "object "LPU64" is destroyed\n", + oid); + else if (rc != -ENOENT) + CEMERG("error destroying object "LPU64": %d\n", + oid, rc); + else + rc = 0; + count--; + oid++; } - - if (rc == 0) - CDEBUG(D_RPCTRACE, "object "LPU64" is destroyed\n", oid); + OBDO_FREE(oa); RETURN(rc); } @@ -208,14 +214,14 @@ static int filter_recov_log_setattr_cb(struct llog_ctxt *ctxt, struct llog_setattr_rec *lsr = (struct llog_setattr_rec *)rec; oinfo.oi_oa->o_id = lsr->lsr_oid; - oinfo.oi_oa->o_gr = lsr->lsr_ogen; + oinfo.oi_oa->o_gr = lsr->lsr_ogr; oinfo.oi_oa->o_uid = lsr->lsr_uid; oinfo.oi_oa->o_gid = lsr->lsr_gid; } else { struct llog_setattr64_rec *lsr = (struct llog_setattr64_rec *)rec; oinfo.oi_oa->o_id = lsr->lsr_oid; - oinfo.oi_oa->o_gr = lsr->lsr_ogen; + oinfo.oi_oa->o_gr = lsr->lsr_ogr; oinfo.oi_oa->o_uid = lsr->lsr_uid; oinfo.oi_oa->o_gid = lsr->lsr_gid; } diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 3a7b3ec..0bc45fe 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1837,10 +1837,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_create_rec, lcr_oid)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid)); - LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogen) == 40, " found %lld\n", - (long long)(int)offsetof(struct llog_create_rec, lcr_ogen)); - LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); + LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogr) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_create_rec, lcr_ogr)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogr)); LASSERTF((int)offsetof(struct llog_create_rec, padding) == 44, " found %lld\n", (long long)(int)offsetof(struct llog_create_rec, padding)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->padding) == 4, " found %lld\n", @@ -1881,14 +1881,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_unlink_rec, lur_oid)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid)); - LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen)); - LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); - LASSERTF((int)offsetof(struct llog_unlink_rec, padding) == 28, " found %lld\n", - (long long)(int)offsetof(struct llog_unlink_rec, padding)); - LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->padding) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_unlink_rec *)0)->padding)); + LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, lur_ogr)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogr)); + LASSERTF((int)offsetof(struct llog_unlink_rec, lur_count) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, lur_count)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_count)); LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_unlink_rec, lur_tail)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", @@ -1905,10 +1905,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_setattr_rec, lsr_oid)); LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid)); - LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogen)); - LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogr)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogr)); LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_uid) == 28, " found %lld\n", (long long)(int)offsetof(struct llog_setattr_rec, lsr_uid)); LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid) == 4, " found %lld\n", @@ -1937,10 +1937,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oid)); LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid)); - LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_setattr64_rec, lsr_ogen)); - LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr64_rec, lsr_ogr)); + LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogr)); LASSERTF((int)offsetof(struct llog_setattr64_rec, padding) == 28, " found %lld\n", (long long)(int)offsetof(struct llog_setattr64_rec, padding)); LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->padding) == 4, " found %lld\n", diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index b9ca877..c47082e 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -250,7 +250,7 @@ test_13() { } run_test 13 "close resend timeout" -test_14() { +test_14a() { replay_barrier $SINGLEMDS createmany -o $MOUNT1/$tfile- 25 createmany -o $MOUNT2/$tfile-2- 1 @@ -268,7 +268,35 @@ test_14() { zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail" return 0 } -run_test 14 "timeouts waiting for lost client during replay" +run_test 14a "timeouts waiting for lost client during replay" + +test_14b() { + BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'` + mkdir -p $MOUNT1/$tdir + replay_barrier $SINGLEMDS + createmany -o $MOUNT1/$tfile- 5 + echo "data" > $MOUNT2/$tdir/$tfile-2 + createmany -o $MOUNT1/$tfile-3- 5 + umount $MOUNT2 + + facet_failover $SINGLEMDS + # expect recovery don't fail due to VBR + df $MOUNT1 || return 1 + + # first 25 files should have been replayed + unlinkmany $MOUNT1/$tfile- 5 || return 2 + unlinkmany $MOUNT1/$tfile-3- 5 || return 3 + + zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail" + # give ost time to process llogs + sleep 3 + AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'` + log "before $BEFOREUSED, after $AFTERUSED" + [ $AFTERUSED -ne $BEFOREUSED ] && \ + error "after $AFTERUSED > before $BEFOREUSED" && return 4 + return 0 +} +run_test 14b "delete ost orphans if gap occured in objids due to VBR" test_15a() { # was test_15 replay_barrier $SINGLEMDS diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 2ced660..c68650c 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -885,7 +885,7 @@ check_llog_create_rec(void) CHECK_MEMBER(llog_create_rec, lcr_hdr); CHECK_MEMBER(llog_create_rec, lcr_fid); CHECK_MEMBER(llog_create_rec, lcr_oid); - CHECK_MEMBER(llog_create_rec, lcr_ogen); + CHECK_MEMBER(llog_create_rec, lcr_ogr); CHECK_MEMBER(llog_create_rec, padding); } @@ -908,8 +908,8 @@ check_llog_unlink_rec(void) CHECK_STRUCT(llog_unlink_rec); CHECK_MEMBER(llog_unlink_rec, lur_hdr); CHECK_MEMBER(llog_unlink_rec, lur_oid); - CHECK_MEMBER(llog_unlink_rec, lur_ogen); - CHECK_MEMBER(llog_unlink_rec, padding); + CHECK_MEMBER(llog_unlink_rec, lur_ogr); + CHECK_MEMBER(llog_unlink_rec, lur_count); CHECK_MEMBER(llog_unlink_rec, lur_tail); } @@ -920,7 +920,7 @@ check_llog_setattr_rec(void) CHECK_STRUCT(llog_setattr_rec); CHECK_MEMBER(llog_setattr_rec, lsr_hdr); CHECK_MEMBER(llog_setattr_rec, lsr_oid); - CHECK_MEMBER(llog_setattr_rec, lsr_ogen); + CHECK_MEMBER(llog_setattr_rec, lsr_ogr); CHECK_MEMBER(llog_setattr_rec, lsr_uid); CHECK_MEMBER(llog_setattr_rec, lsr_gid); CHECK_MEMBER(llog_setattr_rec, padding); @@ -934,7 +934,7 @@ check_llog_setattr64_rec(void) CHECK_STRUCT(llog_setattr64_rec); CHECK_MEMBER(llog_setattr64_rec, lsr_hdr); CHECK_MEMBER(llog_setattr64_rec, lsr_oid); - CHECK_MEMBER(llog_setattr64_rec, lsr_ogen); + CHECK_MEMBER(llog_setattr64_rec, lsr_ogr); CHECK_MEMBER(llog_setattr64_rec, padding); CHECK_MEMBER(llog_setattr64_rec, lsr_uid); CHECK_MEMBER(llog_setattr64_rec, lsr_uid_h); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 2a755a7..88c8506 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1834,10 +1834,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_create_rec, lcr_oid)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid)); - LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogen) == 40, " found %lld\n", - (long long)(int)offsetof(struct llog_create_rec, lcr_ogen)); - LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); + LASSERTF((int)offsetof(struct llog_create_rec, lcr_ogr) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_create_rec, lcr_ogr)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogr)); LASSERTF((int)offsetof(struct llog_create_rec, padding) == 44, " found %lld\n", (long long)(int)offsetof(struct llog_create_rec, padding)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->padding) == 4, " found %lld\n", @@ -1878,14 +1878,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_unlink_rec, lur_oid)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid)); - LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen)); - LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); - LASSERTF((int)offsetof(struct llog_unlink_rec, padding) == 28, " found %lld\n", - (long long)(int)offsetof(struct llog_unlink_rec, padding)); - LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->padding) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_unlink_rec *)0)->padding)); + LASSERTF((int)offsetof(struct llog_unlink_rec, lur_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, lur_ogr)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogr)); + LASSERTF((int)offsetof(struct llog_unlink_rec, lur_count) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, lur_count)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_count)); LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_unlink_rec, lur_tail)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", @@ -1902,10 +1902,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_setattr_rec, lsr_oid)); LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid)); - LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogen)); - LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogr)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogr)); LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_uid) == 28, " found %lld\n", (long long)(int)offsetof(struct llog_setattr_rec, lsr_uid)); LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid) == 4, " found %lld\n", @@ -1934,10 +1934,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_setattr64_rec, lsr_oid)); LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oid)); - LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_ogen) == 24, " found %lld\n", - (long long)(int)offsetof(struct llog_setattr64_rec, lsr_ogen)); - LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogen) == 4, " found %lld\n", - (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_ogr) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr64_rec, lsr_ogr)); + LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogr) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_ogr)); LASSERTF((int)offsetof(struct llog_setattr64_rec, padding) == 28, " found %lld\n", (long long)(int)offsetof(struct llog_setattr64_rec, padding)); LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->padding) == 4, " found %lld\n",