[Dovecot] Solaris NFS woes

Timo Sirainen tss at iki.fi
Sat Dec 16 01:31:25 UTC 2006

On Fri, 2006-12-15 at 13:08 -0500, John Harper wrote:
> I am using dovecot 1.0.rc15 (a similar problem occurred in rc10) on
> Solaris 9 (sparc). When working with a user who's home dir is on a
> local disk everything seems fine. But when that home is on an
> NFS-mounted disk things are very badly awry.
> Both the indices and the subscriptions file are being destroyed and
> what is left behind are files with names of the form .nfs72C034 etc.

I've heard of this before. I think there's a Solaris kernel patch to fix
this, but I'm not sure. If you find it, please add a note about it to

Anyway if I remember correctly, the problem went like this:

1. Dovecot creates a temp.1234 file, link()s it into subscriptions.lock
file and unlink()s temp.1234.
2. The subscriptions are written to the lock file, and then Dovecot does
rename(subscriptions.lock, subscriptions)
3. The file is close()d

By closing the file before renaming, the problem went away. I think most
of these problems could be fixed with a simple patch, but I didn't want
to do that change because it probably still breaks with other less
obvious things, so it's better to be fully broken.

You could anyway try if this mostly-fixes it:

Index: src/lib/file-dotlock.c
RCS file: /var/lib/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision
diff -u -r1.35.2.3 file-dotlock.c
--- src/lib/file-dotlock.c      8 Jun 2006 16:13:46 -0000
+++ src/lib/file-dotlock.c      16 Dec 2006 01:30:06 -0000
@@ -664,6 +664,12 @@
+       if (dotlock->fd != -1) {
+               if (close(dotlock->fd) < 0)
+                       i_error("close(%s) failed: %m", dotlock->path);
+               dotlock->fd = -1;
+       }
        if (rename(lock_path, dotlock->path) < 0) {
                i_error("rename(%s, %s) failed: %m", lock_path, dotlock->path);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20061216/a1e2e0f6/attachment.pgp 

More information about the dovecot mailing list