diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-06-17 17:30:38 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:41 -0400 |
commit | b9c3d13978120344d8b999d1c8bc4e3096d5a18f (patch) | |
tree | 9fe1122140e2d6d9c7396fa008f0b6179d68ed35 /fs/bcachefs/buckets.c | |
parent | 47a5649a0a934b3186f34d90ddfe31bb4bcf4fac (diff) | |
download | lwn-b9c3d13978120344d8b999d1c8bc4e3096d5a18f.tar.gz lwn-b9c3d13978120344d8b999d1c8bc4e3096d5a18f.zip |
bcachefs: Fix a deadlock in the RO path
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 2c9ba18357fd..1ae9403847ca 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -2003,6 +2003,7 @@ int bch2_dev_buckets_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets) bch2_copygc_stop(ca); if (resize) { + down_write(&c->gc_lock); down_write(&ca->bucket_lock); percpu_down_write(&c->mark_lock); } @@ -2025,8 +2026,10 @@ int bch2_dev_buckets_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets) swap(ca->buckets_nouse, buckets_nouse); - if (resize) + if (resize) { percpu_up_write(&c->mark_lock); + up_write(&c->gc_lock); + } spin_lock(&c->freelist_lock); for (i = 0; i < RESERVE_NR; i++) { |