This reverts commit e798b09ebf5728988d27015696e151d36a0b0a07.

The issue that this patch is trying to resolve has been fixed by
upstream commit 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")
so this local patch can be reverted, if not, it will cause an unbalanced
refcnt issue when open/close mtd device.

Signed-off-by: Liwei Song <[email protected]>
---
 drivers/mtd/mtd_blkdevs.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index df8f0c039496..5bc32108ca03 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -189,8 +189,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
mode)
 
        kref_get(&dev->ref);
 
-       if (!mutex_trylock(&mtd_table_mutex))
-               return ret;
        mutex_lock(&dev->lock);
 
        if (dev->open)
@@ -215,7 +213,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
mode)
 unlock:
        dev->open++;
        mutex_unlock(&dev->lock);
-       mutex_unlock(&mtd_table_mutex);
        return ret;
 
 error_release:
@@ -224,7 +221,6 @@ static int blktrans_open(struct gendisk *disk, blk_mode_t 
mode)
 error_put:
        module_put(dev->tr->owner);
        mutex_unlock(&dev->lock);
-       mutex_unlock(&mtd_table_mutex);
        blktrans_dev_put(dev);
        return ret;
 }
@@ -233,8 +229,6 @@ static void blktrans_release(struct gendisk *disk)
 {
        struct mtd_blktrans_dev *dev = disk->private_data;
 
-       if (!mutex_trylock(&mtd_table_mutex))
-               return;
        mutex_lock(&dev->lock);
 
        if (--dev->open)
@@ -249,7 +243,6 @@ static void blktrans_release(struct gendisk *disk)
        }
 unlock:
        mutex_unlock(&dev->lock);
-       mutex_unlock(&mtd_table_mutex);
        blktrans_dev_put(dev);
 }
 
-- 
2.44.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16051): 
https://lists.yoctoproject.org/g/linux-yocto/message/16051
Mute This Topic: https://lists.yoctoproject.org/mt/116788246/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to