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

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



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.

>> > A process must not unlink a lock file it does not own.
>> But this is currently done by the leafnode programs.
> If so, that's a bug. Who does it, when and why? 

in miscutil.c:

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. Another process had done that before. The
program itself had locked a dead file... 

All those unlink() calls may be left out. But then, another way should
be found to INT fetchnews upon termination of a dialup connection.

> I'm wondering if a central daemon that leafnode uses to cache overviews,
> request changes to the overview and/or news spool (post, cancel) would
> be good.

That's worth thinking about...

Stefan


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