From 3a864fc952edaa96d2ee20254a3e9c90d29fe28c Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Tue, 10 Jan 2017 13:30:30 +0000 Subject: [PATCH] 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 --- source3/smbd/smb2_read.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.47.2