* Luigi Rizzo <[EMAIL PROTECTED]> [011023 13:50] wrote:
> On Tue, Oct 23, 2001 at 01:28:13PM -0500, Alfred Perlstein wrote:
> ...
> > > In the mbuf code, M_LEADINGSPACE always returns 0 when M_EXT is
> > > set, instead of calling the second part of M_WRITABLE to check
> > > whether there is a chance of writing into the cluster. This means
> ...
> > I've seen this brought up before, this is not what you want to
> > do otherwise you risk corrupting EXT data.  The right thing to
> > do is have the people allocating writable EXT bufs mark them
> > as such.  Other EXT type buffers such as sendfile bufs can not
> > be written to no matter what the sharecount is.
> 
> Actually, the BSD code works the other way around:
> 
>   * standard EXT bufs as returned by MCLGET _are_ writable if
>     m_ext.ext_free == NULL and their refcnt is 1 (they _must_ be,
>     otherwise we would have errors when m_free() decides to
>     dispose of a cluster, which is a form of writing),
> 
> and
> 
>   * people allocating "other EXT type" implicitly mark the buffer
>     as not-writable by setting m_ext.ext_free to the proper routine.
>     This is certainly what the sendfile bufs that you mentioned do.
> 
> M_WRITABLE (used in the patch i proposed) does exactly the checks
> that you do when you m_free() a cluster. If this is wrong, then
> m_free() is broken!
> 
> Am i missing something else ?

Yes, you're right, I was mistaken in my paranioa, however you're
missing the fact that one may want to allocate an EXT buf and still
have it writeable.

I like your patch, it's a good idea, go for it.

-Alfred

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

Reply via email to