Whamcloud - gitweb
LU-5831 lfsck: extend lfsck_request::lr_pool_name 34/12534/3
authorFan Yong <fan.yong@intel.com>
Mon, 1 Sep 2014 12:11:30 +0000 (20:11 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 11 Nov 2014 12:13:24 +0000 (12:13 +0000)
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 <fan.yong@intel.com>
Change-Id: I84443089135c5de1b9fa89eb76e5cd623412a01f
Reviewed-on: http://review.whamcloud.com/12534
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/include/lustre/lustre_idl.h
lustre/lfsck/lfsck_engine.c

index 7eb21be..1b9d47d 100644 (file)
@@ -3563,7 +3563,7 @@ struct lfsck_request {
        struct lu_fid   lr_fid2;
        union {
                struct lu_fid   lr_fid3;
        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;
        };
        __u32           lr_stripe_count;
        __u32           lr_hash_type;
index d53f0d3..3508103 100644 (file)
@@ -388,10 +388,12 @@ void lfsck_close_dir(const struct lu_env *env,
        }
 
        if (lfsck->li_di_dir != NULL) {
        }
 
        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;
 
                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);
        }
                lfsck_di_dir_put(env, lfsck);
                dir_iops->fini(env, dir_di);
        }