From: Wang Di Date: Fri, 6 Jun 2014 09:20:55 +0000 (-0700) Subject: LU-4957 ofd: convert FID to OSTID before put it on wire X-Git-Tag: 2.5.60~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=18964424cb1179b9e8ca25288eb1b71ae11e2b4c LU-4957 ofd: convert FID to OSTID before put it on wire For the compatible purpose, OFD has to convert the FID(IDIF) to ost_id before reply to MDT(in ofd_create_hdl), because the old MDT(<2.6) can not deal with IDIF, but only ostid. Do not LASSERT for comparing OFD precreate fids with local used FID, instead it will just return -ESTALE. Change-Id: Ic35cca7a78bff2e4ca24f507a2c32666ab032579 Signed-off-by: Wang Di Reviewed-on: http://review.whamcloud.com/10580 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Tested-by: Maloo --- diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 99445a9..a4928c4 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1422,9 +1422,18 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) out: mutex_unlock(&oseq->os_create_lock); out_nolock: - if (rc == 0) + if (rc == 0) { +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 8, 53, 0) + struct ofd_thread_info *info = ofd_info(tsi->tsi_env); + struct lu_fid *fid = &info->fti_fid; + + /* For compatible purpose, it needs to convert back to + * OST ID before put it on wire. */ + *fid = rep_oa->o_oi.oi_fid; + fid_to_ostid(fid, &rep_oa->o_oi); +#endif rep_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP; - + } ofd_seq_put(tsi->tsi_env, oseq); out_sem: diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index 321c4fb..219d90f 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -473,9 +473,12 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d) GOTO(out_req, rc = -EPROTO); ostid_to_fid(fid, &body->oa.o_oi, d->opd_index); - LASSERTF(osp_fid_diff(fid, &d->opd_pre_used_fid) > 0, - "reply fid "DFID" pre used fid "DFID"\n", PFID(fid), - PFID(&d->opd_pre_used_fid)); + if (osp_fid_diff(fid, &d->opd_pre_used_fid) <= 0) { + CERROR("%s: precreate fid "DFID" < local used fid "DFID + ": rc = %d\n", d->opd_obd->obd_name, + PFID(fid), PFID(&d->opd_pre_used_fid), -ESTALE); + GOTO(out_req, rc = -ESTALE); + } diff = osp_fid_diff(fid, &d->opd_pre_last_created_fid);