mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 09:40:27 +02:00
bcachefs: fix can_write_extent()
Failing to check the return value of bch2_dev_rcu(): we could (technically) race with device removal. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
c7378d0e5e
commit
648c1142c9
1 changed files with 3 additions and 1 deletions
|
|
@ -744,7 +744,9 @@ static int can_write_extent(struct bch_fs *c, struct data_update *m)
|
|||
rcu_read_lock();
|
||||
unsigned nr_replicas = 0, i;
|
||||
for_each_set_bit(i, devs.d, BCH_SB_MEMBERS_MAX) {
|
||||
struct bch_dev *ca = bch2_dev_rcu(c, i);
|
||||
struct bch_dev *ca = bch2_dev_rcu_noerror(c, i);
|
||||
if (!ca)
|
||||
continue;
|
||||
|
||||
struct bch_dev_usage usage;
|
||||
bch2_dev_usage_read_fast(ca, &usage);
|
||||
|
|
|
|||
Loading…
Reference in a new issue