* [PATCH 26/52] mmc_block: add dev_t initialization check [not found] ` <1263508051-7868-25-git-send-email-gregkh@suse.de> @ 2010-01-14 22:27 ` Greg Kroah-Hartman 2010-01-14 22:27 ` [PATCH 27/52] mmc_block: fix probe error cleanup bug Greg Kroah-Hartman 0 siblings, 1 reply; 3+ messages in thread From: Greg Kroah-Hartman @ 2010-01-14 22:27 UTC (permalink / raw) To: linux-kernel, stable, stable-review Cc: torvalds, akpm, Anna Lemehova, Adrian Hunter, linux-mmc, Greg Kroah-Hartman From: Anna Lemehova <EXT-Anna.Lemehova@nokia.com> commit 7d92df692994472cab6045bbd9d0e2c4afa4365f upstream. When a card is removed before mmc_blk_probe() has called add_disk(), then the minor field is uninitialized and has value 0. This caused mmc_blk_put() to always release devidx 0 even if 0 was still in use. Then the next mmc_blk_probe() used the first free idx of 0, which oopses in sysfs, since it is used by another card. Signed-off-by: Anna Lemehova <EXT-Anna.Lemehova@nokia.com> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- drivers/mmc/card/block.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 85f0e8c..5988573 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -85,7 +85,12 @@ static void mmc_blk_put(struct mmc_blk_data *md) mutex_lock(&open_lock); md->usage--; if (md->usage == 0) { + int devmaj = MAJOR(disk_devt(md->disk)); int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; + + if (!devmaj) + devidx = md->disk->first_minor >> MMC_SHIFT; + __clear_bit(devidx, dev_use); put_disk(md->disk); -- 1.6.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 27/52] mmc_block: fix probe error cleanup bug 2010-01-14 22:27 ` [PATCH 26/52] mmc_block: add dev_t initialization check Greg Kroah-Hartman @ 2010-01-14 22:27 ` Greg Kroah-Hartman 2010-01-14 22:27 ` [PATCH 28/52] mmc_block: fix queue cleanup Greg Kroah-Hartman 0 siblings, 1 reply; 3+ messages in thread From: Greg Kroah-Hartman @ 2010-01-14 22:27 UTC (permalink / raw) To: linux-kernel, stable, stable-review Cc: torvalds, akpm, Jarkko Lavinen, Adrian Hunter, linux-mmc, Greg Kroah-Hartman From: Jarkko Lavinen <jarkko.lavinen@nokia.com> commit 0a74ff29b8dd8b748f8856352f9a9b5c6cc362cc upstream. If mmc_blk_set_blksize() fails mmc_blk_probe() the request queue and its thread have been set up and they need to be shut down properly before putting the disk. Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- drivers/mmc/card/block.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 5988573..ee87911 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -618,6 +618,7 @@ static int mmc_blk_probe(struct mmc_card *card) return 0; out: + mmc_cleanup_queue(&md->queue); mmc_blk_put(md); return err; -- 1.6.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 28/52] mmc_block: fix queue cleanup 2010-01-14 22:27 ` [PATCH 27/52] mmc_block: fix probe error cleanup bug Greg Kroah-Hartman @ 2010-01-14 22:27 ` Greg Kroah-Hartman 0 siblings, 0 replies; 3+ messages in thread From: Greg Kroah-Hartman @ 2010-01-14 22:27 UTC (permalink / raw) To: linux-kernel, stable, stable-review Cc: torvalds, akpm, Adrian Hunter, linux-mmc, Greg Kroah-Hartman From: Adrian Hunter <adrian.hunter@nokia.com> commit 5fa83ce284a4b7cd9dcfadd01500b0ed4ab9b740 upstream. The main bug was that 'blk_cleanup_queue()' was called while the block device could still be in use, for example, because the card was removed while files were still open. In addition, to be sure that 'mmc_request()' will get called for all new requests (so it can error them out), the queue is emptied during cleanup. This is done after the worker thread is stopped to avoid racing with it. Finally, it is not a device error for this to be happening, so quiet the (sometimes very many) error messages. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- drivers/mmc/card/block.c | 2 ++ drivers/mmc/card/queue.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index ee87911..1f552c6 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -91,6 +91,8 @@ static void mmc_blk_put(struct mmc_blk_data *md) if (!devmaj) devidx = md->disk->first_minor >> MMC_SHIFT; + blk_cleanup_queue(md->queue.queue); + __clear_bit(devidx, dev_use); put_disk(md->disk); diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 49e5823..c5a7a85 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -90,9 +90,10 @@ static void mmc_request(struct request_queue *q) struct request *req; if (!mq) { - printk(KERN_ERR "MMC: killing requests for dead queue\n"); - while ((req = blk_fetch_request(q)) != NULL) + while ((req = blk_fetch_request(q)) != NULL) { + req->cmd_flags |= REQ_QUIET; __blk_end_request_all(req, -EIO); + } return; } @@ -223,17 +224,18 @@ void mmc_cleanup_queue(struct mmc_queue *mq) struct request_queue *q = mq->queue; unsigned long flags; - /* Mark that we should start throwing out stragglers */ - spin_lock_irqsave(q->queue_lock, flags); - q->queuedata = NULL; - spin_unlock_irqrestore(q->queue_lock, flags); - /* Make sure the queue isn't suspended, as that will deadlock */ mmc_queue_resume(mq); /* Then terminate our worker thread */ kthread_stop(mq->thread); + /* Empty the queue */ + spin_lock_irqsave(q->queue_lock, flags); + q->queuedata = NULL; + blk_start_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + if (mq->bounce_sg) kfree(mq->bounce_sg); mq->bounce_sg = NULL; @@ -245,8 +247,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq) kfree(mq->bounce_buf); mq->bounce_buf = NULL; - blk_cleanup_queue(mq->queue); - mq->card = NULL; } EXPORT_SYMBOL(mmc_cleanup_queue); -- 1.6.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-14 22:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20100114222551.GA7839@suse.de>
[not found] ` <1263508051-7868-1-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-2-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-3-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-4-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-5-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-6-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-7-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-8-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-9-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-10-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-11-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-12-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-13-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-14-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-15-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-16-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-17-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-18-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-19-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-20-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-21-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-22-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-23-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-24-git-send-email-gregkh@suse.de>
[not found] ` <1263508051-7868-25-git-send-email-gregkh@suse.de>
2010-01-14 22:27 ` [PATCH 26/52] mmc_block: add dev_t initialization check Greg Kroah-Hartman
2010-01-14 22:27 ` [PATCH 27/52] mmc_block: fix probe error cleanup bug Greg Kroah-Hartman
2010-01-14 22:27 ` [PATCH 28/52] mmc_block: fix queue cleanup Greg Kroah-Hartman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox