]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: correct the error path of ext4_write_inline_data_end()
authorZhang Yi <yi.zhang@huawei.com>
Fri, 16 Jul 2021 12:20:22 +0000 (20:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Oct 2021 08:42:33 +0000 (10:42 +0200)
commitd9dc69d63ce43000019197e2eeaf7bcaf235044d
treeb8733a631fd15bf1175346514e09275db5739315
parentb49a2bd9734fdbddb94c36f39ad48a10fdb5b742
ext4: correct the error path of ext4_write_inline_data_end()

[ Upstream commit 55ce2f649b9e88111270333a8127e23f4f8f42d7 ]

Current error path of ext4_write_inline_data_end() is not correct.

Firstly, it should pass out the error value if ext4_get_inode_loc()
return fail, or else it could trigger infinite loop if we inject error
here. And then it's better to add inode to orphan list if it return fail
in ext4_journal_stop(), otherwise we could not restore inline xattr
entry after power failure. Finally, we need to reset the 'ret' value if
ext4_write_inline_data_end() return success in ext4_write_end() and
ext4_journalled_write_end(), otherwise we could not get the error return
value of ext4_journal_stop().

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20210716122024.1105856-3-yi.zhang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/inline.c
fs/ext4/inode.c