s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.
authorJeremy Allison <jra@samba.org>
Wed, 18 Jul 2018 22:44:34 +0000 (15:44 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 13 Aug 2018 10:56:37 +0000 (12:56 +0200)
commit91c15b49ced2c25ecc6e162223ae79eea0d3209e
tree0e1e13e3082619a692ee6b77e81833da19671e87
parentb21e833e83281f58b734296e965c38aa676babdb
s3: smbd: Fix FreeBSD 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 456e520a3be7e4b54f1f144324c3671b8f6e35ea)
source3/lib/sendfile.c