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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:42:52 +0000 (07:42 -0800)
commit4b7c09a5f74ad25dd2e3ee6d43732f9a0e0c1ff3
tree629c6feb57b36a916ef1289da5236eead1e5f0d6
parent150b28b45a35d9f056abaf047760cb906b35fca3
nbd: only set MSG_MORE when we have more to send

[ Upstream commit d61b7f972dab2a7d187c38254845546dfc8eed85 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/nbd.c