Whamcloud - gitweb
LU-8057 ko2iblnd: Replace sg++ with sg = sg_next(sg) 42/19342/12
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Wed, 1 Jun 2016 13:16:25 +0000 (09:16 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:45:38 +0000 (03:45 +0000)
commitd226464acaacccd240da43dcc22372fbf8cb04a6
tree40283b711e3ab2dee1fc31df460e529660b544ae
parente14c5ba62b4bc317960417e88586ba335719f876
LU-8057 ko2iblnd: Replace sg++ with sg = sg_next(sg)

With scatterlist chaining, simply incrementing the array does not
work. sg_next macro was thus introduced to follow the chain links
when necessary. So replace sg++ with sg_next.

This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
 struct scatterlist *sg;
@@
 -sg++
 +sg = sg_next(sg)
//</smpl>

In my test of the upstream client this change exposed a long
standing issues where we have a offset that is not page aligned
would cause us to access memory beyond the scatter gather list
which was causing memory corruption when all 256 fragments were
in use.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: I5bc140645b841aa2a92da434ffa65795112c6cec
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: http://review.whamcloud.com/19342
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd_cb.c