Message ID | 20210823073359.705281-3-hch@lst.de |
---|---|
State | Accepted |
Headers | show |
Series | [1/8] mtd_blkdevs: don't hold del_mtd_blktrans_dev in blktrans_{open, release} | expand |
On Mon, 2021-08-23 at 07:33:53 UTC, Christoph Hellwig wrote: > Use lockdep_assert_held to ensure mtd_table_mutex is held instead of > mutex_trylock games. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks. Miquel
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 6b81a1c9ccbe..81f0ce2a0b5a 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -310,10 +310,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) struct gendisk *gd; int ret; - if (mutex_trylock(&mtd_table_mutex)) { - mutex_unlock(&mtd_table_mutex); - BUG(); - } + lockdep_assert_held(&mtd_table_mutex); mutex_lock(&blktrans_ref_mutex); list_for_each_entry(d, &tr->devs, list) { @@ -444,10 +441,7 @@ int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) { unsigned long flags; - if (mutex_trylock(&mtd_table_mutex)) { - mutex_unlock(&mtd_table_mutex); - BUG(); - } + lockdep_assert_held(&mtd_table_mutex); if (old->disk_attributes) sysfs_remove_group(&disk_to_dev(old->disk)->kobj,
Use lockdep_assert_held to ensure mtd_table_mutex is held instead of mutex_trylock games. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/mtd/mtd_blkdevs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)