Hi there,
I use dovecot on a server with some Nightmare File Systerm (aka NFS)
storage.
When I delete a folder, its content gets deleted, but the folder itself
does not.
Here's what I found:
#### Step 1: From a shell, telnet to imap, then create a folder
cpetrescu at cpetrescu-mobile:~$ telnet server1.localdomain 143
Trying 10.200.28.36...
Connected to server1.localdomain.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE
AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
01 login testuser1 Password
01 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE
SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT
CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC
ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in
02 create INBOX/F1
02 OK Create completed.
#### Step2: On the server, everything is OK, the folder is there
[server1: testuser1]# ls -lrtA Maildir/INBOX/
total 4
drwxr-xr-x 5 root root 4096 Dec 5 10:28 F1
[server1: testuser1]# ls -lrtA Maildir/INBOX/F1/
total 12
drwxr-xr-x 2 root root 4096 Dec 5 10:28 tmp
drwxr-xr-x 2 root root 4096 Dec 5 10:28 new
drwxr-xr-x 2 root root 4096 Dec 5 10:28 cur
#### Step3: in the telnet session, delete the folder
03 delete INBOX/F1
03 OK Delete completed.
#### Step4: On the server, the content of the folder is gone, but the
folder is still there
[server1: testuser1]# ls -lrtA Maildir/INBOX/
total 4
drwxr-xr-x 2 root root 4096 Dec 5 10:29 F1
[server1: testuser1]# ls -lrtA Maildir/INBOX/F1/
total 0
#### Debugging:
I defined my own my_delete_dir and added it to the delete_dir list in
mailbox_list_vfuncs
In my_delete_dir I just call readdir on that folder, and print the files
via syslog.
Here's the content of F1 before calling delete_dir:
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name: "new" inode:
843617
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name: "tmp" inode:
843623
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name: "cur" inode:
843616
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name:
"dovecot.index.log" inode: 2363059
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name: "." inode:
843612
Dec 05 10:29:14 imap(testuser1): my_delete_dir: d_name: ".." inode:
807717
And here's its content after calling delete_dir
Dec 05 10:29:15 imap(testuser1): my_delete_dir: name: INBOX/F1
Dec 05 10:29:15 imap(testuser1): my_delete_dir: path:
/data/testuser1/Maildir/INBOX/F1
Dec 05 10:29:15 imap(testuser1): my_delete_dir: ret: -1
Dec 05 10:29:15 imap(testuser1): my_delete_dir: error: "Directory not
empty" trying again
Dec 05 10:29:15 imap(testuser1): my_delete_dir: d_name: "." inode:
843612
Dec 05 10:29:15 imap(testuser1): my_delete_dir: d_name: ".." inode:
807717
Dec 05 10:29:15 imap(testuser1): my_delete_dir: d_name:
".nfs0000000000240eb3000000e0" inode: 2363059
Dec 05 10:29:15 imap(testuser1): my_delete_dir: ret: -1
So, the dovecot.index.log was deleted, but it's still open, and the folder
can't be deleted because of the pesky .nfs* file.
Now, the question: Is there a *magic* function that closes
"dovecot.index.log" that I can call before delete_dir()? I tried
mailbox_log_close() but it didn't help.
Thanks a lot.
p.s. Please don't suggest that I should not use NFS! I know that, and I
don't really like NFS, but I have no other choice.
Catalin Petrescu <catalin.petrescu gmail com>