From b1acb4a6dafed08691c026646a732a20caf11c10 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Mon, 1 Sep 2014 20:11:30 +0800 Subject: [PATCH] LU-5831 lfsck: extend lfsck_request::lr_pool_name Fix some issues found during Lustre source static analysis: 1) Extend lfsck_request::lr_pool_name size to match the lmv_mds_md_v1::lmv_pool_name. 2) Check lfsck->li_obj_dir inside lfsck_close_dir() before using. Signed-off-by: Fan Yong Change-Id: I84443089135c5de1b9fa89eb76e5cd623412a01f Reviewed-on: http://review.whamcloud.com/12534 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin --- lustre/include/lustre/lustre_idl.h | 2 +- lustre/lfsck/lfsck_engine.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 7eb21be..1b9d47d 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -3563,7 +3563,7 @@ struct lfsck_request { struct lu_fid lr_fid2; union { struct lu_fid lr_fid3; - char lr_pool_name[LOV_MAXPOOLNAME]; + char lr_pool_name[LOV_MAXPOOLNAME + 1]; }; __u32 lr_stripe_count; __u32 lr_hash_type; diff --git a/lustre/lfsck/lfsck_engine.c b/lustre/lfsck/lfsck_engine.c index d53f0d3..3508103 100644 --- a/lustre/lfsck/lfsck_engine.c +++ b/lustre/lfsck/lfsck_engine.c @@ -388,10 +388,12 @@ void lfsck_close_dir(const struct lu_env *env, } if (lfsck->li_di_dir != NULL) { - const struct dt_it_ops *dir_iops = - &lfsck->li_obj_dir->do_index_ops->dio_it; + const struct dt_it_ops *dir_iops; struct dt_it *dir_di = lfsck->li_di_dir; + LASSERT(lfsck->li_obj_dir != NULL); + + dir_iops = &lfsck->li_obj_dir->do_index_ops->dio_it; lfsck_di_dir_put(env, lfsck); dir_iops->fini(env, dir_di); } -- 1.8.3.1