Commit e660d7ca authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Kill ERO for i_blocks check in truncate



Replace with logging the error in the superblock.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 3a72e369
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -517,12 +517,23 @@ int bchfs_truncate(struct mnt_idmap *idmap,
		goto err;
	}

	bch2_fs_inconsistent_on(!inode->v.i_size && inode->v.i_blocks &&
				!bch2_journal_error(&c->journal), c,
	if (unlikely(!inode->v.i_size && inode->v.i_blocks &&
		     !bch2_journal_error(&c->journal))) {
		struct printbuf buf = PRINTBUF;
		bch2_log_msg_start(c, &buf);
		prt_printf(&buf,
			   "inode %lu truncated to 0 but i_blocks %llu (ondisk %lli)",
			   inode->v.i_ino, (u64) inode->v.i_blocks,
			   inode->ei_inode.bi_sectors);

		bool repeat = false, print = false, suppress = false;
		bch2_count_fsck_err(c, vfs_inode_i_blocks_not_zero_at_truncate, buf.buf,
				    &repeat, &print, &suppress);
		if (print)
			bch2_print_str(c, buf.buf);
		printbuf_exit(&buf);
	}

	ret = bch2_setattr_nonsize(idmap, inode, iattr);
err:
	bch2_pagecache_block_put(inode);
+2 −1
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ enum bch_fsck_flags {
	x(inode_journal_seq_in_future,				299,	FSCK_AUTOFIX)	\
	x(inode_i_sectors_underflow,				312,	FSCK_AUTOFIX)	\
	x(vfs_inode_i_blocks_underflow,				311,	FSCK_AUTOFIX)	\
	x(vfs_inode_i_blocks_not_zero_at_truncate,		313,	FSCK_AUTOFIX)	\
	x(deleted_inode_but_clean,				211,	FSCK_AUTOFIX)	\
	x(deleted_inode_missing,				212,	FSCK_AUTOFIX)	\
	x(deleted_inode_is_dir,					213,	FSCK_AUTOFIX)	\
@@ -321,7 +322,7 @@ enum bch_fsck_flags {
	x(dirent_stray_data_after_cf_name,			305,	0)		\
	x(rebalance_work_incorrectly_set,			309,	FSCK_AUTOFIX)	\
	x(rebalance_work_incorrectly_unset,			310,	FSCK_AUTOFIX)	\
	x(MAX,							313,	0)
	x(MAX,							314,	0)

enum bch_sb_error_id {
#define x(t, n, ...) BCH_FSCK_ERR_##t = n,