[Dovecot] Cannot remove Maildir folder

Marcin Deranek marcin at ripe.net
Tue May 30 17:22:05 EEST 2006


Hi,

I have been using dovecot 1.0 beta 8 on Debian Sarge for a couple of
days and I experienced some problems when removing folders..

As an IMAP client I use Thunderbird 1.5 and IMAP folders are on NFS.
Here are the steps to re-produce the problem:
1. Run Thunderbird as usual
2. Create folder
3. Remove folder - In my case folder is not removed but moved to Trash
(Thunderbird setting)
4. I go to Trash and remove it from there
5. Folder is removed but I get additional ..DOVECOT-TRASHED directory -
next time it won't be possible to remove it

Some more info:
* Just before removal I run lsof to see which files are in use:

bash# lsof /home/marcin
...
imap    21360 marcin  cwd    DIR   0,15 344064  3307008 /home/marcin
(filer:/vol/vol0/home/marcin)
imap    21360 marcin    8u   DIR   0,15   4096  4223651
/home/marcin/Maildir/.Trash.test/new (filer:/vol/vol0/home/marcin)
imap    21360 marcin    9u   DIR   0,15   4096  4223650
/home/marcin/Maildir/.Trash.test/cur (filer:/vol/vol0/home/marcin)
imap    21360 marcin   11r   REG   0,15    144  4223663
/home/marcin/Maildir/.Trash.test/dovecot.index (filer:/vol/vol0/home/marcin)
imap    21360 marcin   12r   REG   0,15    104  4223647
/home/marcin/Maildir/.Trash.test/dovecot.index.log
(filer:/vol/vol0/home/marcin)
imap    21360 marcin   13u   REG   0,15  10272  4223657
/home/marcin/Maildir/.Trash.test/dovecot.index.cache
(filer:/vol/vol0/home/marcin)
...

There are more files in use but in this case I'm interested with PID
21360 which has opened Trash/test (the one which I'm going to remove)

* Just after removal I see error message in Syslog:

dovecot: IMAP(marcin):
unlink_directory(/home/marcin/Maildir/..DOVECOT-TRASHED) failed: Device
or resource busy

Running lsof again gives the following:

imap    21360 marcin  cwd    DIR   0,15 344064  3307008 /home/marcin
(filer:/vol/vol0/home/marcin)
imap    21360 marcin   11r   REG   0,15    144  4223663
/home/marcin/Maildir/..DOVECOT-TRASHED/.nfs004072af0002cb1b
(filer:/vol/vol0/home/marcin)
imap    21360 marcin   12r   REG   0,15    104  4223647
/home/marcin/Maildir/..DOVECOT-TRASHED/.nfs0040729f0002cb1a
(filer:/vol/vol0/home/marcin)
imap    21360 marcin   13u   REG   0,15  10272  4223657
/home/marcin/Maildir/..DOVECOT-TRASHED/.nfs004072a90002cb1c
(filer:/vol/vol0/home/marcin)

Looking into some NFS docs we can read:

"A client has a file opened. Another process on that client deletes the
file. So the client NFS stack rather than deleting the file and
potentially hurting the other process, it renames the file to
.nfs<file_handle>."

To me it looks like one imap process tries to delete .Trash.test
directory (first rename and then unlink) whereas other imap process has
still opened dovecot.* files.
Any workaround/fix for that ?
Regards,

Marcin Deranek


More information about the dovecot mailing list