diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-05-21 03:57:55 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:01 +0300 |
commit | 0d2234a79e877b1bfa71b2c8c712a155be419827 (patch) | |
tree | 3ddf278178dc2b05ce81e20b0ed79dde52b8890d /fs/bcachefs/btree_locking.c | |
parent | 01bf56a9771466147d94a013bc5678d0ed1b1382 (diff) | |
download | linux-0d2234a79e877b1bfa71b2c8c712a155be419827.tar.xz |
six locks: Kill six_lock_pcpu_(alloc|free)
six_lock_pcpu_alloc() is an unsafe interface: it's not safe to allocate
or free the percpu reader count on an existing lock that's in use, the
only safe time to allocate percpu readers is when the lock is first
being initialized.
This patch adds a flags parameter to six_lock_init(), and instead of
six_lock_pcpu_free() we now expose six_lock_exit(), which does the same
thing but is less likely to be misused.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r-- | fs/bcachefs/btree_locking.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index d7b0c4436caf..6e1306add443 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -6,9 +6,10 @@ static struct lock_class_key bch2_btree_node_lock_key; -void bch2_btree_lock_init(struct btree_bkey_cached_common *b) +void bch2_btree_lock_init(struct btree_bkey_cached_common *b, + enum six_lock_init_flags flags) { - __six_lock_init(&b->lock, "b->c.lock", &bch2_btree_node_lock_key); + __six_lock_init(&b->lock, "b->c.lock", &bch2_btree_node_lock_key, flags); lockdep_set_novalidate_class(&b->lock); } |