Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Mar 2025 01:48:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        net@FreeBSD.org
Subject:   [Bug 137145] [mbuf] Reference count computing isn't correct when more than one threads call function m_copypacket
Message-ID:  <bug-137145-7501-S3MmrJaMSf@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-137145-7501@https.bugs.freebsd.org/bugzilla/>
References:  <bug-137145-7501@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=137145

Zhenlei Huang <zlei@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glebius@FreeBSD.org,
                   |                            |zlei@FreeBSD.org

--- Comment #8 from Zhenlei Huang <zlei@FreeBSD.org> ---
Gleb changed some logic of mb_dupcl(), the patch should be rebased. I think we
still risk concurrent mb_dupcl().

```
         /* See if this is the mbuf that holds the embedded refcount. */
         if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) {
                 refcnt = n->m_ext.ext_cnt = &m->m_ext.ext_count;
                 n->m_ext.ext_flags &= ~EXT_FLAG_EMBREF;
         } else {
                 KASSERT(m->m_ext.ext_cnt != NULL,
                     ("%s: no refcounting pointer on %p", __func__, m));
                 refcnt = m->m_ext.ext_cnt;
         }

         if (*refcnt == 1)
                 *refcnt += 1; /* XXX_ZL possible to lose update on concurrent
mb_dupcl() */
         else
                 atomic_add_int(refcnt, 1);
```

also CC @Gleb

-- 
You are receiving this mail because:
You are the assignee for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-137145-7501-S3MmrJaMSf>