CODA and VPOPMAIL

2001-03-08 Thread Andrea Cerrito

Hi to all,

I'm trying to test a future production system using qmail + vpopmail +
codafs.

I know there is a patch for qmail to run on codafs, using Maildirs (function
link(from,to) isn't allowed on codafs), and I think I've to do the same on
vpopmail.
Here is the patch for qmail (qmail-local)

= begin
*** qmail-local.c.orig Tue Mar 14 10:21:56 2000
--- qmail-local.c Tue Mar  7 11:49:35 2000
***
*** 127,134 
--- 127,138 
   if (fsync(fd) == -1) goto fail;
   if (close(fd) == -1) goto fail; /* NFS dorks */

+ #ifdef NFS_HACK
   if (link(fntmptph,fnnewtph) == -1) goto fail;
 /* if it was error_exist, almost certainly successful; i hate NFS */
+ #else
+  if (rename(fntmptph,fnnewtph) == -1) goto fail;
+ #endif
   tryunlinktmp(); _exit(0);
   fail: tryunlinktmp(); _exit(1);

= end

This patch allow another (even not so sure) method of switching files
between dirs. I saw that vpopmail code is using the same technique as qmail,
and infact, after patching qmail, I have that problem only to virtual
accounts (#4.3.4).

Do you think sufficient changing all link(from,to) into rename(from,to)
functions in all .c of vpopmail?
Is there an official patch to vpopmail to work on codafs?

Thank you

---
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




CODA and VPOPMAIL

2001-03-08 Thread Andrea Cerrito

(sorry if this message will exist twice)

Hi to all,

I'm trying to test a future production system using qmail + vpopmail +
codafs.

I know there is a patch for qmail to run on codafs, using Maildirs (function
link(from,to) isn't allowed on codafs), and I think I've to do the same on
vpopmail.
Here is the patch for qmail (qmail-local)

= begin
*** qmail-local.c.orig Tue Mar 14 10:21:56 2000
--- qmail-local.c Tue Mar  7 11:49:35 2000
***
*** 127,134 
--- 127,138 
   if (fsync(fd) == -1) goto fail;
   if (close(fd) == -1) goto fail; /* NFS dorks */

+ #ifdef NFS_HACK
   if (link(fntmptph,fnnewtph) == -1) goto fail;
 /* if it was error_exist, almost certainly successful; i hate NFS */
+ #else
+  if (rename(fntmptph,fnnewtph) == -1) goto fail;
+ #endif
   tryunlinktmp(); _exit(0);
   fail: tryunlinktmp(); _exit(1);

= end

This patch allow another (even not so sure) method of switching files
between dirs. I saw that vpopmail code is using the same technique as qmail,
and infact, after patching qmail, I have that problem only to virtual
accounts (#4.3.4).

Do you think sufficient changing all link(from,to) into rename(from,to)
functions in all .c of vpopmail?
Is there an official patch to vpopmail to work on codafs?

Thank you

---
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




Re: CODA and VPOPMAIL and link/rename

2001-03-08 Thread Ken Jones

This is really interesting. So CODA has problems with the link/unlink
function but works okay with the rename function. Hmm.. why not
change all the link's in vpopmail to renames?

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.

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.

Ken


Andrea Cerrito wrote:
 
 (sorry if this message will exist twice)
 
 Hi to all,
 
 I'm trying to test a future production system using qmail + vpopmail +
 codafs.
 
 I know there is a patch for qmail to run on codafs, using Maildirs (function
 link(from,to) isn't allowed on codafs), and I think I've to do the same on
 vpopmail.
 Here is the patch for qmail (qmail-local)
 
 = begin
 *** qmail-local.c.orig Tue Mar 14 10:21:56 2000
 --- qmail-local.c Tue Mar  7 11:49:35 2000
 ***
 *** 127,134 
 --- 127,138 
if (fsync(fd) == -1) goto fail;
if (close(fd) == -1) goto fail; /* NFS dorks */
 
 + #ifdef NFS_HACK
if (link(fntmptph,fnnewtph) == -1) goto fail;
  /* if it was error_exist, almost certainly successful; i hate NFS */
 + #else
 +  if (rename(fntmptph,fnnewtph) == -1) goto fail;
 + #endif
tryunlinktmp(); _exit(0);
fail: tryunlinktmp(); _exit(1);
 
 = end
 
 This patch allow another (even not so sure) method of switching files
 between dirs. I saw that vpopmail code is using the same technique as qmail,
 and infact, after patching qmail, I have that problem only to virtual
 accounts (#4.3.4).
 
 Do you think sufficient changing all link(from,to) into rename(from,to)
 functions in all .c of vpopmail?
 Is there an official patch to vpopmail to work on codafs?
 
 Thank you
 
 ---
 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



R: CODA and VPOPMAIL and link/rename

2001-03-08 Thread Andrea Cerrito

 -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