Whamcloud - gitweb
LU-7850 gnilnd: Fix niov calculation with offset kiov 93/18793/2
authorChuck Fossen <chuckf@cray.com>
Thu, 3 Mar 2016 20:14:26 +0000 (20:14 +0000)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Mar 2016 02:42:55 +0000 (02:42 +0000)
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 <hornc@cray.com>
Change-Id: Id3d500d178841aa803c35bcbb7b56fd13b3fc1b0
Reviewed-on: http://review.whamcloud.com/18793
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/gnilnd/gnilnd_cb.c

index 5d8e924..d9839ce 100644 (file)
@@ -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,