From: Jeremy Allison Date: Tue, 13 Jan 2009 19:24:24 +0000 (-0800) Subject: Fix bug #6019 File corruption in Clustered SMB/NFS environment managed via CTDB X-Git-Tag: samba-3.0.34~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae72dbdf5fc8ee5c4e4d9321f0bd8dc106f910bd;p=thirdparty%2Fsamba.git Fix bug #6019 File corruption in Clustered SMB/NFS environment managed via CTDB Jeremy. (cherry picked from commit 974262ba3e8226ec9805d38e602ec8d083e44f72) --- diff --git a/source/lib/sendfile.c b/source/lib/sendfile.c index f4f6e16526f..4aa58c358f5 100644 --- a/source/lib/sendfile.c +++ b/source/lib/sendfile.c @@ -66,7 +66,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #endif } while (nwritten == -1 && errno == EINTR); if (nwritten == -1) { - if (errno == ENOSYS) { + if (errno == ENOSYS || errno == EINVAL) { /* Ok - we're in a world of pain here. We just sent * the header, but the sendfile failed. We have to * emulate the sendfile at an upper layer before we @@ -144,7 +144,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of nwritten = sendfile(tofd, fromfd, &small_offset, small_total); } while (nwritten == -1 && errno == EINTR); if (nwritten == -1) { - if (errno == ENOSYS) { + if (errno == ENOSYS || errno == EINVAL) { /* Ok - we're in a world of pain here. We just sent * the header, but the sendfile failed. We have to * emulate the sendfile at an upper layer before we diff --git a/source/smbd/reply.c b/source/smbd/reply.c index d8cbfd8e87f..69a9885cad6 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -2213,9 +2213,9 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st header.free = NULL; if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, nread) == -1) { - /* Returning ENOSYS or EINVAL means no data at all was sent. + /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ - if (errno == ENOSYS || errno == EINVAL) { + if (errno == ENOSYS) { goto normal_readbraw; }