Re: How Not To Use kref (was Re: kdbus: add code for buses, domains and endpoints)

2014-11-04 Thread David Herrmann
Hi Al On Fri, Oct 31, 2014 at 12:38 AM, Al Viro wrote: > On Wed, Oct 29, 2014 at 03:00:52PM -0700, Greg Kroah-Hartman wrote: > >> +static void __kdbus_domain_user_free(struct kref *kref) >> +{ >> + struct kdbus_domain_user *user = >> + container_of(kref, struct kdbus_domain_user,

Re: How Not To Use kref (was Re: kdbus: add code for buses, domains and endpoints)

2014-10-31 Thread Al Viro
On Fri, Oct 31, 2014 at 11:00:01AM -0700, Linus Torvalds wrote: > On Thu, Oct 30, 2014 at 4:38 PM, Al Viro wrote: > > > > If you remove an object from some search structures, taking the lock in > > destructor is Too Fucking Late(tm). Somebody might have already found > > that puppy and decided to

Re: How Not To Use kref (was Re: kdbus: add code for buses, domains and endpoints)

2014-10-31 Thread Linus Torvalds
On Thu, Oct 30, 2014 at 4:38 PM, Al Viro wrote: > > If you remove an object from some search structures, taking the lock in > destructor is Too Fucking Late(tm). Somebody might have already found > that puppy and decided to pick it (all under that lock) just as we'd > got to that point in destruc

How Not To Use kref (was Re: kdbus: add code for buses, domains and endpoints)

2014-10-30 Thread Al Viro
On Wed, Oct 29, 2014 at 03:00:52PM -0700, Greg Kroah-Hartman wrote: > +static void __kdbus_domain_user_free(struct kref *kref) > +{ > + struct kdbus_domain_user *user = > + container_of(kref, struct kdbus_domain_user, kref); > + > + BUG_ON(atomic_read(&user->buses) > 0); > +