seg@smsdpg.uu.net (Scott Garfinkle) (01/19/89)
Has anybody done anything with sharing/locking under DOS 3.x and PC-NGS? The manual specifically states that advisory locking is supported via the standard DOS function calls. However, I wrote the following simple program to test this stuff and found that my requests for locks are completely ignored -- this program, run from two different PC nodes at the same time, returns successfully from acquiring a lock on the same file on out server! Am I missing something? Setup: AT clone and PC clone, both running PC-DOS 3.3 with SHARE installed and PC-NFS v3.0; Server==Sun 3/180 running SunOS 4.0. (PCs are using the WD8003 ethernet cards.) Code for test follows (for MSC5.1) Scott E. Garfinkle SMS Data Products Group, Inc. uunet!smsdpg!seg (smsdpg!seg@uunet.uu.net)( ----------- #include <stdio.h> #include <sys\locking.h> #include <fcntl.h> #include <io.h> #include <share.h> #include <sys\types.h> #include <sys\stat.h> char *cmdname; main(int argc, char **argv) { int fd; long flen; extern int errno; cmdname = *argv; if(argc != 2) { fprintf(stderr,"Usage: %s <file-to-lock>\n",cmdname); exit(1); } if((fd = sopen(argv[1],O_RDWR,SH_DENYWR)) == -1) { fprintf(stderr,"%s: Couldn't open %s for read/write, errno=%d.\n", cmdname,argv[1],errno); exit(2); } printf("Opened %s for read/write in Deny Write mode.\nHit any key to continue.", argv[1]); fflush(stdout); (void) getch(); putch('\n'); putch('\r'); flen = filelength(fd); if(locking(fd,LK_LOCK,flen)) { fprintf(stderr,"%s: Failed to lock %ld bytes, errno=%d.\n", cmdname,flen,errno); exit(3); } printf("Locked %ld bytes. Hit any key to continue.", flen); fflush(stdout); (void) getch(); exit(locking(fd,LK_UNLCK,flen)); }
geoff@eagle_snax.UUCP ( R.H. coast near the top) (01/23/89)
In article <183@smsdpg.uu.net> seg@smsdpg.uu.net (Scott Garfinkle) writes: >Has anybody done anything with sharing/locking under DOS 3.x and PC-NGS? >The manual specifically states that advisory locking is supported via the >standard DOS function calls. However, I wrote the following simple program >to test this stuff and found that my requests for locks are completely >ignored -- this program, run from two different PC nodes at the same time, >returns successfully from acquiring a lock on the same file on out server! >Am I missing something? Setup: AT clone and PC clone, both running PC-DOS >3.3 with SHARE installed and PC-NFS v3.0; Server==Sun 3/180 running SunOS 4.0. >(PCs are using the WD8003 ethernet cards.) Code for test follows (for MSC5.1) > Scott E. Garfinkle > SMS Data Products Group, Inc. > uunet!smsdpg!seg (smsdpg!seg@uunet.uu.net)( The use of SHARE is completrely irrelevant, although if you start it after PC-NFS it may confuse things (I'll try it in a few minutes). The server must be running a version of the lock manager which supports the PC extensions: run rpcinfo -u servername 100021 3 and if you see program 100021 version 3 ready and waiting all is well. If you see rpcinfo: RPC: Program not registered program 100021 version 3 is not available you should install a copy of the modified network lock manager from the PC-NFS distribution kit. Then make sure that when you mount the drive in NFSCONF you select Use lock manager (required) for "Options"; if you prefer to run NET USE by hand, append a "/MS" switch to the command. Geoff -- Geoff Arnold, Sun Microsystems Inc. | "It is well known that the longer one PC Dist. Sys. Group (home of PC-NFS) |postpones a pleasure, the greater the UUCP: {hplabs,decwrl...}!sun!garnold |pleasure when it arrives. Therefore, if ARPA: garnold@sun.com |one postpones it forever..." (Smullyan)
seg@smsdpg.uu.net (Scott Garfinkle) (01/25/89)
From article <449@eagle_snax.UUCP>, by geoff@eagle_snax.UUCP ( R.H. coast near the top): > In article <183@smsdpg.uu.net> seg@smsdpg.uu.net (Scott Garfinkle) writes: /* The original article referred to trying to acquire a lock on a file * via PC-NFS. I still haven't figured out how. Geoff replies: */ > The use of SHARE is completrely irrelevant, although if you start it > after PC-NFS it may confuse things (I'll try it in a few minutes). True! NFS redirector lets you apply locking() to NFS files, even if share isn't loaded (good idea). > The server must be running a version of the lock manager which supports > the PC extensions.... Yes, our server does. As I'd said, we're running SunOS4.0. In fact, I'd even tried using the (older) lockd supplied with PC-NFS to see if would help. > ...if you prefer to run NET USE by hand, append a "/MS" switch to the command. I've been using /sh. When we use /ms (must share), applying a lock to a file from one pc causes all other pcs to be locked out from all file accesses in that net drive. Even if the lock is applied to a file in a subdirectory, another pc can't create files in a parent directory! Further, the inaccessability from other nodes remains in effect even after the original lock has been relinquished. So, I'm not missing something obvious. Is there somthing subtle? Scott E. Garfinkle SMS Data Products Group, Inc. uunet!smsdpg!seg
prc@maxim.ERBE.SE (Robert Claeson) (01/27/89)
In article <449@eagle_snax.UUCP>, geoff@eagle_snax.UUCP ( R.H. coast near the top) writes: > The server must be running a version of the lock manager which supports > the PC extensions: run > rpcinfo -u servername 100021 3 > and if you see > program 100021 version 3 ready and waiting > all is well. If you see > rpcinfo: RPC: Program not registered > program 100021 version 3 is not available > you should install a copy of the modified network lock manager > from the PC-NFS distribution kit. What if I don't have a Sun server? Do the lock managers now distributed to other vendors include the PC modifications? Or is the lock manager on the PC-NFS disks the ONLY version that supports locking from PC-NFS? . -- Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden "No problems." -- Alf Tel: +46 758-202 50 EUnet: rclaeson@ERBE.SE uucp: uunet!erbe.se!rclaeson Fax: +46 758-197 20 Internet: rclaeson@ERBE.SE BITNET: rclaeson@ERBE.SE
geoff@eagle_snax.UUCP ( R.H. coast near the top) (02/01/89)
In article <468@maxim.ERBE.SE> prc@maxim.ERBE.SE (Robert Claeson) writes: :In article <449@eagle_snax.UUCP>, geoff@eagle_snax.UUCP ( R.H. coast near the top) writes: : :: The server must be running a version of the lock manager which supports :: the PC extensions: run :: rpcinfo -u servername 100021 3 :: and if you see :: program 100021 version 3 ready and waiting :: all is well. If you see :: rpcinfo: RPC: Program not registered :: program 100021 version 3 is not available :: you should install a copy of the modified network lock manager :: from the PC-NFS distribution kit. : :What if I don't have a Sun server? Do the lock managers now distributed :to other vendors include the PC modifications? Or is the lock manager on :the PC-NFS disks the ONLY version that supports locking from PC-NFS? All NFS licensees have the source code to the version of the lock manager which supports DOS operations (and which, by the way, is used by DOS windows on the Sun386i workstation as well as by PC-NFS). Every licensee has their own release schedule for NFS, and obviously it's outside Sun's control when these releases appear. At Connectathon (the multi-vendor testing session) later this month I will check on all of the implementations which are being tested to see which ones support the version 3 lock manager. -- Geoff Arnold, Sun Microsystems Inc. | "It is well known that the longer one PC Dist. Sys. Group (home of PC-NFS) |postpones a pleasure, the greater the UUCP: {hplabs,decwrl...}!sun!garnold |pleasure when it arrives. Therefore, if ARPA: garnold@sun.com |one postpones it forever..." (Smullyan)