From: tehJaffamuffin on
> I have been using vsftpd to write to some CIFS filesystems mounted
> under /var/ftp but consistently found that inbound files were
> corrupted by many kilobytes of zero values starting from byte position
> 1. The amount of zero values varied from between locations
> 0x000001:0x00a000 and 0x000001:0x00f000 (and possibly further). but
> position for position, the remainder of the file matched the original;
> i.e. the first portion of the file was not actually displaced, but
> simply replaced by zero values.
>
> The general consensus on the web/usenet (etc) is to turn on the
> use_sendfile=NO option in vsftpd.conf, but this would only save the
> first write after any restart of the vsftpd service. The actual
> solution came from mounting the directories with the mount.cifs option
> "nobrl" which configures the kernel such that it does not send byte
> range lock requests to the server. Or something.
>
> use_sendfile=NO did however have a use in preventing "426 Failure
> writing network stream." on ftp reads.
>
> The entire mount commands were:
>
> mount -t cifs -o credentials=/etc/samba/cifs_credentials -o rw -o
> nobrl //Win2003SR2/ftp$/inbound /var/ftp/inbound
> mount -t cifs -o credentials=/etc/samba/cifs_credentials -o rw -o
> nobrl //Win2003SR2/ftp$/outbound /var/ftp/outbound
>
> packages in use (not necessarily relevant):
>
> samba-client-3.0.25b-1.el5_1.4
> samba-common-3.0.25b-1.el5_1.4
> kernel-xen-2.6.18-53.1.6.el5
> vsftpd-2.0.5-10.el5
>
> Hope this helps.
>


Damn - this is exactly the problem I have (identical), and the
solution works. Been searching around for most of the day - this is
the only post on the 'net with this info. Strangely the issue only
occurs for files of greater than 'a few' megabyte, so people could
possibly be operating without knowledge that they may have an issue.

My setup is Debian Lenny mounted via cifs on to Win2k3 Enterprise
attached to a DAS.
Vsftpd version 2.0.7-1
Linux ftp 2.6.26-2-686 #1 SMP Wed Feb 10 08:59:21 UTC 2010 i686 GNU/
Linux
samba-common 2:3.2.5-4lenny9

Cheers...