Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 2019 20:10:08 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Benjamin Kaduk <bjkfbsd@gmail.com>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r348421 - head/sys/kern
Message-ID:  <20190531171008.GE27392@kib.kiev.ua>
In-Reply-To: <CAJ5_RoCCQ=P6jvhafuuRrRRH_DL2SrM_f=p=JRYctQsQzSgx=g@mail.gmail.com>
References:  <201905301504.x4UF49UT019928@repo.freebsd.org> <CAJ5_RoCCQ=P6jvhafuuRrRRH_DL2SrM_f=p=JRYctQsQzSgx=g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 30, 2019 at 08:14:42PM -0700, Benjamin Kaduk wrote:
> On Thu, May 30, 2019 at 8:04 AM Konstantin Belousov <kib@freebsd.org> wrote:
> 
> > Author: kib
> > Date: Thu May 30 15:04:09 2019
> > New Revision: 348421
> > URL: https://svnweb.freebsd.org/changeset/base/348421
> >
> > Log:
> >   Silence witness warning about duplicated mutex type.
> >
> >   The order is correct, it is nullfs vnode interlock -> lower vnode
> >   interlock.  vop_stdadd_writecount() is called from nullfs
> >   VOP_ADD_WRITECOUNT() and both take interlocks.
> >
> >   Requested by: markj
> >   Sponsored by: The FreeBSD Foundation
> >   MFC after:    2 weeks
> >
> > Modified:
> >   head/sys/kern/vfs_default.c
> >
> > Modified: head/sys/kern/vfs_default.c
> >
> > ==============================================================================
> > --- head/sys/kern/vfs_default.c Thu May 30 14:40:23 2019        (r348420)
> > +++ head/sys/kern/vfs_default.c Thu May 30 15:04:09 2019        (r348421)
> > @@ -1113,7 +1113,7 @@ vop_stdadd_writecount(struct vop_add_writecount_args
> > *
> >         int error;
> >
> >         vp = ap->a_vp;
> > -       VI_LOCK(vp);
> > +       VI_LOCK_FLAGS(vp, MTX_DUPOK);
> >         if (vp->v_writecount < 0) {
> >                 error = ETXTBSY;
> >         } else {
> >
> >
> Does this merit a comment justifying the use of DUPOK?

This is a common pattern in nullfs, because if upper layer operations is
done which requires vnode interlock, it is very common to have the op
done on lower layer as well, when you need to take the lower layer vnode
interlock.  I think it is obvious enough what happens when the flag is
used.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190531171008.GE27392>