Skip to contentSkip to conversation

MTD: blktrans: do blk_cleanup_queue when it is really safe to do so

PATCH New Maxim Levitsky 1 participant 1 message Feb 27, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: blktrans: do blk_cleanup_queue when it is really safe to do so

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

---
 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...)

drivers/mtd/mtd_blkdevs.c +1 -1
index e32c49c..03e19c1 100644
@@ -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);
Signature · 1 line
1.6.3.3