From 06072de19cf490f52b9f20dd5a8d9dc8509ceb3f Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 27 Apr 2016 05:47:15 +0800 Subject: [PATCH] LU-8182 mdt: check connection data properly For mdt_obd_connect() case, the parameter @data should never be NULL, so drop the redundant check of "data != NULL", replace it with "LASSERT(data != NULL);" Signed-off-by: Fan Yong Change-Id: Ia6754752527e69c89e7a40d3d012232eaba94d3e Reviewed-on: http://review.whamcloud.com/20391 Tested-by: Jenkins Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/mdt/mdt_handler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a977d29..f786f00 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5313,6 +5313,8 @@ static int mdt_obd_connect(const struct lu_env *env, ENTRY; LASSERT(env != NULL); + LASSERT(data != NULL); + if (!exp || !obd || !cluuid) RETURN(-EINVAL); @@ -5329,7 +5331,7 @@ static int mdt_obd_connect(const struct lu_env *env, * XXX: probably not very appropriate method is used now * at some point we should find a better one */ - if (!test_bit(MDT_FL_SYNCED, &mdt->mdt_state) && data != NULL && + if (!test_bit(MDT_FL_SYNCED, &mdt->mdt_state) && !(data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) && !(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS)) { rc = obd_get_info(env, mdt->mdt_child_exp, -- 1.8.3.1