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

Re: [leafnode-list] writeactive() not updating mtime?



Stefan Wiens <s.wi@xxxxxxx> writes:

> Matthias Andree <ma@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> > Detecting the "stale" state is difficult across multiple machines since
> > you cannot easily look at the other box's pids. 
> 
> That's why fcntl() locking is done additionally.

BBD - broken by design.

> int lockfile_exists( int silent, int block ) {
> [...]
>     fd = open( lockfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR );
> [...]
>     ret = fcntl( fd, block ? F_SETLKW : F_SETLK, &fl );
> 
> 
> leafnode-2.0b5/applyfilter.c:103:       unlink( lockfile );
> leafnode-2.0b5/applyfilter.c:111:       unlink( lockfile );
> leafnode-2.0b5/applyfilter.c:116:       unlink( lockfile );
> leafnode-2.0b5/applyfilter.c:190:    unlink( lockfile );
> leafnode-2.0b5/nntpd.c:1244:        unlink( lockfile );
> leafnode-2.0b5/fetchnews.c:1701:                if ( unlink( lockfile ) )
> leafnode-2.0b5/texpire.c:702:   unlink( lockfile );
> leafnode-2.0b5/texpire.c:715:   unlink( lockfile );
> leafnode-2.0b5/texpire.c:739:    unlink( lockfile );
> leafnode-2.0b5/rnews.c:300:    unlink( lockfile );
> 
> When, in nntpd.c, a check on the return value of unlink() is added, 
> and several articles are posted in a short period, there are messages
> that unlink() failed. 

THAT were the spurious messages I have seen occasionally. Heck. I'm
getting a clue how broken leafnode really is. :-(

> Another process had done that before. The program itself had locked a
> dead file...

"Must not happen." A process must only unlock if it has obtained the
lock on its own.

If the lock files are being respected everywhere, i. e. lockfile_exists
is split into try_lock, obtain_lock, and there is a new function,
un_lock, then everything should be fine again.

Not the best performance possibly, but clean.

-- 
Matthias Andree

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list