btrfs: do not write repaired read sectors back on a read-only mount
btrfs_end_repair_bio() submits btrfs_repair_io_failure() for every bad
mirror once a repair read has produced good data, with no check of the
mount state. On a read-only mount the write trips
ASSERT(!(fs_info->sb->s_flags & SB_RDONLY)) in btrfs_repair_io_failure()
(kernel BUG on assert-enabled builds); without assertions it would issue
a write to a filesystem the user was promised is read-only.
Easily reproduced with a degraded raid56 mounted ro,degraded: every
read of a stray sector on the missing device reconstructs through
parity, then tries to write the reconstruction back.
Serve the read from the repaired data but skip the write-back when the
filesystem is read-only.