s3/smb2_read: Better fallback for incorrectly configured sendfile setups
authorAnoop C S <anoopcs@redhat.com>
Tue, 10 Jan 2017 13:30:30 +0000 (13:30 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 10 Jan 2017 23:49:22 +0000 (00:49 +0100)
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 <gd@samba.org>
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_read.c

index 89527f387485485d318f183499dab462d56fc50f..1c85840137e678570eeadb0e357b0bb4be84bfc6 100644 (file)
@@ -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