[Samba] [Samba 4.0.9 | Win 7 x64 | Office 2007 x86 | Folder Redirection | Local Cache] : Word-documents, Corrupt

Bouke J. Henstra bouke at ict-diensten.com
Sun Oct 20 04:31:56 MDT 2013


Hello,

We finally got rid of our issue with corrupt Word-documents. I think that
it has to do with oplocks and offline folders.

We upgrade from Samba 4.0.9 to 4.1.0.

At boot-time we execute this batch script for all Windows clients:

[BOF]
@ECHO OFF

rem
\\alpha.inet\sysvol\alpha.inet\Policies\{31B2F340-016D-11D2-945F-00C04FB98
4F9}\MACHINE\Scripts\Startup\MachineInit.cmd

 ::: Machine Settings

     ::: Add settings for Linux File Servers
             REG ADD
HKLM\Software\Microsoft\Windows\CurrentVersion\NetCache /v
RoundUpWriteTimeOnSync /t REG_DWORD /d 00000001 /f
                 REG ADD
HKLM\SYSTEM\CurrentControlSet\services\mrxsmb\Parameters /v
OplocksDisabled /t REG_DWORD /d 00000000 /f
                 REG ADD
HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters /v
EnableOplocks /t REG_DWORD /d 00000001 /f
                 REG ADD
HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters /v
EnableOplocks /t REG_DWORD /d 00000001 /f
[EOF]

I found out that this batch script does not solve anything (but it is not
harmful - I think though that 'RoundUpWriteTimeOnSync' 'enabled' is a good
thing). So, we also changed smb.conf.

At [global] we need 'kernel oplocks = no'
At [profiles] we need:
- 'oplocks = true'
- 'level2 oplocks = true'
- 'map archive = yes'
- 'map system = yes'
- 'map hidden = yes'

