Fix bug #6019 File corruption in Clustered SMB/NFS environment managed via CTDB
authorJeremy Allison <jra@samba.org>
Tue, 13 Jan 2009 19:24:24 +0000 (11:24 -0800)
committerJeremy Allison <jra@samba.org>
Tue, 13 Jan 2009 19:24:24 +0000 (11:24 -0800)
Jeremy.

source/lib/sendfile.c
source/smbd/reply.c

index f4f6e16526f31f7485370be02f9738d24f3a0059..4aa58c358f50a087a8716fe38337773ea8469645 100644 (file)
@@ -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
index d8cbfd8e87f7e8e7a2098ed294317de82f1bcf9f..69a9885cad6d42030b83f19aba76170eabf20a3a 100644 (file)
@@ -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;
                        }