[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: passwd file locking (was Re: New!!!: Base-passwd 2.0)



According to Marek Michalkiewicz:
> BTW, I wonder why it has been decided to use the *.lock convention for
> locking mailboxes.  It has similar problems as /etc/ptmp - if the lock
> file is there after a crash, the user won't receive any mail.  Also,
> MUAs need to be setgid mail to be able to create the lock.  Why not just
> use fcntl() locks instead?  No special privileges required, and no more
> problems with stale lock files...

Because the *.lock file works over NFS, _if_ you get the implementation
right. That means you should not create the lockfile with O_EXCL which isn't
atomic over NFS..

I've checked the source of the Debian MTA's (sendmail, smail) and MUA's
(elm, mailx, etc) and none of them gets it right. (Except qpopper ofcourse :))
So even though we use dotfile locking, it doesn't work over NFS.

However I wrote a small pre-loaded library, libnfslock.so, that overrides
the open() library call and checks if it is a call with O_EXCL. If so,
and the destination file is on NFS, it uses a NFS safe version of
exclusively opening a file.

That works fine - we've been using NFS mounted mail spool for a month now
or so, and I haven't seen _one_ problem yet. Perhaps I should make a
debian package for it.

Mike.
-- 
   Miquel van      | Cistron Internet Services   --    Alphen aan den Rijn.
   Smoorenburg,    | mailto:info@cistron.nl          http://www.cistron.nl/
miquels@cistron.nl | Our vision is to speed up time, eventually eliminating it.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: