Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 301045 - cifs: file append loss of data
Summary: cifs: file append loss of data
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's SAMBA Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-15 01:58 UTC by email200202
Modified: 2012-11-08 16:12 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description email200202 2010-01-15 01:58:13 UTC
When I append (greater than 1M bytes) to a file stored in a cifs mounted file system,  the last part of the data is lost. The amount lost varies from run to run. 

Reproducible: Always

Steps to Reproduce:
case 1: (append)
mount -t cifs //server/some_share /mnt/cifs_drive -o username=xxx,password=xxx,uid=xxx,gid=xxx,users
cat large_file.txt >> /mnt/cifs_drive/some_file.txt
tail large_file.txt
tail /mnt/cifs_drive/some_file.txt
umount /mnt/cifs_drive

case 2: (overwrite)
mount -t cifs //server/some_share /mnt/cifs_drive -o username=xxx,password=xxx,uid=xxx,gid=xxx,users
cat large_file.txt > /mnt/cifs_drive/some_file.txt
tail large_file.txt
tail /mnt/cifs_drive/some_file.txt
umount /mnt/cifs_drive

case 3: (append with directio option)
mount -t cifs //server/some_share /mnt/cifs_drive -o username=xxx,password=xxx,uid=xxx,gid=xxx,users,directio
cat large_file.txt >> /mnt/cifs_drive/some_file.txt
tail large_file.txt
tail /mnt/cifs_drive/some_file.txt
umount /mnt/cifs_drive

case 4: (append with nounix option)
mount -t cifs //server/some_share /mnt/cifs_drive -o username=xxx,password=xxx,uid=xxx,gid=xxx,users,nounix
cat large_file.txt >> /mnt/cifs_drive/some_file.txt
tail large_file.txt
tail /mnt/cifs_drive/some_file.txt
umount /mnt/cifs_drive

Actual Results:  
The output of the two tail commands are different for the first case and the same for the others.

Expected Results:  
They should be the same in all cases.

The client and the server are up-to-date Gentoo machines.

client:
# emerge --info
Portage 2.1.6.13 (default/linux/x86/10.0/desktop, gcc-4.3.4, glibc-2.9_p20081201-r2, 2.6.31-gentoo-r6 i686)
=================================================================                                          
System uname: Linux-2.6.31-gentoo-r6-i686-Intel-R-_Pentium-R-_D_CPU_3.20GHz-with-gentoo-1.12.13            
Timestamp of tree: Thu, 14 Jan 2010 21:35:01 +0000                                                         
app-shells/bash:     4.0_p35                                                                               
dev-java/java-config: 2.1.9-r2                                                                             
dev-lang/python:     2.6.4                                                                                 
dev-util/cmake:      2.6.4-r3                                                                              
sys-apps/baselayout: 1.12.13                                                                               
sys-apps/sandbox:    1.6-r2                                                                                
sys-devel/autoconf:  2.13, 2.63-r1                                                                         
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.2                                                            
sys-devel/binutils:  2.18-r3                                                                               
sys-devel/gcc-config: 1.4.1                                                                                
sys-devel/libtool:   2.2.6b                                                                                
virtual/os-headers:  2.6.27-r2                                                                             
ACCEPT_KEYWORDS="x86"                                                                                      
CBUILD="i686-pc-linux-gnu"                                                                                 
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"                                                    
CHOST="i686-pc-linux-gnu"                                                                                  
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"                                                 
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"                                                        
CXXFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"                                                                                 
DISTDIR="/opt/portage/distfiles"                                                                                                          
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"                            
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"                                     
LANG="en_GB"                                                                                                                              
LC_ALL="en_GB"                                                                                                                            
LDFLAGS="-Wl,-O1"
LINGUAS="en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/opt/portage"
PORTDIR_OVERLAY="/opt/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa berkdb bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo fam firefox flac gd gdbm ggi gif gpm graphics graphviz gstreamer gtk hal iconv icu ieee1394 ipv6 java jpeg kde kerberos kpathsea latex ldap libnotify live mad mikmod mng modules mp3 mp4 mpeg mudflap multislot mysql ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl plotutils png ppds pppd pstricks publishers python qt qt3support qt4 quicktime rdesktop readline reflection samba science sdl session spell spl sql sqlite ssl startup-notification svg svga sysfs tcpd threads thunar tiff truetype unicode usb v4l v4l2 vorbis webkit win32codecs wxwindows x264 x86 xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa vga fglrx"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

