From: Cyril Bordage Date: Fri, 7 Jan 2022 10:08:21 +0000 (+0100) Subject: LU-14108 mount: prevent if --network and discovery X-Git-Tag: 2.15.53~188 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F46632%2F6;p=fs%2Flustre-release.git 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 --- 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)))