public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: Alex Dubov <oakad@yahoo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 2/3] MEMSTICK: fix hangs on unexpected device removal in mspro_blk
Date: Thu,  5 Aug 2010 18:23:28 +0300	[thread overview]
Message-ID: <1281021809-20924-3-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1281021809-20924-1-git-send-email-maximlevitsky@gmail.com>

mspro_block_remove is called from detect thread that first calls
the mspro_block_stop, which stops the request queue.
If we call del_gendisk with queue stopped we get a deadlock.


Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
 drivers/memstick/core/mspro_block.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 369313f..300ec15 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -1331,13 +1331,14 @@ static void mspro_block_remove(struct memstick_dev *card)
 	struct mspro_block_data *msb = memstick_get_drvdata(card);
 	unsigned long flags;
 
-	del_gendisk(msb->disk);
-	dev_dbg(&card->dev, "mspro block remove\n");
 	spin_lock_irqsave(&msb->q_lock, flags);
 	msb->eject = 1;
 	blk_start_queue(msb->queue);
 	spin_unlock_irqrestore(&msb->q_lock, flags);
 
+	del_gendisk(msb->disk);
+	dev_dbg(&card->dev, "mspro block remove\n");
+
 	blk_cleanup_queue(msb->queue);
 	msb->queue = NULL;
 
-- 
1.7.0.4


  parent reply	other threads:[~2010-08-05 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 15:23 [PATCH 0/2 V3] Driver for Ricoh cardreader + few fixes Maxim Levitsky
2010-08-05 15:23 ` [PATCH 1/3] memstick: init sysfs attributes Maxim Levitsky
2010-08-05 15:23 ` Maxim Levitsky [this message]
2010-08-05 15:23 ` [PATCH 3/3] MEMSTICK: Add driver for Ricoh R5C592 Card reader Maxim Levitsky
2010-08-05 22:51 ` [PATCH 0/2 V3] Driver for Ricoh cardreader + few fixes Maxim Levitsky
  -- strict thread matches above, loose matches on Subject: below --
2010-08-05 14:25 [PATCH 0/2 V2 resend] " Maxim Levitsky
2010-08-05 14:25 ` [PATCH 2/3] MEMSTICK: fix hangs on unexpected device removal in mspro_blk Maxim Levitsky

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=1281021809-20924-3-git-send-email-maximlevitsky@gmail.com \
    --to=maximlevitsky@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oakad@yahoo.com \
    /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