mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Dubov <oakad@yahoo.com>
To: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: linux-kernel@vger.kernel.org
Subject: mmc: correct semantics of the mmc_host_remove
Date: Thu, 18 Jan 2007 17:50:37 -0800 (PST)	[thread overview]
Message-ID: <20070119015037.8318.qmail@web36709.mail.mud.yahoo.com> (raw)
In-Reply-To: <45A53856.7060209@drzeus.cx>

Greetings.

It appears to me that under certain circumstances mmc layer will issue requests to the host after
mmc_host_remove returns. This happens, for example, in tifm_sd driver because mmc_host may be
removed mid-transfer, as the socket shall be freed for possible reuse by different media type.
Currently, the only solution is to sleep a little somewhere after mmc_remove_host but before
mmc_free_host. I think the correct way to handle the situation is to ensure that mmc_host is never
accessed by the mmc layer after mmc_remove_host returns.


I think a easy way to handle this is to modify __mmc_claim_host to fail if the mmc_host is marked
for removal (this implies that its return value should be checked on use, which is not currently
the case everywhere). This way, mmc_host_remove can claim host, mark it as "dead" and then return
safely knowing that nobody will send any more requests to the host. 

Some questions:
1. Will this suffice for the task? 
2. Are there any reasons not to do this?
3. Is it possible to replace the fancy locking loop in the __mmc_claim_host with mutex based
locking (mutex does the same thing, isn't it)?



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

  reply	other threads:[~2007-01-19  1:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 15:04 [PATCH 2.6.19] mmc: Fix handling of response types in imxmmc and tifm drivers Philip Langdale
2007-01-07 17:34 ` Pavel Pisa
2007-01-10 19:02   ` Pierre Ossman
2007-01-19  1:50     ` Alex Dubov [this message]
2007-01-19  8:47       ` mmc: correct semantics of the mmc_host_remove Pierre Ossman
2007-01-20  3:46         ` Alex Dubov
2007-01-20 10:21           ` Pierre Ossman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070119015037.8318.qmail@web36709.mail.mud.yahoo.com \
    --to=oakad@yahoo.com \
    --cc=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome