[PATCH 2/6] Revert "mtd: fix: avoid race condition when accessing mtd->usecount"
From: Zhihao Cheng
Date: Sun Jun 13 2021 - 07:22:31 EST
This reverts commit 073db4a51ee43ccb827f54a4261c0583b028d5ab.
---
drivers/mtd/mtd_blkdevs.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 16ccce3e7fdb..00b13f71ccf3 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -210,7 +210,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
mutex_lock(&dev->lock);
- mutex_lock(&mtd_table_mutex);
if (dev->open)
goto unlock;
@@ -234,7 +233,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
unlock:
dev->open++;
- mutex_unlock(&mtd_table_mutex);
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
return ret;
@@ -245,7 +243,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
error_put:
module_put(dev->tr->owner);
kref_put(&dev->ref, blktrans_dev_release);
- mutex_unlock(&mtd_table_mutex);
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
return ret;
@@ -259,7 +256,6 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
return;
mutex_lock(&dev->lock);
- mutex_lock(&mtd_table_mutex);
if (--dev->open)
goto unlock;
@@ -273,7 +269,6 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
__put_mtd_device(dev->mtd);
}
unlock:
- mutex_unlock(&mtd_table_mutex);
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
}
--
2.31.1