@@ -7558,6 +7558,19 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
7558
7558
*/
7559
7559
fs_info -> fs_devices -> total_rw_bytes = 0 ;
7560
7560
7561
+ /*
7562
+ * Lockdep complains about possible circular locking dependency between
7563
+ * a disk's open_mutex (struct gendisk.open_mutex), the rw semaphores
7564
+ * used for freeze procection of a fs (struct super_block.s_writers),
7565
+ * which we take when starting a transaction, and extent buffers of the
7566
+ * chunk tree if we call read_one_dev() while holding a lock on an
7567
+ * extent buffer of the chunk tree. Since we are mounting the filesystem
7568
+ * and at this point there can't be any concurrent task modifying the
7569
+ * chunk tree, to keep it simple, just skip locking on the chunk tree.
7570
+ */
7571
+ ASSERT (!test_bit (BTRFS_FS_OPEN , & fs_info -> flags ));
7572
+ path -> skip_locking = 1 ;
7573
+
7561
7574
/*
7562
7575
* Read all device items, and then all the chunk items. All
7563
7576
* device items are found before any chunk item (their object id
@@ -7583,10 +7596,6 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
7583
7596
goto error ;
7584
7597
break ;
7585
7598
}
7586
- /*
7587
- * The nodes on level 1 are not locked but we don't need to do
7588
- * that during mount time as nothing else can access the tree
7589
- */
7590
7599
node = path -> nodes [1 ];
7591
7600
if (node ) {
7592
7601
if (last_ra_node != node -> start ) {
@@ -7614,7 +7623,6 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
7614
7623
* requirement for chunk allocation, see the comment on
7615
7624
* top of btrfs_chunk_alloc() for details.
7616
7625
*/
7617
- ASSERT (!test_bit (BTRFS_FS_OPEN , & fs_info -> flags ));
7618
7626
chunk = btrfs_item_ptr (leaf , slot , struct btrfs_chunk );
7619
7627
ret = read_one_chunk (& found_key , leaf , chunk );
7620
7628
if (ret )
0 commit comments