From fe9273a52a97e6560108a9563e0370855dc0319a Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Tue, 3 May 2016 03:37:41 -0400 Subject: [PATCH] LU-8091 mount: error out properly in server_lsi2mti() server_lsi2mti() should return an error if no proper NID is initialized, otherwise, target will register successfully with an invalid empty NID. Signed-off-by: Niu Yawei Change-Id: Ia5fd78e4df6344764109486ce1082099054ebf1e Reviewed-on: http://review.whamcloud.com/19933 Tested-by: Jenkins Reviewed-by: Bobi Jam Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/obd_mount_server.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index 9945ef0..ca68fb0 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1131,6 +1131,13 @@ static int server_lsi2mti(struct lustre_sb_info *lsi, } } + if (mti->mti_nid_count == 0) { + CERROR("Failed to get NID for server %s, please check whether " + "the target is specifed with improper --servicenode or " + "--network options.\n", mti->mti_svname); + RETURN(-EINVAL); + } + mti->mti_lustre_ver = LUSTRE_VERSION_CODE; mti->mti_config_ver = 0; -- 1.8.3.1