Whamcloud - gitweb
LU-15851 gnilnd: Remove invalid ASSERT from kgnilnd_send() 20/47320/3
authorChris Horn <chris.horn@hpe.com>
Wed, 20 Apr 2022 21:45:35 +0000 (16:45 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 06:01:28 +0000 (06:01 +0000)
An LNet user can allocate a large contiguous MD. That MD can have
LNET_MAX_IOV pages which causes some LNDs to assert on either niov
argument passed to lnd_recv() or the value stored in
lnet_msg::msg_niov. This is true even in cases where the actual
transfer size is <= LNET_MTU and will not exceed limits in the
LNDs.

Remove the assert on msg_niov from kgnilnd_send(). kgnilnd will
return an error to upper layer if its unable to set up a buffer for
the send.

Move the ASSERT in kgnilnd_setup_immediate_buffer() so that we only
check niov after accounting for offset.

HPE-bug-id: LUS-10915
Test-Parameters: trivial
Fixes: 857f11169f ("LU-13004 lnet: always put a page list into struct lnet_libmd")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: Ide39f0745686784b1a2402c578bd472196f372b8
Reviewed-on: https://review.whamcloud.com/47320
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andriy Skulysh <andriy.skulysh@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/gnilnd/gnilnd_cb.c

index 6be0b2a..fbcec23 100644 (file)
@@ -538,16 +538,17 @@ kgnilnd_setup_immediate_buffer(kgn_tx_t *tx, unsigned int niov,
                        niov = DIV_ROUND_UP(nob + offset + kiov->bv_offset,
                                            PAGE_SIZE);
 
-               LASSERTF(niov > 0 && niov < GNILND_MAX_IMMEDIATE/PAGE_SIZE,
-                       "bad niov %d msg %p kiov %p offset %d nob%d\n",
-                       niov, msg, kiov, offset, nob);
-
                while (offset >= kiov->bv_len) {
                        offset -= kiov->bv_len;
                        niov--;
                        kiov++;
                        LASSERT(niov > 0);
                }
+
+               LASSERTF(niov > 0 && niov < GNILND_MAX_IMMEDIATE/PAGE_SIZE,
+                       "bad niov %d msg %p kiov %p offset %d nob%d\n",
+                       niov, msg, kiov, offset, nob);
+
                for (i = 0; i < niov; i++) {
                        /* We can't have a bv_offset on anything but the first
                         * entry, otherwise we'll have a hole at the end of the
@@ -2042,8 +2043,6 @@ kgnilnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg)
 
        LASSERTF(nob == 0 || niov > 0,
                "lntmsg %p nob %d niov %d\n", lntmsg, nob, niov);
-       LASSERTF(niov <= GNILND_MAX_IOV,
-               "lntmsg %p niov %d\n", lntmsg, niov);
 
        if (msg_vmflush)
                mpflag = memalloc_noreclaim_save();