diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-10-09 17:00:30 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-10-09 17:00:30 -0400 |
commit | a9e1597adcbc33fa50a159b04473914c496807a2 (patch) | |
tree | 8da7eb52dce997a57752bbeb015bd917fb2ec9de /libbcachefs/btree_gc.c | |
parent | f6e4cd2ef7c6ef7c3cf5a730f7ded9c48ccf689d (diff) |
Update bcachefs sources to 3b80552e7057 bcachefs: __wait_for_freeing_inode: Switch to wait_bit_queue_entry656-debug
Diffstat (limited to 'libbcachefs/btree_gc.c')
-rw-r--r-- | libbcachefs/btree_gc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libbcachefs/btree_gc.c b/libbcachefs/btree_gc.c index 771154e3..94bbd850 100644 --- a/libbcachefs/btree_gc.c +++ b/libbcachefs/btree_gc.c @@ -1224,17 +1224,20 @@ int bch2_gc_gens(struct bch_fs *c) u64 b, start_time = local_clock(); int ret; - /* - * Ideally we would be using state_lock and not gc_gens_lock here, but that - * introduces a deadlock in the RO path - we currently take the state - * lock at the start of going RO, thus the gc thread may get stuck: - */ if (!mutex_trylock(&c->gc_gens_lock)) return 0; trace_and_count(c, gc_gens_start, c); - down_read(&c->state_lock); + /* + * We have to use trylock here. Otherwise, we would + * introduce a deadlock in the RO path - we take the + * state lock at the start of going RO. + */ + if (!down_read_trylock(&c->state_lock)) { + mutex_unlock(&c->gc_gens_lock); + return 0; + } for_each_member_device(c, ca) { struct bucket_gens *gens = bucket_gens(ca); |