Samba / DosEmu And Oplocks !!!!
Hi, I have Linux Kernel 2.4.18 , Samba 2.2.3a and DosEmu 1.1.3. I am running a Clipper aplication under DosEmu and when some users access the same Clipper aplication via Samba, my db/ntx files are corrupted!!!!...The locks & unlocks doesn´t work well.
Please, have you resolved this problem in your site ???
Regards,
Carlos A Silva
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Carlos A Silva
Hi, I have Linux Kernel 2.4.18 , Samba 2.2.3a and DosEmu 1.1.3. I am running a Clipper aplication under DosEmu and when some users access the same Clipper aplication via Samba, my db/ntx files are corrupted!!!!...The locks & unlocks doesn´t work well.
Please, have you resolved this problem in your site ???
Clipper can use different lock semantic in each RDD
Some of them use phantom locks (over the size of file) and over the 2GB limit (DOS has 32bit lock area, POSIX 31 when you use fcntl on 32bit machine).
The newest Samba use fcntl64 (63 bit lock area) with kernel 2.4 I guess it is the problem. When I last time checked DOSEMU it used only normal fcntl and cleared the highest bit in lock address. It has to be changed to avoid such lock problems.
BTW. OPLOCKS is other lock mechanism and should be disabled in samba or other smb file servers for DOS apps. Usually DOS programs cannot benefit form OPLOCKS but it's very easy way to corrupt shared data (OPLOCKS increase the time when new/modified data is stored on client side and not on the server).
best regards,
Przemek
-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Przemyslaw Czerpak
The newest Samba use fcntl64 (63 bit lock area) with kernel 2.4 I guess it is the problem. When I last time checked DOSEMU it used only normal fcntl and cleared the highest bit in lock address. It has to be changed to avoid such lock problems.
This could well be the case, thanks. The fundamental problem seems to be that file offsets in DOS are unsigned 32-bit whereas in Unix they are signed (off_t/loff_t).
Right now, for LOCK_FILE_REGION (as opposed to the locking bits used when opening a file), for the struct flock larg, larg.l_len is masked with ~0xc0000000 so even the *two* highest bits are cleared.
For l_start, the top two bits are shifted like this:0xc0000020 becomes 0x3000020.
because " /* the offset is often strange - remove 2 of its bits if either of
the top two bits are set. Shift the top ones by two bits. This still allows OLE2 apps to operate, but should stop lockd from dieing */ "
it means though that if the relevant file is greater than 256 MB things can go horribly wrong.
Now with fcntl64 we can probably avoid this wizardry but will probably also need to use open64 instead of open and check the kernel version at runtime?
$ man fcntl64 No manual entry for fcntl64
Hmm :(
Bart
On Sat, 02 Nov 2002, Bart Oldeman wrote:
[...]
Quoted 3 lines
Now with fcntl64 we can probably avoid this wizardry but will probably also need to use open64 instead of open and check the kernel version at runtime?
If you want you can check kernel version. But I rather think that it should be set as compilation switch. But is your choice.
Quoted 2 lines
$ man fcntl64 No manual entry for fcntl64
I had to read header files and kernel sources as documentation :-( You can use F_GETLK64, F_SETLK64, F_SETLKW64 in standard fcntl if you add
#define _GNU_SOURCE
to your .c source (see /usr/include/features.h)
That's all what you need.
I attach simple demonstration program.
best regards,
Przemek
Quoted 1 line · Przemyslaw Czerpak
Clipper can use different lock semantic in each RDD
Can you tell me more about sixdriver's DBFNSX / SIXNSX if you know? Can be this RDD lock-safe and what setup/versions/features (if you know) it needs to behaviour correctly (samba, kernel, etc.)?
Thanks
Signature · 1 line
Michal Samek <[email protected]>