linux-stable/fs/ext4
Ritesh Harjani 19cfb87724 ext4: fix error handling in ext4_restore_inline_data()
commit 897026aaa7 upstream.

While running "./check -I 200 generic/475" it sometimes gives below
kernel BUG(). Ideally we should not call ext4_write_inline_data() if
ext4_create_inline_data() has failed.

<log snip>
[73131.453234] kernel BUG at fs/ext4/inline.c:223!

<code snip>
 212 static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc,
 213                                    void *buffer, loff_t pos, unsigned int len)
 214 {
<...>
 223         BUG_ON(!EXT4_I(inode)->i_inline_off);
 224         BUG_ON(pos + len > EXT4_I(inode)->i_inline_size);

This patch handles the error and prints out a emergency msg saying potential
data loss for the given inode (since we couldn't restore the original
inline_data due to some previous error).

[ 9571.070313] EXT4-fs (dm-0): error restoring inline_data for inode -- potential data loss! (inode 1703982, error -30)

Reported-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/9f4cd7dfd54fa58ff27270881823d94ddf78dd07.1642416995.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-08 18:16:30 +01:00
..
acl.c
acl.h
balloc.c ext4: fix potential race between online resizing and write operations 2020-03-11 18:02:42 +01:00
bitmap.c
block_validity.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
dir.c ext4: fix potential infinite loop in ext4_dx_readdir() 2021-10-06 15:05:09 +02:00
ext4.h ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
ext4_extents.h ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max 2020-06-20 10:25:15 +02:00
ext4_jbd2.c ext4: shutdown should not prevent get_write_access 2018-04-24 09:36:30 +02:00
ext4_jbd2.h ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
extents.c ext4: fix kernel infoleak via ext4_extent_header 2021-07-20 16:17:28 +02:00
extents_status.c ext4: remove check for zero nr_to_scan in ext4_es_scan() 2021-07-20 16:17:28 +02:00
extents_status.h
file.c ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT 2020-02-28 16:35:55 +01:00
fsmap.c ext4: limit entries returned when counting fsmap records 2020-10-29 09:07:11 +01:00
fsmap.h
fsync.c ext4: fix race between ext4_sync_parent() and rename() 2020-06-20 10:25:15 +02:00
hash.c
ialloc.c ext4: fix avefreec in find_group_orlov 2021-07-20 16:17:29 +02:00
indirect.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
inline.c ext4: fix error handling in ext4_restore_inline_data() 2022-02-08 18:16:30 +01:00
inode.c ext4: fix bh ref count on error paths 2021-04-07 12:47:00 +02:00
ioctl.c ext4: avoid trim error on fs with small groups 2022-01-27 09:00:52 +01:00
Kconfig
Makefile
mballoc.c ext4: avoid trim error on fs with small groups 2022-01-27 09:00:52 +01:00
mballoc.h
migrate.c ext4: don't use the orphan list when migrating an inode 2022-01-27 09:00:59 +01:00
mmp.c ext4: don't assume that mmp_nodename/bdevname have NUL 2020-02-28 16:35:52 +01:00
move_extent.c ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
namei.c ext4: fix potential htree corruption when growing large_dir directories 2021-08-15 13:03:31 +02:00
page-io.c ext4: fix deadlock allocating crypto bounce page from mempool 2020-02-14 16:32:19 -05:00
readpage.c
resize.c ext4: fix error handling code in add_new_gdb 2020-11-05 11:07:04 +01:00
super.c ext4: Fix BUG_ON in ext4_bread when write quota data 2022-01-27 09:00:59 +01:00
symlink.c
sysfs.c ext4: sysfs: print ext4_super_block fields as little-endian 2018-09-05 09:26:36 +02:00
truncate.h
xattr.c ext4: add reclaim checks to xattr code 2021-03-30 14:40:12 +02:00
xattr.h ext4: add extra checks to ext4_xattr_block_get() 2018-04-24 09:36:31 +02:00
xattr_security.c
xattr_trusted.c
xattr_user.c