cmd_migrate: Prevent spurious "Superblock modified by another process" errors

This is only a workaround for the superblock writing process always reading back the
first sb in the layout and checking its sequence number.
Zeroing it out ensures a harmless warning instead of an error.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Nikita Ofitserov 2025-09-07 00:24:20 +03:00 committed by Kent Overstreet
parent b1021e7b39
commit a1e870abb7

View File

@ -452,7 +452,8 @@ int cmd_migrate_superblock(int argc, char *argv[])
/* Rewrite first 0-3.5k bytes with zeroes, ensuring we blow away
* the old superblock */
static const char zeroes[BCH_SB_SECTOR << 9];
// TODO: fix the "Superblock write was silently dropped" warning properly
static const char zeroes[(BCH_SB_SECTOR << 9) + sizeof(struct bch_sb)];
xpwrite(fd, zeroes, ARRAY_SIZE(zeroes), 0, "zeroing start of disk");
xclose(fd);