ReiserFS does not commit link() synchronously (mounting with "sync"
doesn't change anything). Therefore, if there is a power outage during
the Maildir delivery or if qmail-smtpd answered the final "queued"
message without actually commiting the link in queue/todo, the message
will not be processed by qmail-send.

  Here is a patch to make Qmail more reliable for Linux users using a
ReiserFS partition.

  Best regards,
-- 
         Frank DENIS aka Jedi/Sector One aka DJ Chrysalis <[EMAIL PROTECTED]>
                -> Software : http://www.jedi.claranet.fr <-
      If Bill Gates had a dime for every time a Windows box crashed...
                  ...oh, wait a minute -- he already does.
--- ../qmail-1.03.orig/qmail-local.c    Mon Jun 15 12:53:16 1998
+++ qmail-local.c       Sun Jul 16 16:19:04 2000
@@ -1,5 +1,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #include "readwrite.h"
 #include "sig.h"
 #include "env.h"
@@ -128,6 +129,9 @@
  if (close(fd) == -1) goto fail; /* NFS dorks */
 
  if (link(fntmptph,fnnewtph) == -1) goto fail;
+ if ((fd = open(fnnewtph, O_RDONLY)) < 0 ||
+     fsync(fd) < 0 || close(fd) < 0) goto fail;
+   
    /* if it was error_exist, almost certainly successful; i hate NFS */
  tryunlinktmp(); _exit(0);
 
--- ../qmail-1.03.orig/qmail-queue.c    Mon Jun 15 12:53:16 1998
+++ qmail-queue.c       Sun Jul 16 16:19:33 2000
@@ -1,5 +1,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #include "readwrite.h"
 #include "sig.h"
 #include "exit.h"
@@ -155,6 +156,7 @@
 {
  unsigned int len;
  char ch;
+ int fd;
 
  sig_blocknone();
  umask(033);
@@ -183,7 +185,7 @@
  todofn = fnnum("todo/",0);
  intdfn = fnnum("intd/",0);
 
- if (link(pidfn,messfn) == -1) die(64);
+ if (link(pidfn,messfn) == -1) die(64); 
  if (unlink(pidfn) == -1) die(63);
  flagmademess = 1;
 
@@ -248,6 +250,8 @@
  if (fsync(intdfd) == -1) die_write();
 
  if (link(intdfn,todofn) == -1) die(66);
+ if ((fd = open(todofn, O_RDONLY)) < 0 ||
+     fsync(fd) < 0 || close(fd) < 0) die(66); 
 
  triggerpull();
  die(0);

Reply via email to