From 2c800c7ad0102407ea89af4d2a98ba761b957d4a Mon Sep 17 00:00:00 2001 From: Chuck Fossen Date: Thu, 3 Mar 2016 20:14:26 +0000 Subject: [PATCH] LU-7850 gnilnd: Fix niov calculation with offset kiov The niov calculation in kgnilnd_setup_immediate_buffer() did not take into account an offset kiov which can cause it to map one less page than needed. Add in the kiov_offset to the calculation. Ran patched lnet_selftest that allows specifying an offset and observed correct behavior. Signed-off-by: Chris Horn Change-Id: Id3d500d178841aa803c35bcbb7b56fd13b3fc1b0 Reviewed-on: http://review.whamcloud.com/18793 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Doug Oucharek Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lnet/klnds/gnilnd/gnilnd_cb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lnet/klnds/gnilnd/gnilnd_cb.c b/lnet/klnds/gnilnd/gnilnd_cb.c index 5d8e924..d9839ce 100644 --- a/lnet/klnds/gnilnd/gnilnd_cb.c +++ b/lnet/klnds/gnilnd/gnilnd_cb.c @@ -507,7 +507,8 @@ kgnilnd_setup_immediate_buffer(kgn_tx_t *tx, unsigned int niov, } else if (kiov != NULL) { if ((niov > 0) && unlikely(niov > (nob/PAGE_SIZE))) { - niov = ((nob + offset + PAGE_SIZE - 1) / PAGE_SIZE); + niov = ((nob + offset + kiov->kiov_offset + PAGE_SIZE - 1) / + PAGE_SIZE); } LASSERTF(niov > 0 && niov < GNILND_MAX_IMMEDIATE/PAGE_SIZE, -- 1.8.3.1