From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7a01654699d9257f X-Google-Attributes: gid1164f8,public X-Google-Thread: fee84,7a01654699d9257f X-Google-Attributes: gidfee84,public X-Google-Thread: 10b612,7a01654699d9257f X-Google-Attributes: gid10b612,public X-Google-ArrivalTime: 1995-01-05 18:17:14 PST Path: nntp.gmd.de!newsserver.jvnc.net!netnews.upenn.edu!dsinc!spool.mu.edu!howland.reston.ans.net!gatech!bloom-beacon.mit.edu!crl.dec.com!crl.dec.com!nntpd.lkg.dec.com!alingo.zk3.dec.com!werme From: werme@alingo.zk3.dec.com (Eric Werme) Newsgroups: comp.unix.osf.osf1,comp.unix.ultrix,comp.sys.dec Subject: Re: Mail Locking Ultrix/OSF Date: 5 Jan 95 15:03:43 GMT Organization: Digital Equipment Corporation Message-ID: References: <3e1p6l$i3f@amhux3.amherst.edu> <1995Jan2.124404.1101@arbi.Informatik.Uni-Oldenburg.DE> Reply-To: werme@zk3.dec.com NNTP-Posting-Host: alingo.zk3.dec.com Xref: nntp.gmd.de comp.unix.osf.osf1:7109 comp.unix.ultrix:16410 comp.sys.dec:20818 Klaus.Moeller@arbi.informatik.uni-oldenburg.de (Klaus Moeller) writes: >pdchapin@unix.amherst.edu (PAUL D. CHAPIN) writes: >>The problem is that we're adding OSF/1 workstations, and they aren't >>being very cooperative. It's no problem to mount the mail filesystem >>and read messages from it, but it you try to mail anything to it you >>get various kinds of locking problems. I can find very little doc on >>file locking with mail under Ultrix. I'm beginning to suspect that >>this was tightened up on OSF to get rid of some mail related security >>problems. No, I believe that was tightened up to close races where you can lose mail arriving at the same time as the NFS client is truncating the mail file. The solution is for all parties to lock the file, and that's what OSF/1 is doing. I'm not sure what the mail code on Ultrix is doing, but at the very least you should be running rpc.lockd on the server. >There are three ways to lock a file under UNIX >1) Dotfile based locking. I.e. to lock a file create a file > .lock. Not totally secure (you might get race conditions), > locks only a complete file but it works on almost everything, even NFS > and *ancient* versions of UNIX. Be sure that the process id is *not* > written to the lock file. (Process id is a method to detect stale locks > but does not work on a network, for example if the writing process is > on a different machine than the stale-lock-checking-process.) For a long time, this was the only locking mechanism available on Unix. I haven't thought through the various race possibilities when this is done over NFS. One drawback of this is that locks persist over system crashes and power failures. >2) flock or fcntl based locking. Advisory locking mechanism that allows > locking of a part of a file. DOES NOT WORK OVER NFS. >3) lockf based locking. Works over NFS. Operation similiar to that of fcntl. You are confused. flock(2) is a whole file locking mechanism that is not effective over NFS. lockf(3) is a libc routine that translates into fcntl(2) system calls. If the file is a NFS client file, this works only if the clicnt and server are running rpc.lockd. > Should be the locking mechanism of choice if it weren't almost allways > broken. I recomend not to use it, since you can't even expect lockd to > work over different releases of the same OS. At present, I believe we have three open bug reports against rpc.lockd. One affect PCs and some third party NFS implementations. One old report involves mishandling a lost NLM message between lock daemons and was found in local testing, and one recent report involves simultaneously taking out hundreds of locks, but that may have been fixed in V3.0. That fix is in a patch available from Ultrix support. If NFS locking were "almost allways broken", I would expect more bug reports. While rpc.lockd and automount have justly deserved their reputations, the OSF/1 rpc.lockd is not too bad. It could certainly use a few months of work, but it is a lot better lock daemons of a few years ago. (And automount here is far more solid than what we got from Sun.) One challenge they both labor under is that a huge amount of code has to be working for both to work well. As for NFS locking mail files, I'm no mail guru, so I'm not certain what you want to do with a OSF/1 client and Ultrix server. Running lock daemons on both is the first step. -- Eric (Ric) Werme | werme@zk3.dec.com Digital Equipment Corp. | This space intentionally left blank.