From: Kent Overstreet Date: Tue, 24 Sep 2019 17:33:11 +0000 (-0400) Subject: bcachefs: Convert a BUG_ON() to a warning X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fb472ac52811e8a50e035807b94e1c29ec1f3395;p=linux.git bcachefs: Convert a BUG_ON() to a warning We shouldn't ever be writing past i_size - but, apparently there's still a bug to track down. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 2d7bab51b320d..e3f1d1dd06aed 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -757,6 +757,9 @@ static void bch2_set_page_dirty(struct bch_fs *c, struct bch_page_state *s = bch2_page_state(page); unsigned i, dirty_sectors = 0; + WARN_ON(page_offset(page) + offset + len > + round_up(i_size_read(&inode->v), block_bytes(c))); + for (i = round_down(offset, block_bytes(c)) >> 9; i < round_up(offset + len, block_bytes(c)) >> 9; i++) { @@ -1442,8 +1445,8 @@ do_io: sectors << 9, offset << 9)); /* Check for writing past i_size: */ - BUG_ON((bio_end_sector(&w->io->op.op.wbio.bio) << 9) > - round_up(i_size, block_bytes(c))); + WARN_ON((bio_end_sector(&w->io->op.op.wbio.bio) << 9) > + round_up(i_size, block_bytes(c))); w->io->op.op.res.sectors += reserved_sectors; w->io->op.new_i_size = i_size;