s3: smbd: Fix Linux sendfile() for SMB2. Ensure we don't spin on EAGAIN.
commitc166fa003ae165fc5445dc8b1292719756fa0489
authorJeremy Allison <jra@samba.org>
Wed, 18 Jul 2018 20:32:49 +0000 (18 13:32 -0700)
committerKarolin Seeger <kseeger@samba.org>
Sat, 28 Jul 2018 04:16:16 +0000 (28 06:16 +0200)
treef902a29bf0aae0363c0bbb3019bf9c072499dffb
parent2bc9c4d8d3940a2f529e86b126010355ccd1e9de
s3: smbd: Fix Linux sendfile() for SMB2. Ensure we don't spin on EAGAIN.

For SMB2 the socket is set non-blocking. Ensure sendfile()
calls complete if they return EAGAIN by saving the socket state,
setting it blocking, doing the sendfile until completion and then
restoring the socket state.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 809967b3eab7a1b48c186517701538ca93536246)
source3/lib/sendfile.c