[Dovecot] flock problems with index files and passwd-file

Michal Soltys nozo at ziu.info
Thu Mar 15 15:28:42 EET 2007


Timo Sirainen wrote:
> It can't be the passwd-file format directly. I'm rather guessing that
> OpenBSD doesn't like your UID to be as high as 20000. Try with a lower
> one. If it works, it's an OpenBSD bug.
> 

Lower ones behave in the same way :)

I did a bit of a ktrace though. This is what happens:

- imap process creates .temp file (descriptor 0x7 is returned)
- hardlink is created to that .temp file, as
   dovecot.index.log.newlock
- .temp file is removed
- attempt to open dovecot.index.log is being made (file doesn't exist)
- imap writes some data to 0x7
- dovecot.index.log.newlock is renamed to dovecot.index.log
- 0x7 is flocked
- dovecot.index.log is opened (descriptor 0x8)
- attempt to flock 0x8 is made, blocking imap forever

Below is the relevant fragment of ktrace:

  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log.newlock"
  27588 imap     RET   lstat -1 errno 2 No such file or directory
  27588 imap     CALL  stat(0x896af328,0xcfbcd710)
  27588 imap     NAMI  "/home/regular/test/Maildir/.temp.rasengan.ppgk.com.pl.27588.7edf2cf58afb1871"
  27588 imap     RET   stat -1 errno 2 No such file or directory
  27588 imap     CALL  open(0x896af328,0xa02,0x1b6)
  27588 imap     NAMI  "/home/regular/test/Maildir/.temp.rasengan.ppgk.com.pl.27588.7edf2cf58afb1871"
  27588 imap     RET   open 7
  27588 imap     CALL  link(0x896af328,0x896af2c0)
  27588 imap     NAMI  "/home/regular/test/Maildir/.temp.rasengan.ppgk.com.pl.27588.7edf2cf58afb1871"
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log.newlock"
  27588 imap     RET   link 0
  27588 imap     CALL  unlink(0x896af328)
  27588 imap     NAMI  "/home/regular/test/Maildir/.temp.rasengan.ppgk.com.pl.27588.7edf2cf58afb1871"
  27588 imap     RET   unlink 0
  27588 imap     CALL  fstat(0x7,0xcfbcd810)
  27588 imap     RET   fstat 0
  27588 imap     CALL  umask(0x3f)
  27588 imap     RET   umask 54/0x36
  27588 imap     CALL  open(0x8b975280,0x2,0x2d)
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log"
  27588 imap     RET   open -1 errno 2 No such file or directory
  27588 imap     CALL  write(0x7,0xcfbcd8f0,0x18)
  27588 imap     GIO   fd 7 wrote 24 bytes
        "\^A\0\^X\0\M-PD\M-yE\^A\0\0\0\0\0\0\0\0\0\0\0\M-PD\M-yE"
  27588 imap     RET   write 24/0x18
  27588 imap     CALL  rename(0x8b975340,0x8b975300)
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log.newlock"
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log"
  27588 imap     RET   rename 0
  27588 imap     CALL  gettimeofday(0xcfbcda88,0)
  27588 imap     RET   gettimeofday 0
  27588 imap     CALL  sigprocmask(0x1,0xffffffff)
  27588 imap     RET   sigprocmask 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x3)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x1)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  sigprocmask(0x3,0)
  27588 imap     RET   sigprocmask -65793/0xfffefeff
  27588 imap     CALL  sigprocmask(0x1,0xffffffff)
  27588 imap     RET   sigprocmask 0
  27588 imap     CALL  mprotect(0x29a80000,0x2000,0x3)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  mprotect(0x29a80000,0x2000,0x1)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  sigprocmask(0x3,0)
  27588 imap     RET   sigprocmask -65793/0xfffefeff
  27588 imap     CALL  setitimer(0,0xcfbcd9a0,0xcfbcd990)
  27588 imap     RET   setitimer 0
  27588 imap     CALL  sigprocmask(0x1,0xffffffff)
  27588 imap     RET   sigprocmask 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x3)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x1)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  sigprocmask(0x3,0)
  27588 imap     RET   sigprocmask -65793/0xfffefeff
  27588 imap     CALL  flock(0x7,0x2)
  27588 imap     RET   flock 0
  27588 imap     CALL  setitimer(0,0xcfbcd9a0,0xcfbcd990)
  27588 imap     RET   setitimer 0
  27588 imap     CALL  stat(0x896af2c0,0xcfbcd9c0)
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log"
  27588 imap     RET   stat 0
  27588 imap     CALL  open(0x896af2c0,0x2,0)
  27588 imap     NAMI  "/home/regular/test/Maildir/dovecot.index.log"
  27588 imap     RET   open 8
  27588 imap     CALL  fstat(0x8,0xcfbcd8c0)
  27588 imap     RET   fstat 0
  27588 imap     CALL  sigprocmask(0x1,0xffffffff)
  27588 imap     RET   sigprocmask 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x3)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  mprotect(0x3c0ec000,0x1000,0x1)
  27588 imap     RET   mprotect 0
  27588 imap     CALL  sigprocmask(0x3,0)
  27588 imap     RET   sigprocmask -65793/0xfffefeff
  27588 imap     CALL  pread(0x8,0x82d1f33c,0x18,0,0,0)
  27588 imap     GIO   fd 8 read 24 bytes
        "\^A\0\^X\0\M-PD\M-yE\^A\0\0\0\0\0\0\0\0\0\0\0\M-PD\M-yE"
  27588 imap     RET   pread 24/0x18
  27588 imap     CALL  setitimer(0,0xcfbcd9a0,0xcfbcd990)
  27588 imap     RET   setitimer 0
  27588 imap     CALL  flock(0x8,0x2)



More information about the dovecot mailing list