Bug#900821: linux-image-4.9.0-6-amd64: apache reads wrong data over cifs filesystems served by samba
I've found that when you mount a filesystem being served by samba on a host
running apache and serve the files on this filesystem over apache, you'll
get garbage mixed with the file content.
This means that you get the right length but the file's content gets
This only happens when serving the files from samba, if you serve them from
Windows the problem doesn't appear.
I have found this problem in a pure Debian stable installation (Stretch),
but I have tested this on a pure testing (Buster) installation with even
worst results, the download breaks and the kernel shows this:
Doing several md5sums of the files directly on the cifs filesystem will
allways result in the same md5, also doing dd if=file|md5sum, however
wget http://localhost/file -O -|md5sum
will result on a different code each time.
The same tests running the same Stretch machine with Jessie's kernel will
Like I've said I've been able to replicate this on standard Stretch and
Buster configs. These are the steps to replicate...
apt-get install samba apache2 cifs-utils
add to smb.conf to create a ftp share and then: service smbd reload
writable = no
locking = no
path = /srv/ftp
public = yes
browseable = no
generate a file to be served:
dd if=/dev/zero of=/srv/ftp/100Mzero bs=1024k count=100
mount the share on the web directory to serve it:
mount.cifs //localhost/ftp /var/www/html/
test the local access of the cifs:
Acces the file over apache:
wget http://localhost/100Mzero -O - 2>/dev/null|md5sum
Like I said, changing to a Jessie's kernel this works ok, changing to a
Buster 4.16 kernel or testing on a full Buster setup gives similar problem
but http transfer is interrupted and kernel shows previous message. Also
serving the file from Windows works ok. So this is a problem when serving
from Samba (both Stretch or Buster versions) to a Apache ( md5sum or dd of
the file directily over cifs mount works ok).
If you need any other info to replicate don't hesitate to ask.
Salvatore, I'm testing on an up to date buster running kernel 4.17.17-1 and
I still see the kernel warning messages and the downloads are breaking and wget
still shows this king of messages:
2018-08-29 13:45:31 (122 MB/s) - Read error at byte 1056768/6538880 (Bad address). Retrying.
So I see no progresses with newer versions or anything like that.
Don't know what are the differences between your setup and mine, maybe it is
the file length?
What seems to work ok is the workaround of setting EnableSendfile to on,
this avoids the original problem I had found on Stretch and also the
problems I later found on buster with the kernel warnings and broken