From: Chris Horn Date: Wed, 20 Apr 2022 21:45:35 +0000 (-0500) Subject: LU-15851 gnilnd: Remove invalid ASSERT from kgnilnd_send() X-Git-Tag: 2.15.51~127 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0703fa84c0f2dc69025a0849ba13f0d0d1a97738 LU-15851 gnilnd: Remove invalid ASSERT from kgnilnd_send() 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 Change-Id: Ide39f0745686784b1a2402c578bd472196f372b8 Reviewed-on: https://review.whamcloud.com/47320 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Neil Brown Reviewed-by: Andriy Skulysh Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/gnilnd/gnilnd_cb.c b/lnet/klnds/gnilnd/gnilnd_cb.c index 6be0b2a..fbcec23 100644 --- a/lnet/klnds/gnilnd/gnilnd_cb.c +++ b/lnet/klnds/gnilnd/gnilnd_cb.c @@ -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();