Whamcloud - gitweb
LU-17476 lnet: use bits only to match ME in all cases 82/54082/3
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Fri, 16 Feb 2024 19:01:21 +0000 (11:01 -0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Mar 2024 20:04:48 +0000 (20:04 +0000)
If NIDs belong to the same peer and matchbits are matching,
declare a match even if matchbits are matched as not available
or ignored

Test-Parameters: testlist=sanity env=ONLY=350,ONLY_REPEAT=10
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: I394c492381a2d069b34516c473220192df05fbd2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54082
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-ptl.c

index 68dd1cc..685a533 100644 (file)
@@ -156,61 +156,47 @@ lnet_try_match_md(struct lnet_libmd *md,
        if (((me->me_match_bits ^ info->mi_mbits) & ~me->me_ignore_bits) != 0)
                return LNET_MATCHMD_NONE;
 
-       /* mismatched ME nid/pid? */
-       if (me->me_match_bits & ~me->me_ignore_bits) {
-               /* try to accept match based on bits only */
-               if ((!LNET_NID_IS_ANY(&me->me_match_id.nid) &&
-                    !nid_same(&me->me_match_id.nid, &info->mi_id.nid)) ||
-                   CFS_FAIL_CHECK(CFS_FAIL_MATCH_MD_NID)) {
-                       struct lnet_peer *lp_me, *lp_peer;
-
-                       /* check if ME NID matches another NID of same peer */
-                       lp_me = lnet_find_peer(&me->me_match_id.nid);
-                       lp_peer = lnet_find_peer(&info->mi_id.nid);
-
-                       if (lp_me && lp_peer && (lp_me == lp_peer)) {
-                               /* Shouldn't happen, but better than dropping
-                                * message entirely. Print warning so we know
-                                * it happens, and something needs to be fixed.
-                                */
-                               CWARN("message from %s matched %llu with NID mismatch %s accepted (same peer %pK)\n",
-                                     libcfs_idstr(&info->mi_id),
-                                     info->mi_mbits,
-                                     libcfs_nidstr(&me->me_match_id.nid),
-                                     lp_me);
+       /* mismatched PID? */
+       if (me->me_match_id.pid != LNET_PID_ANY &&
+           me->me_match_id.pid != info->mi_id.pid)
+               return LNET_MATCHMD_NONE;
+
+       /* try to accept match based on bits only */
+       if ((!LNET_NID_IS_ANY(&me->me_match_id.nid) &&
+            !nid_same(&me->me_match_id.nid, &info->mi_id.nid)) ||
+           (!LNET_NID_IS_ANY(&me->me_match_id.nid) &&
+            CFS_FAIL_CHECK(CFS_FAIL_MATCH_MD_NID))) {
+               struct lnet_peer *lp_me, *lp_peer;
+
+               /* check if ME NID matches another NID of same peer */
+               lp_me = lnet_find_peer(&me->me_match_id.nid);
+               lp_peer = lnet_find_peer(&info->mi_id.nid);
+
+               if (lp_me && lp_peer && (lp_me == lp_peer)) {
+                       /* Shouldn't happen, but better than dropping
+                        * message entirely. Print warning so we know
+                        * it happens, and something needs to be fixed.
+                        */
+                       CWARN("message from %s matched %llu with NID mismatch %s accepted (same peer %pK)\n",
+                             libcfs_idstr(&info->mi_id),
+                             info->mi_mbits,
+                             libcfs_nidstr(&me->me_match_id.nid),
+                             lp_me);
+                       lnet_peer_decref_locked(lp_me);
+                       lnet_peer_decref_locked(lp_peer);
+               } else {
+                       CWARN("message from %s matched %llu with NID mismatch %s rejected (different peer %pK != %pK)\n",
+                               libcfs_idstr(&info->mi_id),
+                               info->mi_mbits,
+                               libcfs_nidstr(&me->me_match_id.nid),
+                               lp_me, lp_peer);
+                       if (lp_me)
                                lnet_peer_decref_locked(lp_me);
+                       if (lp_peer)
                                lnet_peer_decref_locked(lp_peer);
-                       } else {
-                               CNETERR("message from %s matched %llu with NID mismatch %s rejected (different peer %pK != %pK)\n",
-                                       libcfs_idstr(&info->mi_id),
-                                       info->mi_mbits,
-                                       libcfs_nidstr(&me->me_match_id.nid),
-                                       lp_me, lp_peer);
-                               if (lp_me)
-                                       lnet_peer_decref_locked(lp_me);
-                               if (lp_peer)
-                                       lnet_peer_decref_locked(lp_peer);
-
-                               return LNET_MATCHMD_NONE;
-                       }
-               }
 
-               if (me->me_match_id.pid != LNET_PID_ANY &&
-                   me->me_match_id.pid != info->mi_id.pid) {
-                       CNETERR("message from %s matched %llu with PID mismatch %s rejected\n",
-                               libcfs_idstr(&info->mi_id), info->mi_mbits,
-                               libcfs_idstr(&me->me_match_id));
                        return LNET_MATCHMD_NONE;
                }
-       } else {
-               /* there were no bits to match, reject on nid/pid mismatch */
-               if (!LNET_NID_IS_ANY(&me->me_match_id.nid) &&
-                   !nid_same(&me->me_match_id.nid, &info->mi_id.nid))
-                       return LNET_MATCHMD_NONE;
-
-               if (me->me_match_id.pid != LNET_PID_ANY &&
-                   me->me_match_id.pid != info->mi_id.pid)
-                       return LNET_MATCHMD_NONE;
        }
 
        /* Hurrah! This _is_ a match; check it out... */