[Avcheck] avcheck+drweb over NFS

adi adi@acme.com
Mon, 22 Jul 2002 22:19:41 +0700 (JAVT)


I put drwebd on separate machine, make it listen at port 3000,
and make drwebd 'working' directory mounted on my postfix+avcheck
machine over nfs.

On postfix+avcheck machine, this nfs mounted partition is use
for avcheck operation. avcheck contact drwebd daemon over tcp...
etc... etc...

The above scenarion failed on the first try. On very rare
occasion drweb barfing about 'error reading input'. Then I think
that there are some trouble with drwebd to read temp file that
already written by avcheck on nfs mounted partition.

Looking at the code (avcheck-0.9pre for an example), avcheck
doesn't call fsync() after writing the tempfile. Then I change
the code a little bit like this:

    while((c = read(0, buf, sizeof(buf))) > 0) {
      int l = write(msgfd, buf, c);
      if (l != c)
        err(l < 0 ? errno : 0, "unable to write temp file");
    }
    if (c < 0)
      err(errno, "unable to read input");
    if (fsync(msgfd) < 0) err(0, "unable to fsync temp file");
    /* I use content_inspector, don't bother with resending into postfix */
    if (close(msgfd) < 0) err(0, "unable to close temp file");
    p = strstr(tmpdir, "/./");
    if (p == NULL) {
    .....

I wonder if there are several alternatives to make avcheck+drweb
operation more reliable over NFS (?)

I should say thanks to Sergey Akhapkin for his patient :-)

Regards,

P.Y. Adi Prasaja