bcachefs: Limit bios in writepages path to 256M
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 20 Oct 2019 04:22:03 +0000 (00:22 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:30 +0000 (17:08 -0400)
This works around a bug where bio_full() doesn't check for
bio->bi_iter.bi_size overflowing - and, we don't really want to build
bios that are that big anyways.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io.c

index 9914f6ee2aa25ea5df4f933d284b92ea7ef2b07b..a3fb603837250ea4fa5025a132e73c20402f4d6c 100644 (file)
@@ -1151,6 +1151,7 @@ do_io:
                if (w->io &&
                    (w->io->op.res.nr_replicas != nr_replicas_this_write ||
                     bio_full(&w->io->op.wbio.bio, PAGE_SIZE) ||
+                    w->io->op.wbio.bio.bi_iter.bi_size >= (256U << 20) ||
                     bio_end_sector(&w->io->op.wbio.bio) != sector))
                        bch2_writepage_do_io(w);