From 3a490d8405ff73d6eaa14c291e14867b5ba01c87 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 30 Sep 2014 11:09:30 -0500 Subject: [PATCH] LU-5687 dt: propagate errors from failed declarations Check for and return errors from dt_declare_*() in several locations. Signed-off-by: John L. Hammond Change-Id: Id18b12d6c713e78e2f1cc782ff659d2c84cc60bb Reviewed-on: http://review.whamcloud.com/12130 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/obdclass/llog_osd.c | 4 +++- lustre/obdclass/local_storage.c | 9 +++++++-- lustre/ofd/ofd_objects.c | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 4934d08..ef7b0f0 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -1262,7 +1262,9 @@ static int llog_osd_destroy(const struct lu_env *env, GOTO(out_trans, rc); } - dt_declare_ref_del(env, o, th); + rc = dt_declare_ref_del(env, o, th); + if (rc < 0) + GOTO(out_trans, rc); rc = dt_declare_destroy(env, o, th); if (rc) diff --git a/lustre/obdclass/local_storage.c b/lustre/obdclass/local_storage.c index 5e43e16..563e8dd 100644 --- a/lustre/obdclass/local_storage.c +++ b/lustre/obdclass/local_storage.c @@ -328,8 +328,13 @@ struct dt_object *__local_file_create(const struct lu_env *env, GOTO(trans_stop, rc); if (dti->dti_dof.dof_type == DFT_DIR) { - dt_declare_ref_add(env, dto, th); - dt_declare_ref_add(env, parent, th); + rc = dt_declare_ref_add(env, dto, th); + if (rc < 0) + GOTO(trans_stop, rc); + + rc = dt_declare_ref_add(env, parent, th); + if (rc < 0) + GOTO(trans_stop, rc); } rec->rec_fid = fid; diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index 1b3b4f0..c786333 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -739,8 +739,14 @@ int ofd_object_destroy(const struct lu_env *env, struct ofd_object *fo, if (IS_ERR(th)) GOTO(unlock, rc = PTR_ERR(th)); - dt_declare_ref_del(env, ofd_object_child(fo), th); - dt_declare_destroy(env, ofd_object_child(fo), th); + rc = dt_declare_ref_del(env, ofd_object_child(fo), th); + if (rc < 0) + GOTO(stop, rc); + + rc = dt_declare_destroy(env, ofd_object_child(fo), th); + if (rc < 0) + GOTO(stop, rc); + if (orphan) rc = dt_trans_start_local(env, ofd->ofd_osd, th); else -- 1.8.3.1