From patchwork Sat Feb 27 00:31:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 46413 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4C326B7D06 for ; Sat, 27 Feb 2010 11:33:34 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NlAbI-0000bO-7c; Sat, 27 Feb 2010 00:32:08 +0000 Received: from mail-fx0-f214.google.com ([209.85.220.214]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NlAbA-0000Zd-QK for linux-mtd@lists.infradead.org; Sat, 27 Feb 2010 00:32:05 +0000 Received: by fxm6 with SMTP id 6so695799fxm.2 for ; Fri, 26 Feb 2010 16:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=6P6n7oPYkfz43rMdqIST2aQ9NfZav2G/K8Tb9jTO4AE=; b=rhSbAPc4af8M4zZyEVjhdSRgD0uGozRB5aBgZq2jH7nr47wjT9DjH6wtup0iABxyBP wCARLZtKSARA5y2h7Sm1UU8H8Ngn1Zfd9yQ+Fvj8Tq2H77ETChE+ITinsJN9utYJaoYV I3QNAyl+XIkSx8aAEsOoKQpa1ep9eo9Oz7siM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Eff2Kw7vOOF4n7miKxHeTVzV5ajdVQvfT+N658sKIWWat3BSYxhs8S+anFCNnlfzY4 K9xnLHrc0A2+Kxxp426DVJCFjtRXYv/Y33VTIOxAl5x+l4VCV6yo6+ruYyorXsws/0QR kj16otgNsiOCEcGQjkFuYEbuDPdFoPkyRfcl4= Received: by 10.102.174.3 with SMTP id w3mr921422mue.16.1267230717162; Fri, 26 Feb 2010 16:31:57 -0800 (PST) Received: from localhost.localdomain ([77.124.235.8]) by mx.google.com with ESMTPS id n7sm3687556mue.45.2010.02.26.16.31.56 (version=SSLv3 cipher=RC4-MD5); Fri, 26 Feb 2010 16:31:56 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH] MTD: blktrans: do blk_cleanup_queue when it is really safe to do so Date: Sat, 27 Feb 2010 02:31:51 +0200 Message-Id: <1267230711-13894-1-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.6.3.3 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100226_193201_006882_6202EA2A X-CRM114-Status: GOOD ( 14.41 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: linux-mtd , Maxim Levitsky X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org I was calling it in del_mtd_blktrans_dev, but ->request_fn could still be running at that point, thus defer this call to blktrans_dev_release Signed-off-by: Maxim Levitsky --- drivers/mtd/mtd_blkdevs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) This fixes the problem I described in former patch (no matter how well sotware is tested, there must be bugs...) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index e32c49c..03e19c1 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -32,6 +32,7 @@ void blktrans_dev_release(struct kref *kref) container_of(kref, struct mtd_blktrans_dev, ref); dev->disk->private_data = NULL; + blk_cleanup_queue(dev->rq); put_disk(dev->disk); list_del(&dev->list); kfree(dev); @@ -423,7 +424,6 @@ int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) old->rq->queuedata = NULL; blk_start_queue(old->rq); spin_unlock_irqrestore(&old->queue_lock, flags); - blk_cleanup_queue(old->rq); /* Ask trans driver for release to the mtd device */ mutex_lock(&old->lock);