Re: [PATCH] driver core: remove unneeded klist methods

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

 



On Fri, 2006-01-20 at 23:37 -0500, Alan Stern wrote:
> The problem is that put_device must not be called while holding a
> spinlock.  This has always been true, but we only started noticing it
> recently when Greg added a might_sleep.  Your klist method would call
> put_device while holding the klist's spinlock.

Right, but we currently have this problem everywhere throughout the
code.  Avoiding it by not taking references doesn't look to be the right
way to go because then we have to dismantle the whole refcounting
infrastructure.

> Not so.  A device structure can't be freed before device_del returns, and
> the patch makes device_del call klist_remove instead of klist_del.  The
> difference between the two is that klist_remove blocks until all iterators
> have finished using the klist node.  New iterators can't start using it
> because the routine removes the node from the klist.

Sorry ... forgot to mention that part ... the change from _del to
_remove ties us up with a wait for the list to actually remove.  This is
potentially dangerous because you're waiting on events you don't
control.  Additionally, next_child isn't refcounted, so it could
potentially disappear out from under you.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux