[PATCH] Avoid deliberate cleanup when sendfile is not supported
Jeremy Allison
jra at samba.org
Tue Jan 10 18:38:43 UTC 2017
On Tue, Jan 10, 2017 at 07:56:35PM +0530, Anoop C S wrote:
> Hi,
>
> Please find the attached patch which handles ENOTSUP when 'use sendfile' is incorrectly configured
> for a particular share.
>
> Tested the patch with vfs_glusterfs module and could confirm that this change avoids the
> server_cleanup and the resulting error from Windows client (Win 8.1).
LGTM. Reviewed-by: Jeremy Allison <jra at samba.org>
Michael, Guenther - are you OK with me pushing this ?
Jeremy.
> From 2941f3a303759bfe480335c5d7a9a2d0f5784823 Mon Sep 17 00:00:00 2001
> From: Anoop C S <anoopcs at redhat.com>
> 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 <gd at samba.org>
> Pair-Programmed-With: Michael Adam <obnox at samba.org>
> Signed-off-by: Anoop C S <anoopcs at redhat.com>
> ---
> 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 89527f3..1c85840 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.9.3
>
More information about the samba-technical
mailing list