From e82836f56ee7a9337a86ad0a32f19751024c7ec6 Mon Sep 17 00:00:00 2001 From: Cyril Bordage Date: Fri, 7 Jan 2022 11:08:21 +0100 Subject: [PATCH] LU-14108 mount: prevent if --network and discovery The --network= option to mkfs.lustre allows restricting a target (OST/MDT) to a given LNet network. This makes it register to the MGS with the specified network only. However, dynamic discovery is unaware of this restriction and this can create problems. We prevent mounting with mkfs "network" option if discovery is enabled by returning an EINVAL error. Test-Parameters: trivial Signed-off-by: Cyril Bordage Change-Id: I4b6da7804162192054d7b29a28fbe4cb015e6570 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46632 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin --- lustre/target/tgt_mount.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lustre/target/tgt_mount.c b/lustre/target/tgt_mount.c index 41ec045..feaa935 100644 --- a/lustre/target/tgt_mount.c +++ b/lustre/target/tgt_mount.c @@ -1179,6 +1179,17 @@ static int server_lsi2mti(struct lustre_sb_info *lsi, lnet_nid_to_nid4(&id.nid)) < 1) continue; + if (!class_find_param(lsi->lsi_lmd->lmd_params, + PARAM_NETWORK, NULL)) { + if (LNetGetPeerDiscoveryStatus()) { + CERROR("LNet Dynamic Peer Discovery is enabled" + " on this node. 'network' option used in" + " mkfs.lustre cannot be taken into" + " account.\n"); + RETURN(-EINVAL); + } + } + /* match specified network */ if (!class_match_net(lsi->lsi_lmd->lmd_params, PARAM_NETWORK, LNET_NID_NET(&id.nid))) -- 1.8.3.1