From: Anoop C S Date: Tue, 10 Jan 2017 13:30:30 +0000 (+0000) Subject: s3/smb2_read: Better fallback for incorrectly configured sendfile setups X-Git-Tag: talloc-2.1.9~431 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a864fc952edaa96d2ee20254a3e9c90d29fe28c;p=thirdparty%2Fsamba.git s3/smb2_read: Better fallback for incorrectly configured sendfile setups When "use sendfile" is enabled but not supported by the underlying VFS module then fallback to normal copy and print out a warning for the admin. Pair-Programmed-With: Guenther Deschner Pair-Programmed-With: Michael Adam Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 89527f38748..1c85840137e 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -221,6 +221,13 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state) goto normal_read; } + if (errno == ENOTSUP) { + set_use_sendfile(SNUM(fsp->conn), false); + DBG_WARNING("Disabling sendfile use as sendfile is " + "not supported by the system\n"); + goto normal_read; + } + if (errno == EINTR) { /* * Special hack for broken Linux with no working sendfile. If we