[Samba] Multi-user databases (DOS application) in WIndows XP and Windows 2k file locking problem

Steve Kuryachy sysx at kzer-za.pp.ru
Fri Apr 15 03:51:20 GMT 2005

Hello all!

I discover a strange thing.

We use and develop DOS financial accounting application, written on Xbase 
(formerly known as Clipper). This application agressively uses of file 
sharing and locking (byte-range and all possible for DOS combinations), 
creates and uses huge amount of index (NTX) and Dbase III (DBF) files on 
network shared resource. Network clients are Windows 98se, Windows 
Millennium, Windows 2k (latest SP applied) and Windows XP (latest SP applied)

In case of Windows 98 or Me, file lock operations seems to be good. When 
application creates NTX (index) files, other users can open and read and 
possibly update this files, but cannot overwrite or delete them. THis is 
correct behavior. Also, users with our application can read and edit 
some .DBF's concurrently. All concurrent edits and updates are goes fine (in 
the order of byte-range locking).

But when I start this application on Windows 2k or XP in their "premium" DOS 
virtual machine (ntvdm), all things goes bad. Applications on the stations, 
which are runs under Win2k or XP also create NTX or DBF files as it needs. 
But other user (from ANY client (Win98/Me, 2k or XP) may freely overwrite 
"locked" NTX files and delete them. Seems what this files are not locked, but 
smbstatus and SWAT shows what this files are locked. Also, in concurrent 
updates and edits of some DBF's updates are goes in wrong order. User on 
Win98/Me may enter some very valuable data, but user on WinXP or 2k (who use 
same file) may trash this data by one DBF update. Seems, what Win2k or WinXP 
put a some sort of "internal caching" on all DOS file operations. Seems to be 
that some (or all) portions of internal cache on Win2k or XP stations are not 
synchronized with real data on the network shared resource

I found, what opportunistic locking (level 2 too) and client-side caching may 
produce similair bugs. I found MANY registry patches for XP and 2k, which are 
turns CSC and Oplocks off, they are all applied, but nothing helps me.

Here is my smb.conf:

# Samba config file created using SWAT
# from (
# Date: 2005/04/14 13:41:01

# Global parameters
 dos charset = cp866
 unix charset = koi8-r
 workgroup = ICPLUS
 netbios name = SK_UNIX
 server string = Samba Server
 interfaces = eth0, eth1, eth2, lo0
 security = SHARE
 log file = /var/log/smb/log.%m
 max log size = 50
 time server = Yes
# change notify timeout = 300
 max disk size = 40000
 max open files = 65300
 os level = 90
 preferred master = Yes
 dns proxy = No
 wins server =
 kernel oplocks = No
 lock spin count = 100
 lock spin time = 15
 ldap ssl = no
 hosts allow = 192.168.0., 192.168.5., 192.168.7., 192.168.3., 127.
 csc policy = disable
 oplocks = No
 level2 oplocks = No
 wide links = No
 follow symlinks = No
 dos filemode = Yes
 dos filetimes = Yes
 dos filetime resolution = Yes

 comment = System volume
 path = /mnt/raid1/wingz/sys/__sys
 read only = No
 create mask = 0770
 directory mask = 0770
 guest ok = Yes

And here is output of smbstatus for some NTX'es and DBF's:

this files on the Windows 98 station:
27783  DENY_NONE  0x3         RDWR   
NONE             /mnt/raid1/wingz/sys/__sys/_INFOBUH/2005/ZPL/UVOLNNL.NTX   
Fri Apr 15 10:09:08 2005
27783  DENY_NONE  0x3         RDWR       
NONE             /mnt/raid1/wingz/sys/_
_sys/#BUDGET/2005/SYS/DOCOMP.DBF   Fri Apr 15 09:39:39 2005

and this files on the Windows XP station:
28217  DENY_NONE  0x2019f     RDWR       
NONE             /mnt/raid1/wingz/sys/_
_sys/#BALSYS/NSI/VENTADDR.NTX   Fri Apr 15 10:45:15 2005
28217  DENY_NONE  0x2019f     RDWR       
NONE             /mnt/raid1/wingz/sys/_
_sys/#BAL/SETUP/STATUSG.DBF   Fri Apr 15 10:45:12 2005

Why status are so different for Windows 98 (0x3) and XP(0x2019f)?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20050415/8c0cf617/attachment.bin

More information about the samba mailing list