Skip to content

Commit 69868be

Browse files
author
Mike Snitzer
committed
dm ioctl: assert _hash_lock is held in __hash_remove
Also update dm_early_create() to take _hash_lock when calling both __get_name_cell and __hash_remove -- given dm_early_create()'s early boot usecase this locking isn't about correctness but it allows lockdep_assert_held() to be added to __hash_remove. Signed-off-by: Mike Snitzer <[email protected]>
1 parent 76227f6 commit 69868be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/md/dm-ioctl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ static struct dm_table *__hash_remove(struct hash_cell *hc)
310310
struct dm_table *table;
311311
int srcu_idx;
312312

313+
lockdep_assert_held(&_hash_lock);
314+
313315
/* remove from the dev trees */
314316
__unlink_name(hc);
315317
__unlink_uuid(hc);
@@ -2263,7 +2265,9 @@ int __init dm_early_create(struct dm_ioctl *dmi,
22632265
err_destroy_table:
22642266
dm_table_destroy(t);
22652267
err_hash_remove:
2268+
down_write(&_hash_lock);
22662269
(void) __hash_remove(__get_name_cell(dmi->name));
2270+
up_write(&_hash_lock);
22672271
/* release reference from __get_name_cell */
22682272
dm_put(md);
22692273
err_destroy_dm:

0 commit comments

Comments
 (0)