[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210613113035.2329421-3-chengzhihao1@huawei.com>
Date: Sun, 13 Jun 2021 19:30:31 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: <miquel.raynal@...tlin.com>, <richard@....at>, <vigneshr@...com>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<chengzhihao1@...wei.com>, <yukuai3@...wei.com>
Subject: [PATCH 2/6] Revert "mtd: fix: avoid race condition when accessing mtd->usecount"
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
Powered by blists - more mailing lists