@@ -35,6 +35,8 @@ static const char * const bch2_btree_update_modes[] = {
35
35
NULL
36
36
};
37
37
38
+ static void bch2_btree_update_to_text (struct printbuf * , struct btree_update * );
39
+
38
40
static int bch2_btree_insert_node (struct btree_update * , struct btree_trans * ,
39
41
btree_path_idx_t , struct btree * , struct keylist * );
40
42
static void bch2_btree_update_add_new_node (struct btree_update * , struct btree * );
@@ -1777,11 +1779,24 @@ static int bch2_btree_insert_node(struct btree_update *as, struct btree_trans *t
1777
1779
int ret ;
1778
1780
1779
1781
lockdep_assert_held (& c -> gc_lock );
1780
- BUG_ON (!btree_node_intent_locked (path , b -> c .level ));
1781
1782
BUG_ON (!b -> c .level );
1782
1783
BUG_ON (!as || as -> b );
1783
1784
bch2_verify_keylist_sorted (keys );
1784
1785
1786
+ if (!btree_node_intent_locked (path , b -> c .level )) {
1787
+ struct printbuf buf = PRINTBUF ;
1788
+ bch2_log_msg_start (c , & buf );
1789
+ prt_printf (& buf , "%s(): node not locked at level %u\n" ,
1790
+ __func__ , b -> c .level );
1791
+ bch2_btree_update_to_text (& buf , as );
1792
+ bch2_btree_path_to_text (& buf , trans , path_idx );
1793
+
1794
+ bch2_print_string_as_lines (KERN_ERR , buf .buf );
1795
+ printbuf_exit (& buf );
1796
+ bch2_fs_emergency_read_only (c );
1797
+ return - EIO ;
1798
+ }
1799
+
1785
1800
ret = bch2_btree_node_lock_write (trans , path , & b -> c );
1786
1801
if (ret )
1787
1802
return ret ;
0 commit comments