Hi,

AIX's implementation of posix_fallocate is a little bit, let me say,
peculiar. Attached is a patch to "fix" (=work around) this.

Without you'll see this in the logs:

Jul 28 01:17:41 trevi mail:err|error dovecot: IMAP(beckerr):
    posix_fallocate() failed: File exists
Jul 28 01:17:41 trevi mail:err|error dovecot: IMAP(beckerr):
    file_set_size() failed with mbox file
    /u/f0/rzuser/beckerr/Mail/Ham: File exists

Funny, isn't it?

This is what it should be:

Jul 28 01:17:41 trevi mail:err|error dovecot: IMAP(beckerr):
    posix_fallocate() failed: Operation not supported on socket
Jul 28 01:17:41 trevi mail:err|error dovecot: IMAP(beckerr):
    file_set_size() failed with mbox file
    /u/f0/rzuser/beckerr/Mail/Ham: Operation not supported on socket

The problem is, that errno is not correcly set, when posix_fallocate
returns EOPNOTSUPP (="Operation not supported on socket"). In this
case the return code has to be checked rather than errno.

When patched dovecot handles err==EOPNOTSUPP the same way like
errno==EINVAL on Solaris.


A note for all AIX Admins:
Without APAR
  IZ48778: POSIX_FALLOCATE() FAILS WITH ERROR-25(ENOTTY) resp.
  IZ46961: POSIX_FALLOCATE() FAILS WITH ERROR-25(ENOTTY)
           APPLIES TO AIX 5300-06
you don't even get EOPNOTSUPP: posix_fallocate fails with NOTTY.
So you have to install one of this fixes to make the patch work.

Ralf

-- 
______________________________________________________________________

 Dipl.-Inform. (FH) Ralf Becker     Rechenzentrum (r/ft) der FH Trier
 (Network|Mail|Web|Firewall)           University of applied sciences
 Administrator                           Schneidershof, D-54293 Trier

   Mail: [email protected]                    Fon: +49 651 8103 499
    Web: http://www.fh-trier.de/~beckerr        Fax: +49 651 8103 214
 PubKey: http://www.fh-trier.de/~beckerr     Crypto: GnuPG, S/MIME
______________________________________________________________________

 Wenn Gott gewollt haette, dass E-Mail in HTML geschrieben wuerden,
 endeten Gebete traditionell mit </amen>. (Tom Listen)
--- ./lib/file-set-size.c.org   2009-07-06 12:56:17.000000000 +0200
+++ ./lib/file-set-size.c       2009-07-06 12:54:40.000000000 +0200
@@ -43,9 +43,15 @@
 
 #ifdef HAVE_POSIX_FALLOCATE
        if (posix_fallocate_supported) {
-               if (posix_fallocate(fd, st.st_size, size - st.st_size) == 0)
+               int err;
+               if ((err = posix_fallocate(fd, st.st_size, size - st.st_size)) 
== 0)
                        return 0;
 
+               if (err == EOPNOTSUPP /* AIX */ ) {
+                       /* Ignore this error silently.
+                          You have to test err, because errno is not
+                          correcly set on some versions of AIX */
+               } else
                if (errno != EINVAL /* Solaris */) {
                        if (!ENOSPACE(errno))
                                i_error("posix_fallocate() failed: %m");

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to