[Dovecot] Creating and renaming mbox folders on NFS auto-installed partitions
I'm trying dovecot-0.99.9.1 in place of uw-imap which ground to a halt on a 500MHz SunBlade 100 Solaris 8 system which acts as our Departmental mail server. INBOXes are mbox files on the servers's local SCSI disk. But user directories are auto mounted from other Sun NFS servers and these may contain other mbox mailboxes in a ~/Mail directory.
There's a problem with creating (and with renaming) mailboxes in the NFS mounted ~/Mail directory. For an arbitrary mailbox "newbox", say, dovecot tries to create the parent directory path /home/username/Mail before creating the newbox file.
But /home/username is automounted and so creating directory /home or /home/username fails with errno 89 ENOSYS - unsupported file system operation.
The solution is to check for the existence of the directory before trying to create it. This will work since /home and /home/username will always exist for any valid user.
I've amended mbox-storage.c in src/lib-storage/index/mbox to call "access" to do this....
*** src/lib-storage/index/mbox/mbox-storage.c.orig Tue Apr 15 14:04:02 2003 --- src/lib-storage/index/mbox/mbox-storage.c Wed May 14 16:04:39 2003
*** 38,44 **** p++; }
! if (mkdir(dir, CREATE_MODE) < 0 && errno != EEXIST) { t_pop(); return -1; } --- 38,44 ---- p++; }
! if ( (access(dir,F_OK) != 0) && mkdir(dir, CREATE_MODE) < 0 && errno != EEXIST) { t_pop(); return -1; }
(Could also remove the && errno == EEXIST part - it's redundant when access(dir,F_OK) is checking for existence).
Robert
Robert.Evans@cs.cf.ac.uk Tel:+44(0)29 2087 5518 Fax:+44(0)29 2087 4598 http://www.cs.cf.ac.uk/department/staff/Robert.Evans.shtml Computer Science, Cardiff University, PO Box 916, Cardiff, CF24 3XF, UK
On Wed, 2003-05-14 at 18:37, Robert Evans wrote:
There's a problem with creating (and with renaming) mailboxes in the NFS mounted ~/Mail directory. For an arbitrary mailbox "newbox", say, dovecot tries to create the parent directory path /home/username/Mail before creating the newbox file.
Yes, I think I'll actually change a bit how that function works. It almost always needs to create only the last directory, so I'll just start checking the existence from the second-last directory in it and start going down until one is found.
(Could also remove the && errno == EEXIST part - it's redundant when access(dir,F_OK) is checking for existence).
Not really, there could be race condition when two sessions try to create it at the same time (however unlikely that is).
participants (2)
-
Robert Evans
-
Timo Sirainen