From: Lai Siyao Date: Thu, 16 Sep 2021 21:49:33 +0000 (-0400) Subject: LU-15009 ofd: continue precreate if LAST_ID is less on MDT X-Git-Tag: 2.14.57~102 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1711e26ae861c28829870c2433caf7ee232909cf;ds=sidebyside LU-15009 ofd: continue precreate if LAST_ID is less on MDT It's possible that precreate succeeded on OST, but MDT didn't get the reply, and assumed failure. In this case, the LAST_ID on MDT is smaller than that on OST, instead of report error and stop precreate, it's better to move precreate window forward. Signed-off-by: Lai Siyao Change-Id: Ia6ca418ec0ea6797b7eccc1610879331307fad07 Reviewed-on: https://review.whamcloud.com/44984 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 4858cf5..cb7a1b5 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1636,7 +1636,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) GOTO(out, rc = -EINVAL); } - if (diff < 0) { + if (diff <= -OST_MAX_PRECREATE) { /* LU-5648 */ CERROR("%s: invalid precreate request for " DOSTID", last_id %llu. " @@ -1644,6 +1644,15 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) ofd_name(ofd), POSTID(&oa->o_oi), ofd_seq_last_oid(oseq)); GOTO(out, rc = -EINVAL); + } else if (diff < 0) { + LCONSOLE(D_INFO, + "%s: MDS LAST_ID "DFID" (%llu) is %lld behind OST LAST_ID "DFID" (%llu), trust the OST\n", + ofd_name(ofd), PFID(&oa->o_oi.oi_fid), + oid, -diff, 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); } } }