We should wait for precreate rpc to finish when we see a just
reformatted/replaced OST, otherwise the client could try
to access the object on OST before it's created.
Do not use sync_trans when recreating the objects on the
reformatted/replaced OST.
Fix detecting reformatted OST for FID_SEQ_NORMAL, for such
seqs the oid will be initialized as LUSTRE_FID_INIT_OID,
which is 1.
Change-Id: I4aebb9d573aa352dd7897e5f1129dc2117a084bb
Fixes:
63e17799a3 ("LU-8367 osp: enable replay for precreation request")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49151
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
/* From last created */
diff = OST_MAX_PRECREATE;
ofd_seq_last_oid_set(oseq, ostid_id(&oa->o_oi) - diff);
/* From last created */
diff = OST_MAX_PRECREATE;
ofd_seq_last_oid_set(oseq, ostid_id(&oa->o_oi) - diff);
+ /* no sync_trans when recreating last batch */
+ sync_trans = 0;
}
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
}
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
if (fid_oid(last_fid) > 0 && update)
d->opd_last_used_fid = *last_fid;
if (fid_oid(last_fid) > 0 && update)
d->opd_last_used_fid = *last_fid;
- if (fid_oid(last_fid) == 0 &&
- fid_seq(last_fid) == fid_seq(&d->opd_last_used_fid)) {
- /* reformatted OST, it requires creation request
- * to recreate objects
- */
- d->opd_force_creation = true;
+ if (fid_seq(last_fid) == fid_seq(&d->opd_last_used_fid)) {
+ if (fid_oid(last_fid) == 0 ||
+ (fid_seq_is_norm(fid_seq(last_fid)) &&
+ fid_oid(last_fid) == LUSTRE_FID_INIT_OID)) {
+ /* reformatted OST, it requires creation request
+ * to recreate objects
+ */
+ spin_lock(&d->opd_pre_lock);
+ d->opd_force_creation = true;
+ spin_unlock(&d->opd_pre_lock);
+ }
}
CDEBUG(D_HA, "%s: Got last_fid "DFID"\n", d->opd_obd->obd_name,
PFID(last_fid));
}
CDEBUG(D_HA, "%s: Got last_fid "DFID"\n", d->opd_obd->obd_name,
PFID(last_fid));
- if (d->opd_pre_recovering)
+ if (d->opd_pre_recovering || d->opd_force_creation)
return 0;
/* ready if got enough precreated objects */
return 0;
/* ready if got enough precreated objects */
spin_lock(&d->opd_pre_lock);
precreated = osp_objs_precreated(env, d);
if (precreated > d->opd_pre_reserved &&
spin_lock(&d->opd_pre_lock);
precreated = osp_objs_precreated(env, d);
if (precreated > d->opd_pre_reserved &&
- !d->opd_pre_recovering) {
+ !d->opd_pre_recovering &&
+ !d->opd_force_creation) {
d->opd_pre_reserved++;
spin_unlock(&d->opd_pre_lock);
rc = 0;
d->opd_pre_reserved++;
spin_unlock(&d->opd_pre_lock);
rc = 0;
start_ost || error "OST0 restart failure"
wait_osc_import_state mds ost FULL
start_ost || error "OST0 restart failure"
wait_osc_import_state mds ost FULL
- sleep $((TIMEOUT/2)) #object recreation requires some time
mount_client $MOUNT || error "mount client failed"
touch $DIR/$tdir/$tfile-last || error "create file after reformat"
local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)
mount_client $MOUNT || error "mount client failed"
touch $DIR/$tdir/$tfile-last || error "create file after reformat"
local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)