diff options
Diffstat (limited to 'freebsd/sys/kern/uipc_mbuf2.c')
-rw-r--r-- | freebsd/sys/kern/uipc_mbuf2.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/freebsd/sys/kern/uipc_mbuf2.c b/freebsd/sys/kern/uipc_mbuf2.c index a44ddc27..fef1c514 100644 --- a/freebsd/sys/kern/uipc_mbuf2.c +++ b/freebsd/sys/kern/uipc_mbuf2.c @@ -133,6 +133,8 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) } /* + * The following comment is dated but still partially applies: + * * XXX: This code is flawed because it considers a "writable" mbuf * data region to require all of the following: * (i) mbuf _has_ to have M_EXT set; if it is just a regular @@ -143,17 +145,13 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * Ideally, the requirement should only be (iii). * * If we're writable, we're sure we're writable, because the ref. count - * cannot increase from 1, as that would require posession of mbuf + * cannot increase from 1, as that would require possession of mbuf * n by someone else (which is impossible). However, if we're _not_ * writable, we may eventually become writable )if the ref. count drops * to 1), but we'll fail to notice it unless we re-evaluate * M_WRITABLE(). For now, we only evaluate once at the beginning and * live with this. */ - /* - * XXX: This is dumb. If we're just a regular mbuf with no M_EXT, - * then we're not "writable," according to this code. - */ writable = 0; if ((n->m_flags & M_EXT) == 0 || (n->m_ext.ext_type == EXT_CLUSTER && M_WRITABLE(n))) @@ -173,7 +171,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * chop the current mbuf into two pieces, set off to 0. */ if (len <= n->m_len - off) { - o = m_dup1(n, off, n->m_len - off, M_DONTWAIT); + o = m_dup1(n, off, n->m_len - off, M_NOWAIT); if (o == NULL) { m_freem(m); return NULL; /* ENOBUFS */ @@ -233,9 +231,9 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * on both end. */ if (len > MLEN) - o = m_getcl(M_DONTWAIT, m->m_type, 0); + o = m_getcl(M_NOWAIT, m->m_type, 0); else - o = m_get(M_DONTWAIT, m->m_type); + o = m_get(M_NOWAIT, m->m_type); if (!o) { m_freem(m); return NULL; /* ENOBUFS */ @@ -431,7 +429,7 @@ m_tag_copy(struct m_tag *t, int how) * destination mbuf. */ int -m_tag_copy_chain(struct mbuf *to, struct mbuf *from, int how) +m_tag_copy_chain(struct mbuf *to, const struct mbuf *from, int how) { struct m_tag *p, *t, *tprev = NULL; |