bogofilter over NFS

Dan Stromberg strombrg at dcs.nac.uci.edu
Mon Feb 3 17:46:08 CET 2003


On Mon, Feb 03, 2003 at 05:15:30PM +0100, Piotr KUCHARSKI wrote:
> On Mon, Feb 03, 2003 at 07:59:07AM -0800, Dan Stromberg wrote:
> > > Did anyone use bogofilter on a NFS-mounted HOME, where all mails
> > > and also .bogofilter/.db are located? I'm experiencing some strange
> > > problems.
> > I do, without problems, between two redhat 7.3 hosts with current kernel
> > patches.
> 
> Let's say that Linux NFS is out of question, they are almost always
> horribly broken. I'm using Solaris.
> 
> > NFS locking is a frequent source of problems.  If you study the procmail
> > source, you'll get an indication of the extremes people have gone to in
> > order to work around the bugs.
> 
> In bogofilter 0.7.4 it worked. In bogofilter 0.10.1.4 it does not work.
> (It doesn't even pass make check, looping over fcntl(), but what locked
> the test files in the first place, that it cannot regain lock?)

It's not necessarily a matter of a broken application.

NFS locking is often just horribly broken.  Even with Suns.

It's best to do this (from the open man page on redhat) :

       O_EXCL When  used with O_CREAT, if the file already exists
              it is an error and the open will fail. In this con-
              text,  a  symbolic link exists, regardless of where
              its points to.  O_EXCL is broken on NFS  file  sys-
              tems,  programs  which  rely  on  it for performing
              locking tasks will contain a race  condition.   The
              solution for performing atomic file locking using a
              lockfile is to create a unique file on the same  fs
              (e.g., incorporating hostname and pid), use link(2)
              to make a link to the lockfile. If  link()  returns
              0,  the lock is successful.  Otherwise, use stat(2)
              on the unique file to check if its link  count  has
              increased to 2, in which case the lock is also suc-
              cessful.

...instead of fcntl.

> I'm thinking, perhaps it is the change from one F_SETLKW to
> many F_SETLK in a loop? I don't quite see another explanation.

This is possible, but not the only possibility.

-- 
Dan Stromberg                                               UCI/NACS/DCS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.bogofilter.org/pipermail/bogofilter/attachments/20030203/e2ee446f/attachment.sig>


More information about the Bogofilter mailing list