nbd: only set MSG_MORE when we have more to send
authorJosef Bacik <jbacik@fb.com>
Thu, 19 Jan 2017 21:08:49 +0000 (16:08 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:45 +0000 (02:18 +0000)
commit5486d50a9d86b9ca21c5d1be97cc00b4bd2179a5
tree90645226c68c39d3cff4d7a334d9a71cae8b4830
parent75c38bcf64e6960ab1a5a07d6b5c6946d8a751ca
nbd: only set MSG_MORE when we have more to send

commit d61b7f972dab2a7d187c38254845546dfc8eed85 upstream.

A user noticed that write performance was horrible over loopback and we
traced it to an inversion of when we need to set MSG_MORE.  It should be
set when we have more bvec's to send, not when we are on the last bvec.
This patch made the test go from 20 iops to 78k iops.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Fixes: 429a787be679 ("nbd: fix use-after-free of rq/bio in the xmit path")
Signed-off-by: Jens Axboe <axboe@fb.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/block/nbd.c