On Sun, Aug 27, 2000 at 02:25:55PM -0700, Archie Cobbs wrote:

> Each mbuf may be either a normal mbuf or a cluster mbuf (if the
> mbuf flags contains M_EXT). Cluster mbufs point to an entire page
> of memory, and this page of memory may be shared by more than one
> cluster mbuf (see m_copypacket()).

Clusters are currently 2048 bytes in size - which I don't think it
a page on the alpha or the i386. (Not that this is really important).

> his effectively makes the mbuf
> data read-only, because a change to one mbuf affects all of the
> mbufs, not just the one you're working on. There have been (and
> still are) several FreeBSD bugs because of this subtlety.
> A test for an mbuf being "read-only" is:
>   if ((m->m_flags & M_EXT) != 0 && MEXT_IS_REF(m))  ...

You should also check that it's really a cluster you're looking
    if ((m->m_flags & M_EXT) != 0 &&
        (MEXT_IS_REF(m) || (m)->m_ext.ext_free != NULL)) {
            /* data is read only */

(This is why the flag I was talking about in the other mail
would be useful for spotting other cases where the storage
may be writable, even if it's not a cluster).

Cleaning up this sounds like a good plan. It would be worth
getting Ian and Bosko involved if possible.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to