Whamcloud - gitweb
LU-4957 ofd: convert FID to OSTID before put it on wire 80/10580/4
authorWang Di <di.wang@intel.com>
Fri, 6 Jun 2014 09:20:55 +0000 (02:20 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 11 Jun 2014 02:39:34 +0000 (02:39 +0000)
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 <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10580
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/ofd/ofd_dev.c
lustre/osp/osp_precreate.c

index 99445a9..a4928c4 100644 (file)
@@ -1422,9 +1422,18 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
 out:
        mutex_unlock(&oseq->os_create_lock);
 out_nolock:
 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;
                rep_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
-
+       }
        ofd_seq_put(tsi->tsi_env, oseq);
 
 out_sem:
        ofd_seq_put(tsi->tsi_env, oseq);
 
 out_sem:
index 321c4fb..219d90f 100644 (file)
@@ -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);
                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);
 
 
        diff = osp_fid_diff(fid, &d->opd_pre_last_created_fid);