server:
# emerge --info
Portage 2.1.6.13 (hardened/linux/x86/10.0, gcc-4.3.4, glibc-2.10.1-r1, 2.6.28-hardened-r9 i686)
=================================================================                              
System uname: Linux-2.6.28-hardened-r9-i686-Intel-R-_Xeon-R-_CPU_3050_@_2.13GHz-with-gentoo-1.12.13
Timestamp of tree: Thu, 14 Jan 2010 00:00:01 +0000                                                 
app-shells/bash:     4.0_p35                                                                       
dev-lang/python:     2.6.4                                                                         
sys-apps/baselayout: 1.12.13                                                                       
sys-apps/sandbox:    1.6-r2                                                                        
sys-devel/autoconf:  2.63-r1                                                                       
sys-devel/automake:  1.9.6-r2, 1.10.2                                                              
sys-devel/binutils:  2.18-r3                                                                       
sys-devel/gcc-config: 1.4.1                                                                        
sys-devel/libtool:   2.2.6b                                                                        
virtual/os-headers:  2.6.27-r2                                                                     
ACCEPT_KEYWORDS="x86"                                                                              
CBUILD="i686-pc-linux-gnu"                                                                         
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer -fforce-addr"                               
CHOST="i686-pc-linux-gnu"                                                                          
CONFIG_PROTECT="/etc"                                                                              
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"                                                                                                                      
CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
LINGUAS="en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl ads berkdb bzip2 cli cracklib crypt cups cxx dbus dri gdbm gpm hal hardened iconv kerberos ldap modules mudflap ncurses nptl nptlonly oav openmp pam pcre perl pic pppd python readline reflection samba session spl ssl sysfs tcpd threads urandom usb winbind x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1         emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m         maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="xgi sis vesa vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 email200202 2010-01-15 02:04:53 UTC
the server use flags:

# equery u samba
[ Searching for packages matching samba... ]
[ Colour Code : set unset ]                 
[ Legend : Left column  (U) - USE flags from make.conf              ]
[        : Right column (I) - USE flags packages was installed with ]
[ Found these USE variables for net-fs/samba-3.0.37 ]
 U I
 + + acl          : Adds support for Access Control Lists
 + + ads          : Enable Active Directory support
 + + async        : Enables asynchronous input/output
 - - automount    : Enables automount support
 - - caps         : Use Linux capabilities library to control privilege
 + + cups         : Add support for CUPS (Common Unix Printing System)
 - - debug        : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
 - - doc          : Adds extra documentation (API, Javadoc, etc)
 - - examples     : Install examples, usually source code
 - - fam          : Enable FAM (File Alteration Monitor) support
 - - ipv6         : Adds support for IP version 6
 + + kernel_linux : KERNEL setting for system using the Linux kernel
 + + ldap         : Adds LDAP support (Lightweight Directory Access Protocol)
 + + oav          : Enables support for the OpenAntiVirus plugins
 + + pam          : Adds support PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
 + + python       : Adds support/bindings for the Python language
 - - quotas       : Enables support for user quotas
 + + readline     : Enables support for libreadline, a GNU line-editing library that almost everyone wants
 - - selinux      : !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
 - - swat         : Enables support for swat configuration gui
 - - syslog       : Enables support for syslog
 + + winbind      : Enables support for the winbind auth daemon
Comment 2 email200202 2010-03-01 22:56:50 UTC
Although 'directio' can be used as workaround for the first problem, I found that it can cause problems if you try to run a jar file from Linux server but not from Windows server!
 
mount -t cifs //linux_server/some_share /mnt/cifs_drive -o
username=xxx,password=xxx,uid=xxx,gid=xxx,users,directio

java -jar /mnt/cifs_drive/same_application.jar
mmap failed for CEN and END part of zip file
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.<init>(ZipFile.java:114)
 at java.util.jar.JarFile.<init>(JarFile.java:133)
 at java.util.jar.JarFile.<init>(JarFile.java:70)

umount /mnt/cifs_drive

mount -t cifs //win_server/other_share /mnt/cifs_drive -o
username=xxx,password=xxx,uid=xxx,gid=xxx,users,directio

java -jar /mnt/cifs_drive/same_application.jar

it works

umount /mnt/cifs_drive


Comment 3 Víctor Ostorga (RETIRED) gentoo-dev 2012-11-08 16:12:37 UTC
Please reopen if you can reproduce this with net-fs/cifs-utils