From: John L. Hammond Date: Thu, 7 Aug 2014 19:37:17 +0000 (-0500) Subject: LU-5416 ofd: improve error handling in ofd_precreate_objects() X-Git-Tag: 2.6.53~28 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=51e076360d6d1cbc6a128324bdc18aa833a66614;hp=b65efe20dc07f925e06d58658cd24247ae36037c LU-5416 ofd: improve error handling in ofd_precreate_objects() In ofd_precreate_objects() fix two invalid assertions triggered by errors in the first iterations of the declare loop and the create loop. Signed-off-by: John L. Hammond Change-Id: I8bee1528dc58d5b8b35ac89056c667370cc347c5 Reviewed-on: http://review.whamcloud.com/11370 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index b6fcd4a..245b5d8 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -305,7 +305,10 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, rc = dt_declare_create(env, next, &info->fti_attr, NULL, &info->fti_dof, th); - if (rc) { + if (rc < 0) { + if (i == 0) + GOTO(trans_stop, rc); + nr = i; break; } @@ -318,8 +321,6 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, CDEBUG(D_OTHER, "%s: create new object "DFID" nr %d\n", ofd_name(ofd), PFID(fid), nr); - LASSERT(nr > 0); - /* When the LFSCK scanning the whole device to verify the LAST_ID file * consistency, it will load the last_id into RAM firstly, and compare * the last_id with each OST-object's ID. If the later one is larger, @@ -362,8 +363,13 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd, rc = dt_create(env, next, &info->fti_attr, NULL, &info->fti_dof, th); - if (rc) + if (rc < 0) { + if (i == 0) + GOTO(trans_stop, rc); + + rc = 0; break; + } LASSERT(ofd_object_exists(fo)); } ofd_seq_last_oid_set(oseq, id + i);