From: Sergey Cheremencev Date: Mon, 25 Jun 2018 15:52:11 +0000 (+0300) Subject: LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC X-Git-Tag: 2.12.0-RC1~126 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1f97bb8e7236971aaf3029fe3699db9baf721da1 LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC ostid_set_id rewrites ofd_precreate_objects result after "LU-6401 uapi: fix up lustre_ostid.h and lustre_fid.h". This breakes the logic of osp_precreate_reserve() causing osp_precreate_send() to return ESTALE instead of ENOSPC when OST can't precreate objects. osp_precreate_send() returns ESTALE because the result of create is 0 while last created fid on OST is still the same with local last_id: fs1-OST0001-osc-MDT0000: precreate fid [0x100010000:0x571607f:0x0] < local used fid [0x100010000:0x571607f:0x0]: rc = -116 fs1-OST0001-osc-MDT0000: precreate failed opd_pre_status -116 fs1-OST0001-osc-MDT0000: cannot precreate objects: rc = -116 Change-Id: I4dc057c201253cab14e63c1f06bd5b0d56b5ad2d Signed-off-by: Sergey Cheremencev Fixes: 34acfbc2bfe502d18c12ba35771bde7c4a0f7906 Reviewed-on: https://es-gerrit.dev.cray.com/153462 Reviewed-by: Andriy Skulysh Reviewed-by: Artem Blagodarenko Tested-by: Alexander Lezhoev Reviewed-on: https://review.whamcloud.com/33390 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index bdbbe76..86ffa1e 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1621,6 +1621,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) u64 next_id; int created = 0; int count; + int rc2; if (!(oa->o_valid & OBD_MD_FLFLAGS) || !(oa->o_flags & OBD_FL_DELORPHAN)) { @@ -1708,7 +1709,8 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) granted = 0; } - rc = ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq)); + rc2 = ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq)); + rc = rc ? : rc2; } EXIT; ofd_counter_incr(exp, LPROC_OFD_STATS_CREATE, diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index aedec3d..937e9ac 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -665,7 +665,7 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d) ready: if (osp_fid_diff(fid, &d->opd_pre_used_fid) <= 0) { - CERROR("%s: precreate fid "DFID" < local used fid "DFID + 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);