public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* device_del() and references
@ 2006-11-14  7:40 Pierre Ossman
  2006-11-14 11:24 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Ossman @ 2006-11-14  7:40 UTC (permalink / raw)
  To: Russell King, LKML

Hi Russell,

I'm trying to wrap my head around the dependencies in the MMC layer and
there are some gaps I am suspicious about. Since you've been looking at
this a lot longer than I have, I thought you could have some valuable
insight.

When a card driver has obtained a reference to a card, what makes sure
we do not destroy that card from under its feet? The reference count on
the device structure in the card only makes sure the structure itself is
in memory, not that the data is valid. E.g. the host might be removed
leaving the host pointer invalid.

I suspect that device_del() doesn't return until remove() has been
called and that our requirement is that the card driver must have
released all references to the card before its remove routine exits.

If so, then there is the risk of a race in mmc_block. What guarantees
that the request handler isn't running in parallel with the remove
function? Again, I suspect that del_gendisk() might grab the queue lock,
but as there might be stuff left in the queue, this seems insufficient.

Perhaps there is a is_gendisk_valid() we can stick at the top of the
request handler?

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-14 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-14  7:40 device_del() and references Pierre Ossman
2006-11-14 11:24 ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox