Whamcloud - gitweb
LU-4621 ofd: create same count of objects 26/10626/7
authorHongchao Zhang <hongchao.zhang@intel.com>
Sat, 24 May 2014 07:53:28 +0000 (15:53 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Jul 2014 04:47:42 +0000 (04:47 +0000)
when replaying the creation request (precreation) from OSP,
OFD should create the same count of objects as it created
when it processed the request initially, else it could cause
"-ENOENT" problem for the following replay requests coming
from the clients.

Change-Id: I64f61f82f6a662ccc564599468466549a55b55d0
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes \
clientdistro=el6 ossdistro=el6 mdsdistro=el6 clientarch=x86_64 \
ossarch=x86_64 mdsarch=x86_64 \
clientcount=4 osscount=2 mdscount=2 \
austeroptions=-R failover=true iscsi=1 \
testlist=recovery-mds-scale
Reviewed-on: http://review.whamcloud.com/10626
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ofd/ofd_dev.c
lustre/osp/osp_precreate.c

index 25debd1..774ec02 100644 (file)
@@ -1208,6 +1208,7 @@ out_put:
 
 static int ofd_create_hdl(struct tgt_session_info *tsi)
 {
+       struct ptlrpc_request   *req = tgt_ses_req(tsi);
        struct ost_body         *repbody;
        const struct obdo       *oa = &tsi->tsi_ost_body->oa;
        struct obdo             *rep_oa;
@@ -1378,7 +1379,8 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                               " at "LPU64"\n", ofd_name(ofd),
                               count, seq, next_id);
 
-                       if (cfs_time_after(jiffies, enough_time)) {
+                       if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
+                           && cfs_time_after(jiffies, enough_time)) {
                                CDEBUG(D_HA, "%s: Slow creates, %d/%d objects"
                                      " created at a rate of %d/s\n",
                                      ofd_name(ofd), created, diff + created,
@@ -1395,6 +1397,14 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                                break;
                        }
                }
+
+               if (diff > 0 &&
+                   lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
+                       LCONSOLE_WARN("%s: can't create the same count of"
+                                     " objects when replaying the request"
+                                     " (diff is %d). see LU-4621\n",
+                                     ofd_name(ofd), diff);
+
                if (created > 0)
                        /* some objects got created, we can return
                         * them, even if last creation failed */
index e6f81cd..7c28e1a 100644 (file)
@@ -495,6 +495,9 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d)
                d->opd_pre_grow_slow = 0;
        }
 
+       body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
+       fid_to_ostid(fid, &body->oa.o_oi);
+
        d->opd_pre_last_created_fid = *fid;
        spin_unlock(&d->opd_pre_lock);