Use of nfswriter?

Julien ÉLIE julien at trigofacile.com
Sat May 2 17:24:56 UTC 2015


Hi all,

Are there people here using NFS storage for their CNFS spool?
and does it work fine?

I ask because I am a bit puzzled by an issue cppcheck shows
in storage/cnfs/cnfs.c.
We have at the end of the cnfs_mapcntl() function "send = send",
which should be in fact "send = end".  As the code currently is,
and also always was, it couldn't work because "send" is always
NULL (it is never affected to a value).

This function is only called when nfswriter is true in inn.conf.


cnfs_mapcntl(void *p, size_t length, int flags)
{
    char *start, *end;

    start = (char *)((size_t)p & ~(size_t)(pagesize - 1));
    end = (char *)((size_t)((char *)p + length + pagesize) &
           ~(size_t)(pagesize - 1));
    if (flags == MS_INVALIDATE) {
        msync(start, end - start, flags);
    } else {
        static char *sstart, *send;

        /* Don't thrash the system with msync()s - keep the last value
         * and check each time, only if the pages which we should
         * flush change actually flush the previous ones. Calling
         * cnfs_mapcntl(NULL, 0, MS_ASYNC) then flushes the final
         * piece */
        if (start != sstart || end != send) {
            if (sstart != NULL && send != NULL) {
                msync(sstart, send - sstart, flags);
            }
            sstart = start;
            send = send;
            ^^^^^^^^^^^^
        }
    }
}

-- 
Julien ÉLIE

« Les horizontales se rencontrent dans tous les milieux, les
  parallèles jamais. » (Alphonse Allais)


More information about the inn-workers mailing list