> -----Messaggio originale-----
> Da: kbo [mailto:kbo]Per conto di Ken Jones
> Inviato: giovedi 8 marzo 2001 16.35
> A: Andrea Cerrito
> Cc: [EMAIL PROTECTED]
> Oggetto: Re: CODA and VPOPMAIL and link/rename
>
>
> This is really interesting. So CODA has problems with the link/unlink
> function but works okay with the rename function.

No. Just with link(). Here it is what a Coda developer said about the link
function: http://www.coda.cs.cmu.edu/maillists/codalist-2000/0719.html

> Hmm.. why not
> change all the link's in vpopmail to renames?

Done (see attached patch) and it appears to work. Anyway, I haven't tested
it a lot, but I think it's all ok (I mean, we are just changing the way
vpopmail move files, nothing else).

> Is there any major performance problem or other gotcha's we could
> run into if we switched the links to renames? If not, let's make
> the change.

I don't think there are performance issues, but security issue: qmail uses
link function in Maildir to be sure to successfully deliver mail even in
case of disk failure. I don't know how rename() can be in such situations.

> While we are at it. There is an fsync in vdelivermail.c. I don't
> really see a reason and it would just increase the disk I/O load.

Well, haven't looked at that. :)
---
Cordiali saluti / Best regards
Andrea Cerrito
^^^^^^^^^^^^^^
Net.Admin @ Centro MultiMediale di Terni SpA
P.zzale Bosco 3A
05100 Terni IT
Tel. 0744 / 5441330
Fax. 0744 / 5441372
ÿþ*** vdelivermail.c.old  Thu Mar  8 
16:57:56 2001

--- vdelivermail.c      Thu Mar  8 
16:55:26 2001

***************

*** 573,591 ****

        if ( hit_filter == 1 ) {

                do_filter_delivery( 
tmp_file );

        } else {

!               if 
(link(tmp_file,mailname) == -1) {

                        delete_tmp();

                        failtemp("Unable 
to link tmp to new (#4.3.7)\n");

                }

        }

  #else

!       if (link(tmp_file_f,mailname) == 
-1) {

                delete_tmp_f();

                failtemp("Unable to link 
tmp to new (#4.3.7)\n");

        }

  #endif

  

!       delete_tmp_f();

  }

  

  

--- 573,595 ----

        if ( hit_filter == 1 ) {

                do_filter_delivery( 
tmp_file );

        } else {

! 

! /* Using rename() instead of link() due 
to Codafs. */

!               if 
(rename(tmp_file,mailname) == -1) { 

                        delete_tmp();

                        failtemp("Unable 
to link tmp to new (#4.3.7)\n");

                }

        }

  #else

!       if (rename(tmp_file_f,mailname) == 
-1) {

                delete_tmp_f();

                failtemp("Unable to link 
tmp to new (#4.3.7)\n");

        }

  #endif

  

! /* We don't need delete_tmp_f anymore, 
because rename() "deletes" file in tmp/ 
dir.

!       delete_tmp_f(); 

! */

  }

  

  

***************

*** 783,793 ****

                delete_tmp();

                failtemp("Unable to 
close() tmp file (#4.3.6)\n");

        }

!       if (link(tmp_file,mailname) == -1) 
{

                delete_tmp();

                failtemp("Unable to link 
tmp to new (#4.3.7)\n");

        }

!       delete_tmp();

  

  #ifdef HARD_QUOTA

        if ( pw_data != NULL && 
sstrncmp(pw_data->pw_shell, "NO",2)!=0 &&

--- 787,797 ----

                delete_tmp();

                failtemp("Unable to 
close() tmp file (#4.3.6)\n");

        }

!       if (rename(tmp_file,mailname) == 
-1) {

                delete_tmp();

                failtemp("Unable to link 
tmp to new (#4.3.7)\n");

        }

! /*    delete_tmp(); */

  

  #ifdef HARD_QUOTA

        if ( pw_data != NULL && 
sstrncmp(pw_data->pw_shell, "NO",2)!=0 &&

*** vpopbull.c.old      Thu Mar  8 
16:58:31 2001

--- vpopbull.c  Thu Mar  8 16:57:28 2001

***************

*** 223,229 ****

                fclose(fs);

        } else if ( DeliveryMethod == 
HARD_LINK_IT ) {

                sprintf(tmpbuf1, "%s/%s", 
CurDir, EmailFile);

!               if ( link( tmpbuf1, 
tmpbuf) < 0 ) {

                        perror("link");

                }

        } else if ( DeliveryMethod == 
SYMBOLIC_LINK_IT ) {

--- 223,230 ----

                fclose(fs);

        } else if ( DeliveryMethod == 
HARD_LINK_IT ) {

                sprintf(tmpbuf1, "%s/%s", 
CurDir, EmailFile);

! /* Using hardlink on codafs isn't 
allowed, so we can use the rename() 
function instead. */

!               if ( rename( tmpbuf1, 
tmpbuf) < 0 ) {

                        perror("link");

                }

        } else if ( DeliveryMethod == 
SYMBOLIC_LINK_IT ) {

Reply via email to