summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/buckets.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-27 19:51:29 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:15 -0400
commit73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1 (patch)
tree6797ba38ec27801ee907baba25a907b75ec45a2d /fs/bcachefs/buckets.h
parent3c40841cdcf374d661ff14e7a707681342565166 (diff)
downloadlinux-stable-73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1.tar.gz
linux-stable-73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1.tar.bz2
linux-stable-73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1.zip
bcachefs: bucket_lock() is now a sleepable lock
fsck_err() may sleep - it takes a mutex and may allocate memory, so bucket_lock() needs to be a sleepable lock. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r--fs/bcachefs/buckets.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
index ecbeb7280f87..bf8d7f407e9c 100644
--- a/fs/bcachefs/buckets.h
+++ b/fs/bcachefs/buckets.h
@@ -70,12 +70,15 @@ union ulong_byte_assert {
static inline void bucket_unlock(struct bucket *b)
{
BUILD_BUG_ON(!((union ulong_byte_assert) { .ulong = 1UL << BUCKET_LOCK_BITNR }).byte);
- bit_spin_unlock(BUCKET_LOCK_BITNR, (void *) &b->lock);
+
+ clear_bit_unlock(BUCKET_LOCK_BITNR, (void *) &b->lock);
+ wake_up_bit((void *) &b->lock, BUCKET_LOCK_BITNR);
}
static inline void bucket_lock(struct bucket *b)
{
- bit_spin_lock(BUCKET_LOCK_BITNR, (void *) &b->lock);
+ wait_on_bit_lock((void *) &b->lock, BUCKET_LOCK_BITNR,
+ TASK_UNINTERRUPTIBLE);
}
static inline struct bucket_array *gc_bucket_array(struct bch_dev *ca)