bcachefs: Add missing READ_ONCE() for metadata replicas
If we race with the user changing the metadata_replicas setting, this could cause us to get an incorrectly sized disk reservation. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -1221,7 +1221,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
|
||||
|
||||
ret = bch2_disk_reservation_get(c, &as->disk_res,
|
||||
(nr_nodes[0] + nr_nodes[1]) * btree_sectors(c),
|
||||
c->opts.metadata_replicas,
|
||||
READ_ONCE(c->opts.metadata_replicas),
|
||||
disk_res_flags);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
Reference in New Issue
Block a user