Problem while deleting mailbox on a private spool on NFS

Christophe Boyanique tof at
Thu Mar 24 06:24:57 EST 2005

Derrick J Brashear a écrit :

> I suspect if you watch nfs network traffic you see a failed attempt to 
> delete the directory, the problem is likely that the nfs server for some 
> reason believes a file in the directory is still existant or possibly 
> even open and so is unwilling to delete. Is anything in your log?

You're right: the directory delete fails because directory is not empty.

The nfs implementation renames the 3 cyrus.* files to .nfs.something 
when deleting them. When Cyrus tries to delete the parent directory; it 
fails because these 3 files are still there.

So the question is: why these 3 files are still there ?

With a workmate we watched into Cyrus code and found that it tries to 
delete the mailbox directory before closing these 3 files handles opened 
just before. That works on local filesystem and doesn't work over NFS.

Here is a patch (appliable to Debian 2.1.17 or upstream 2.1.18 or 
2.2.12) in the mailbox_delete function in the imap/mailbox.c file which 
corrects this behaviour and solves the reported problem:

+++ cut +++
diff -Naur cyrus-imapd-2.1.17/imap/mailbox.c 
--- cyrus-imapd-2.1.17/imap/mailbox.c   2003-11-04 22:43:00.000000000 +0100
+++ cyrus-imapd-2.1.17.patched/imap/mailbox.c   2005-03-24 
11:57:14.000000000 +0100
@@ -2275,13 +2275,14 @@

+    /* Close mailbox directory before removing it */
+    mailbox_close(mailbox);
      /* Remove empty directories, going up path */
      do {
         *tail = '\0';
      } while (rmdir(buf) == 0 && (tail = strrchr(buf, '/')));
-    mailbox_close(mailbox);
      return 0;

+++ cut +++

 From what I saw, it doesn't seem to introduce side effect as the 
mailbox is to be deleted and the mailbox_delete function is only called 
from the mboxlist.c file; but as it is the first time I dig in the Cyrus 
code I'd like any feedback about this modification...

Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list