Whamcloud - gitweb
LU-14108 mount: prevent if --network and discovery 32/46632/6
authorCyril Bordage <cbordage@whamcloud.com>
Fri, 7 Jan 2022 10:08:21 +0000 (11:08 +0100)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Oct 2022 19:34:47 +0000 (19:34 +0000)
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 <cbordage@whamcloud.com>
Change-Id: I4b6da7804162192054d7b29a28fbe4cb015e6570
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46632
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/target/tgt_mount.c

index 41ec045..feaa935 100644 (file)
@@ -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)))