[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] libdiskfs: fix reference counting of peropen objects
From: |
Neal H. Walfield |
Subject: |
Re: [PATCH] libdiskfs: fix reference counting of peropen objects |
Date: |
Fri, 29 Aug 2014 12:58:18 +0200 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
At Fri, 29 Aug 2014 12:50:28 +0200,
Justus Winter wrote:
>
> Quoting Neal H. Walfield (2014-08-29 11:55:07)
> > At Fri, 29 Aug 2014 11:33:44 +0200,
> > Justus Winter wrote:
> > > Previously, peropen objects were created with a reference count of
> > > zero. Therefore, if diskfs_create_protid fails, passing such an
> > > object to diskfs_release_peropen would lead to a reference count
> > > underflow.
> > >
> > > * libdiskfs/peropen-make.c (diskfs_peropen_make): Initialize reference
> > > count to one.
> > > * libdiskfs/protid-make.c (diskfs_start_protid): And consume this
> > > reference on success. Update comment.
> >
> > Are references really consumed? (I think 'released' is the right
> > word.)
>
> Yes, they are. If diskfs_create_protid succeeds, the reference is in
> the belly of the newly created protid object.
>
> Also, this terminology is used elsewhere in the Hurd. Functions that
> contain the term 'release' in their name decrement a reference count
> (e.g. diskfs_release_peropen). On the other hand, 'consume' indicates
> that a reference is absorbed, e.g. in exec/exec.c (use1),
> pfinet/socket.c (make_sock_user), and trans/fakeroot.c (new_node).
Ok. I wasn't clear on the semantics. I find "assume ownership of the
reference" clearer than "consume the reference", but if the Hurd is
already using this terminology, then I won't further dispute it.
Neal