bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] libdiskfs: fix reference counting of peropen objects


From: Justus Winter
Subject: Re: [PATCH] libdiskfs: fix reference counting of peropen objects
Date: Fri, 29 Aug 2014 12:50:28 +0200
User-agent: alot/0.3.5

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).

Cheers,
Justus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]