fix bch2_super_write() for bs > 4096
Some checks are pending
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix-Tests / nix-flake-check (push) Waiting to run

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-02-22 09:29:56 -05:00
parent dd1a882d17
commit 86cbeaf1c2

View File

@ -352,9 +352,9 @@ void bch2_super_write(int fd, struct bch_sb *sb)
if (sb->offset == BCH_SB_SECTOR) {
/* Write backup layout */
BUG_ON(bs > 4096);
unsigned buflen = max(bs, 4096);
char *buf = aligned_alloc(bs, bs);
char *buf = aligned_alloc(buflen, buflen);
xpread(fd, buf, bs, 4096 - bs);
memcpy(buf + bs - sizeof(sb->layout),
&sb->layout,