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

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

index d1b178577c2e9da807f203bb92d1f9439b1b46be..fb10cae2aa3c64dec010b3f9620fab2cbecec8d0 100644 (file)
@@ -65,7 +65,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
@@ -143,7 +143,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 a613459a5b3f0f2dd51cd003e2a4c3ae7c978e62..c192d4a13895a629ba2e5e16068a2cb556295ee9 100644 (file)
@@ -3230,9 +3230,9 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                setup_readX_header((char *)headerbuf, smb_maxcnt);
 
                if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -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_read;
                        }