In ofd_create_hdl(), the logic will compare the OST stroed LAST_ID
with the MDT given one: if the difference exceeds some threshold,
then it will trust the OST LAST_ID directly and reset the MDT side
value with the OST one. Otherwise, the orphan OST-objects will be
destroyed.
Unfortunately, both the OST stored LAST_ID and MDT given one are
64 bits, but the @diff variable is only 32 bits, and if the OST
side value is too larger than the MDT side, then the @diff will
overflow. That will misguide the OST to destroy useful OST-objects
by wrong. This patch change the @diff as 64 bits variable.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: If75899cbab5754be4ede226e0463ba5f69d70e3d
Reviewed-on: https://review.whamcloud.com/27975
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
int tgt_grant_commit_cb_add(struct thandle *th, struct obd_export *exp,
unsigned long grant);
long tgt_grant_create(const struct lu_env *env, struct obd_export *exp,
int tgt_grant_commit_cb_add(struct thandle *th, struct obd_export *exp,
unsigned long grant);
long tgt_grant_create(const struct lu_env *env, struct obd_export *exp,
int tgt_statfs_internal(const struct lu_env *env, struct lu_target *lut,
struct obd_statfs *osfs, __u64 max_age,
int *from_cache);
int tgt_statfs_internal(const struct lu_env *env, struct lu_target *lut,
struct obd_statfs *osfs, __u64 max_age,
int *from_cache);
u64 seq = ostid_seq(&oa->o_oi);
u64 oid = ostid_id(&oa->o_oi);
struct ofd_seq *oseq;
u64 seq = ostid_seq(&oa->o_oi);
u64 oid = ostid_id(&oa->o_oi);
struct ofd_seq *oseq;
+ s64 diff;
+ int rc = 0;
int sync_trans = 0;
long granted = 0;
int sync_trans = 0;
long granted = 0;
GOTO(out, rc);
}
diff = oid - ofd_seq_last_oid(oseq);
GOTO(out, rc);
}
diff = oid - ofd_seq_last_oid(oseq);
- CDEBUG(D_HA, "ofd_last_id() = %llu -> diff = %d\n",
- ofd_seq_last_oid(oseq), diff);
+ CDEBUG(D_HA, "ofd_last_id() = %llu -> diff = %lld\n",
+ ofd_seq_last_oid(oseq), diff);
if (-diff > OST_MAX_PRECREATE) {
if (-diff > OST_MAX_PRECREATE) {
+ LCONSOLE(D_INFO, "%s: too large difference between MDS "
+ "LAST_ID "DFID" (%llu) and OST LAST_ID "DFID" "
+ "(%llu), trust the OST\n",
+ ofd_name(ofd), PFID(&oa->o_oi.oi_fid), oid,
+ PFID(&oseq->os_oi.oi_fid),
+ ofd_seq_last_oid(oseq));
+
/* Let MDS know that we are so far ahead. */
rc = ostid_set_id(&rep_oa->o_oi,
ofd_seq_last_oid(oseq) + 1);
/* Let MDS know that we are so far ahead. */
rc = ostid_set_id(&rep_oa->o_oi,
ofd_seq_last_oid(oseq) + 1);
rc = granted;
granted = 0;
CDEBUG(D_HA, "%s: failed to acquire grant "
rc = granted;
granted = 0;
CDEBUG(D_HA, "%s: failed to acquire grant "
- "space for precreate (%d): rc = %d\n",
+ "space for precreate (%lld): rc = %d\n",
ofd_name(ofd), diff, rc);
diff = 0;
}
ofd_name(ofd), diff, rc);
diff = 0;
}
CDEBUG(D_HA, "%s: precreate FID "DOSTID" is over "
"%u larger than the LAST_ID "DOSTID", only "
CDEBUG(D_HA, "%s: precreate FID "DOSTID" is over "
"%u larger than the LAST_ID "DOSTID", only "
- "precreating the last %u objects.\n",
+ "precreating the last %lld objects.\n",
ofd_name(ofd), POSTID(&oa->o_oi),
5 * OST_MAX_PRECREATE,
POSTID(&oseq->os_oi), diff);
ofd_name(ofd), POSTID(&oa->o_oi),
5 * OST_MAX_PRECREATE,
POSTID(&oseq->os_oi), diff);
while (diff > 0) {
next_id = ofd_seq_last_oid(oseq) + 1;
while (diff > 0) {
next_id = ofd_seq_last_oid(oseq) + 1;
- count = ofd_precreate_batch(ofd, diff);
+ count = ofd_precreate_batch(ofd, (int)diff);
CDEBUG(D_HA, "%s: reserve %d objects in group %#llx"
" at %llu\n", ofd_name(ofd),
CDEBUG(D_HA, "%s: reserve %d objects in group %#llx"
" at %llu\n", ofd_name(ofd),
if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
&& 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"
+ CDEBUG(D_HA, "%s: Slow creates, %d/%lld objects"
" created at a rate of %d/s\n",
ofd_name(ofd), created, diff + created,
created / DISK_TIMEOUT);
" created at a rate of %d/s\n",
ofd_name(ofd), created, diff + created,
created / DISK_TIMEOUT);
lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)
LCONSOLE_WARN("%s: can't create the same count of"
" objects when replaying the request"
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",
+ " (diff is %lld). see LU-4621\n",
ofd_name(ofd), diff);
if (created > 0)
ofd_name(ofd), diff);
if (created > 0)
struct ofd_device *ofd = ofd_exp(exp);
u64 seq = ostid_seq(&oa->o_oi);
struct ofd_seq *oseq;
struct ofd_device *ofd = ofd_exp(exp);
u64 seq = ostid_seq(&oa->o_oi);
struct ofd_seq *oseq;
long granted;
u64 next_id;
long granted;
u64 next_id;
+ s64 diff = 1;
+ int rc = 0;
rc = granted;
granted = 0;
CDEBUG(D_HA, "%s: failed to acquire grant space for "
rc = granted;
granted = 0;
CDEBUG(D_HA, "%s: failed to acquire grant space for "
- "precreate (%d): rc = %d\n", ofd_name(ofd), diff, rc);
+ "precreate (%lld): rc = %d\n", ofd_name(ofd), diff, rc);
diff = 0;
GOTO(out, rc);
}
next_id = ofd_seq_last_oid(oseq) + 1;
diff = 0;
GOTO(out, rc);
}
next_id = ofd_seq_last_oid(oseq) + 1;
- count = ofd_precreate_batch(ofd, diff);
+ count = ofd_precreate_batch(ofd, (int)diff);
rc = ofd_precreate_objects(env, ofd, next_id, oseq, count, 0);
if (rc < 0) {
rc = ofd_precreate_objects(env, ofd, next_id, oseq, count, 0);
if (rc < 0) {
* \retval >= 0 amount of grant space allocated to the precreate request
* \retval -ENOSPC on failure
*/
* \retval >= 0 amount of grant space allocated to the precreate request
* \retval -ENOSPC on failure
*/
-long tgt_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr)
+long tgt_grant_create(const struct lu_env *env, struct obd_export *exp, s64 *nr)
{
struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
struct tg_grants_data *tgd = &lut->lut_tgd;
{
struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
struct tg_grants_data *tgd = &lut->lut_tgd;