On Thu, 2002-04-11 at 15:24, John Wade wrote: > Just for reference, what file system type are you using (ext2, ext3, etc.)
ext3 with the noatime,data=journal options > Have you tried using gdb to backtrace what the processes are blocking > on? Yes, lmtpd was blocked in flock. > Hope it works for you, I have not looked at the lock_flock.c file on 2.1.3, > but I doubt that it has changed. Microscopic changes, diff attached for reference. Now waiting :-) -Hein
--- lock_flock.c.old Tue Oct 2 23:08:13 2001 +++ lock_flock.c Thu Apr 11 15:14:23 2002 @@ -48,6 +48,7 @@ #include <errno.h> #ifdef HAVE_UNISTD_H #include <unistd.h> +#include <syslog.h> #endif #include "lock.h" @@ -56,6 +57,8 @@ extern int errno; +#define MAXTIME 99 + /* * Block until we obtain an exclusive lock on the file descriptor 'fd', * opened for reading and writing on the file named 'filename'. If @@ -79,14 +82,27 @@ int r; struct stat sbuffile, sbufspare; int newfd; + int delay=0, i=0; if (!sbuf) sbuf = &sbufspare; - for (;;) { - r = flock(fd, LOCK_EX); + for(i=0,delay=0;;) { + r = flock(fd, LOCK_EX|LOCK_NB); if (r == -1) { - if (errno == EINTR) continue; - if (failaction) *failaction = "locking"; + if (errno == EINTR) { + continue; + } + else if ((errno == EWOULDBLOCK) && (delay < MAXTIME)) { + syslog(LOG_DEBUG, "lock: reopen-blocked sleeping for %d on interval +%d (%d, %s)" , delay, i, fd, filename); + sleep(delay); + i++; + delay = i*i; + continue; + } + if (failaction) { + if (delay >= MAXTIME) *failaction = "locking_timeout"; + else *failaction = "locking"; + } return -1; }
signature.asc
Description: This is a digitally signed message part