I REMOVED the following (I think we do not need these - I think it could
be antipodal but I am not sure):
- 'blocking locks = no'
- 'veto oplock files =
/*.doc*/*.DOC*/*.xls*/*.XLS*/*.txt/*.TXT/*.log/*.LOG/*.csv/*.CSV/*.*-ms/*.
*-MS/'
- 'csc policy = documents'

After restarting samba and rebooting the laptop, everything seems to works
fine.

I do not know if this solved our issue for the long term... I just wanted
to let you know that it seems to be solved for us now. I need to do
further testing by editing Word-documents for a long time (online and
offline usage).
I also suspect that most of the options are already defaults (like
oplocks). I suspect that 'map system' and 'map hidden' are default set to
'no'.
I think it it a good idea that I will do some extra testing, googling and
reading to assure myself that this is the permanent fix...

Our smb.conf is listed below this text-block. Please note: this is another
domain then the one listed in my first message - but it had the same
issue. The issue with the other domain has been solved by moving profiles
to a server running Windows Server 2008R2 (we did not have time to do
extra testing for that domain... So we choose for a more drastic
fix/workaround).

### BOF ###
[global]
        workgroup = ALPHA
        realm = ALPHA.INET
        netbios name = SRV001
        server role = active directory domain controller
        server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
         socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536
SO_SNDBUF=65536
        kernel oplocks = no

[netlogon]
        path = /usr/local/samba/var/locks/sysvol/alpha.inet/scripts
        read only = No
        browseable = no

[sysvol]
        path = /usr/local/samba/var/locks/sysvol
        read only = No
        browsable = no

[profiles$]
        comment = Profiles
        path = /data/profiles
        browsable = no
        read only = no
        writable = yes
        directory mask = 0700
        create mask = 0600
        oplocks = true
        level2 oplocks = true
        map archive = yes
        map system = yes
        map hidden = yes

[public]
        comment = Local share for all users
        path = /data/local.pub
        read only = no
        directory mask = 0770
        create mask = 0660

[htdocs]
        comment = Webserver Files
        path = /data/htdocs
        read only = no
        directory mask = 0775
        create mask = 0664

[prep]
        comment = Prep Folder
        path = /data/prep
        read only = no
        browsable = no
        directory mask = 0775
        create mask = 0664
        guest ok = yes

[polycom]
        comment = Polycom
        path = /var/lib/tftpboot/polycom
        browsable = no
        read only = no
        directory mask = 0775
        create mask = 0664
        guest ok = yes

[printers]
   comment = All Printers
   browseable = no
   path = /usr/local/samba/var/spool
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /usr/local/samba/lib/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
   write list = root, @lpadmin, administrator, main01
### EOF ###

-----Oorspronkelijk bericht-----
Van: Bouke J. Henstra [mailto:bouke at ict-diensten.com]
Verzonden: maandag 14 oktober 2013 20:10
Aan: 'samba at lists.samba.org'
Onderwerp: [Samba 4.0.9 | Win 7 x64 | Office 2007 x86 | Folder Redirection
| Local Cache] : Word-documents, Corrupt

Hello,

First of all I would like to thank the Samba Project Group for this state
of the art software. I would like to thank every body for helping each
other out.
Please ignore my poor English writing. It is not my native language.
Although: I do the best I can.

We use Samba for a while now. We started with version 4.0.6 and updated
each time. Now we are at version 4.0.9 and we are planning to update our
installation to version 4.1.0.

We use Samba 4 as Active Directory Domain Controller.

We also got some shares on this same Samba server. We use the share
'profiles' for the user profiles.
Everything seems to work well but sometime we got issues with
Word-documents. These files get corrupted while working for 45 minutes to
a couple of hours.

Before we decided to work with roaming profiles I read the Samba-documents
about this option. We decided to use folder redirection including local
cache (we use desktops and notebooks).

I tried a lot of things to solve this issue (with the Word-documents):
- re-installed notebook (also replaced HDD; I installed a SSD)
- tested network wiring
- ran HDD checks (server)
- tested switches
- changed smb.conf (oplocks, locks, et cetera)
- added registry key 'RoundUpWriteTimeOnSync' to client computers at boot
time
- - REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\NetCache /v
RoundUpWriteTimeOnSync /t REG_DWORD /d 00000001 /f

Maybe there is somebody who is able to help us with this issue. I have
listed our /opt/samba/etc/smb.conf file at the end.

Thanks in advance. Bouke

[global]
        workgroup = TH01
        realm = TH01.INET
        netbios name = COMSRV01A
        server role = active directory domain controller
        server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl,
winbind, ntp_signd, kcc, dnsupdate
        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536
SO_SNDBUF=65536
        guest account = nobody
        map to guest = bad user
        #printing = cups
        #printcap name = cups
        kernel oplocks = no

[netlogon]
        path = /opt/samba/var/locks/sysvol/th01.inet/scripts
        read only = No

[sysvol]
        path = /opt/samba/var/locks/sysvol
        read only = No

[profiles]
        comment = Profiles
        path = /data/profiles
        browsable = no
        read only = no
        writable = yes
        directory mask = 0700
        create mask = 0600
        #
        # oplocks are disabled for this share
        #
          oplocks = False
          level2 oplocks = False
        #
        # 'blocking locks' set to 'no' for Word documents
        #
          blocking locks = no
        #
        # do not oplock the following files
        #
          veto oplock files =
/*.doc*/*.DOC*/*.xls*/*.XLS*/*.txt/*.TXT/*.log/*.LOG/*.csv/*.CSV/*.*-ms/*.
*-MS/
        #
        csc policy = documents

[pdf-prints]
        comment = PDF Files
        path = /data/pdf
        browsable = yes
        read only = no
        writable = yes
        directory mask = 0775
        create mask = 0664
[wpkg]
        comment = Software Deployment
        path = /opt/wpkg
        browsable = no
        read only = no
        write list = 3000000,administrator,root
        directory mask = 0755
        create mask = 0644
        guest ok = yes
        strict locking = no
        oplocks = False
        level2 oplocks = False
        blocking locks = no
        veto oplock files = /*.log/*.LOG/

[packages]
        comment = Software Packages
        path = /extra/packages
        browsable = no
        read only = no
        write list = 3000000,administrator,root
        create mask = 0644
        directory mask = 0755
        guest ok = yes

[wsus]
        comment = WSUS
        path = /extra/wsus
        browsable = no
        read only = no
        writelist = 3000000,administrator,root
        create mask = 0644
        directory mask = 0755
        guest ok = yes

[log]
        comment = Log Files
        path = /data/log
        browsable = no
        read only = no
        force create mode = 0664
        force directory mode = 0775
        guest ok = yes

[printers]
   comment = All Printers
   path = /opt/samba/var/spool
   browsable = no
   public = yes
   guest ok = yes
   writable = no
   printable = yes

# Windows clients look for this share name as a source of downloadable #
printer drivers [print$]
   comment = Printer Drivers
   path = /opt/samba/lib/printers
   browseable = yes
   guest ok = no
   read only = yes
   write list = root


More information about the samba mailing list