From: Alexander Boyko Date: Fri, 27 Jul 2018 13:10:23 +0000 (-0400) Subject: LU-11186 ofd: fix for a final oid at sequence X-Git-Tag: 2.11.54~15 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b724079edc5b66e1046b5760a6bad3045e9a9260;hp=d01fc74e8a347a0c8ebfcf92a49c7f71809cd0ad LU-11186 ofd: fix for a final oid at sequence There was an error at the end of sequence range and last oid 0xffffffff can't be created. The 0xffffffff is a valid oid, and sequence update happens only if it is created. LustreError: 11756:0:(ofd_objects.c:217:ofd_precreate_objects()) lustre-OST0000:0xfffffffe:10737419264 hit the OBIF_MAX_OID (1<<32)! LustreError: 11756:0:(ofd_dev.c:1764:ofd_create_hdl()) lustre-OST0000: unable to precreate: rc = -28 The patch fixes this error. The conf-sanity 122 is added for checking sequence update. Signed-off-by: Alexander Boyko Change-Id: I39ad66c05e8358591ca05fadabb2b46bee638070 Cray-bug-id: LUS-6222 Reviewed-on: https://review.whamcloud.com/32891 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Sergey Cheremencev Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 84825eb..e4aaaf8 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -275,6 +275,8 @@ extern char obd_jobid_var[]; #define OBD_FAIL_OSD_NO_OI_ENTRY 0x198 #define OBD_FAIL_OSD_INDEX_CRASH 0x199 +#define OBD_FAIL_OFD_SET_OID 0x1e0 + #define OBD_FAIL_OST 0x200 #define OBD_FAIL_OST_CONNECT_NET 0x201 #define OBD_FAIL_OST_DISCONNECT_NET 0x202 diff --git a/lustre/ofd/ofd_fs.c b/lustre/ofd/ofd_fs.c index 0a1c87f..8be08a3 100644 --- a/lustre/ofd/ofd_fs.c +++ b/lustre/ofd/ofd_fs.c @@ -416,7 +416,10 @@ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd, if (info->fti_attr.la_size == 0) { /* object is just created, initialize last id */ - ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID); + if (OBD_FAIL_CHECK(OBD_FAIL_OFD_SET_OID)) + ofd_seq_last_oid_set(oseq, 0xffffff00); + else + ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID); ofd_seq_last_oid_write(env, ofd, oseq); } else if (info->fti_attr.la_size == sizeof(lastid)) { info->fti_off = 0; diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index f06c934..7605de4 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -207,12 +207,12 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, /* Don't create objects beyond the valid range for this SEQ */ if (unlikely(fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) && - (id + nr) >= IDIF_MAX_OID)) { + (id + nr) > IDIF_MAX_OID)) { CERROR("%s:"DOSTID" hit the IDIF_MAX_OID (1<<48)!\n", ofd_name(ofd), id, ostid_seq(&oseq->os_oi)); RETURN(rc = -ENOSPC); } else if (unlikely(!fid_seq_is_mdt0(ostid_seq(&oseq->os_oi)) && - (id + nr) >= OBIF_MAX_OID)) { + (id + nr) > OBIF_MAX_OID)) { CERROR("%s:"DOSTID" hit the OBIF_MAX_OID (1<<32)!\n", ofd_name(ofd), id, ostid_seq(&oseq->os_oi)); RETURN(rc = -ENOSPC); diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index c53ead1..cb43d95 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -8096,6 +8096,28 @@ test_116() { } run_test 116 "big size MDT support" +test_122() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + [[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] || + { skip "Need OST version at least 2.11.53" && return 0; } + + + reformat + LOAD_MODULES_REMOTE=true load_modules +#define OBD_FAIL_OFD_SET_OID 0x1e0 + do_facet ost1 $LCTL set_param fail_loc=0x00001e0 + + setupall + $LFS mkdir -i1 -c1 $DIR/$tdir + $LFS setstripe -i0 -c1 $DIR/$tdir + do_facet ost1 $LCTL set_param fail_loc=0 + createmany -o $DIR/$tdir/file_ 1000 || + error "Fail to create a new sequence" + + reformat +} +run_test 122 "Check OST sequence update" + if ! combined_mgs_mds ; then stop mgs fi