Whamcloud - gitweb
LU-11186 ofd: fix for a final oid at sequence 91/32891/5
authorAlexander Boyko <c17825@cray.com>
Fri, 27 Jul 2018 13:10:23 +0000 (09:10 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 9 Aug 2018 18:18:37 +0000 (18:18 +0000)
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 <c17825@cray.com>
Change-Id: I39ad66c05e8358591ca05fadabb2b46bee638070
Cray-bug-id: LUS-6222
Reviewed-on: https://review.whamcloud.com/32891
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sergey Cheremencev <c17829@cray.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_support.h
lustre/ofd/ofd_fs.c
lustre/ofd/ofd_objects.c
lustre/tests/conf-sanity.sh

index 84825eb..e4aaaf8 100644 (file)
@@ -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_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
 #define OBD_FAIL_OST                     0x200
 #define OBD_FAIL_OST_CONNECT_NET         0x201
 #define OBD_FAIL_OST_DISCONNECT_NET      0x202
index 0a1c87f..8be08a3 100644 (file)
@@ -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 */
 
        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;
                ofd_seq_last_oid_write(env, ofd, oseq);
        } else if (info->fti_attr.la_size == sizeof(lastid)) {
                info->fti_off = 0;
index f06c934..7605de4 100644 (file)
@@ -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)) &&
 
        /* 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)) &&
                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);
                CERROR("%s:"DOSTID" hit the OBIF_MAX_OID (1<<32)!\n",
                       ofd_name(ofd), id, ostid_seq(&oseq->os_oi));
                RETURN(rc = -ENOSPC);
index c53ead1..cb43d95 100644 (file)
@@ -8096,6 +8096,28 @@ test_116() {
 }
 run_test 116 "big size MDT support"
 
 }
 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
 if ! combined_mgs_mds ; then
        stop mgs
 fi