Commit 8dd3804b authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 72b52590
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;