Write lock error between linux and windows

I need to run a bunch of old DOS FoxPro / Clipper applications on linux under DOSEMU. Programs gain access to their "databases" located on a network server (can be Windows or Linux server)

Actually, the programs worked fine, but I can't get the recording of records to work as intended: I can run the program on two terminals (or on the server and on any terminal for the instance) and block the same record on both.

Now I am using Tiny Core Linux as terminal and Windows XP as server, files via CIFS and latest DOSEMU (1.4.0), but I tried with various server combinations (Ubuntu 7 to 9, damn little Linux, XP) :) protocol (CIFS, samba, different smbclient versions) ↔ client (same as server) with no luck

I tried to configure the server side to work without oplocks in samba (after reading the whole O'Reilly Samba book locking chapter at http://oreilly.com/catalog/samba/chapter/book/ch05_05.html ) and in XP (\ HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ LanmanServer \ Parameters \ UseOpportunisticLocking = 0), but the problem persists.

Any ideas?

TIA, Pablo

+2


source to share


5 answers


@Michael: The programs work great on any DOS network (Lantastic, WFW) or Windows (95, NT, XP, ...).

I created a minimal C program to reproduce the behavior:



#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <process.h>
#include <share.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
 int handle, status;
 long length;

 handle = sopen("testlock.txt", O_RDONLY,SH_DENYNO,S_IREAD);

 if (!handle)
 {
    printf("sopen failed\n");
    exit(1);
 }

 length = filelength(handle);
 status = lock(handle,0L,length/2);

 if (status == 0)
    printf("lock succeeded\n");
 else
    printf("lock failed\n");

 printf ("Press a key...\n");
 getch();

 status = unlock(handle,0L,length/2);

 if (status == 0)
    printf("unlock succeeded\n");
 else
    printf("unlock failed\n");

 close(handle);
 return 0;
}

      

It works fine in DOS / Windows (the first terminal can block, the second cannot), but does not work in Linux under DOSEMU (you can run two instances of the program at the same time on a network share, and both can get blocked regardless of the Linux-Windows / Windows startup sequence -Linux).

+1


source


First: do these programs have any information about blocking? Are they meant to run with a db file on a network share?

In the DOS days, network sharing was not common (and when it was, it was Netware as often as it wasn't). If the database engine has no ideas about sharing the underlying db file, then it doesn't matter that you are with cifs - it is not blocking, so it won't work.



Now if you're already doing this correctly on a DOS box network and you're trying to migrate to Linux, what is the current DOS network? Is it cifs, or is it more like Netware? Is there a chance the database engine is aware of the networking stack and is doing something funny? This can lead to problems in a new environment where the db engine is not aware of the network.

If you really need to figure out what's going on, you can try using Wireshark to monitor CIFS traffic and try to understand how it uses (or doesn't) use blocking. It's a lot of effort, although if you can't create a few trivial applications for testing, then it will be a lot of work.

0


source


I can confirm that this problem exists as stated above. One solution is to move shared DBF files from Windows server to linux server. these files can then be transferred via CIFS (SAMBA) to Windows stakeholders and vi NFS (with -o sync nolock options) to Linux stakeholders. This works well for us.

Brett

0


source


This appears to be a known, ongoing problem .

I know that byte locking (like Windows style write locking) requires the latest kernels, although I don't know if this appeared in the 2.4 series or not.

If DosemU can't get you to work, you might have to resort to something more "exotic". Perhaps running FreeDOS under a KVM virtual machine will get you closer to your goals, although you will need to do some manual configuration to get network support (that or figure out how to make a network share as a local drive letter in the guestbook). Scroll through the KVM compatibility list to see the status of the various DOS-like installations.

If you have the original 6.22 installations to work with, then this might be your best bet.

0


source


We run dos epos application on share samba with Windows 98, Xp workstations with correct blocking settings on share samba, which we can also launch the application through dosmeu. There are a number of blocking settings in the samba tab, in which we used the following settings.

 [data]
        comment = data Share
        inherit acls = Yes
        path = /data/
        read only = No
        oplocks = no
        locking = Yes
        strict locking = No
        create mask = 0774
        directory mask = 0775
        browseable = Yes
        default case = upper

      

0


source







All Articles