ext4: handle ext4_mark_inode_dirty errors
ext4_mark_inode_dirty() can fail for real reasons. Ignoring its return value may lead ext4 to ignore real failures that would result in corruption / crashes. Harden ext4_mark_inode_dirty error paths to fail as soon as possible and return errors to the caller whenever appropriate. One of the possible scnearios when this bug could affected is that while creating a new inode, its directory entry gets added successfully but while writing the inode itself mark_inode_dirty returns error which is ignored. This would result in inconsistency that the directory entry points to a non-existent inode. Ran gce-xfstests smoke tests and verified that there were no regressions. Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20200427013438.219117-1-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:

committed by
Theodore Ts'o

parent
8418897f1b
commit
4209ae12b1
@@ -467,7 +467,9 @@ static int ext4_splice_branch(handle_t *handle,
|
||||
/*
|
||||
* OK, we spliced it into the inode itself on a direct block.
|
||||
*/
|
||||
ext4_mark_inode_dirty(handle, ar->inode);
|
||||
err = ext4_mark_inode_dirty(handle, ar->inode);
|
||||
if (unlikely(err))
|
||||
goto err_out;
|
||||
jbd_debug(5, "splicing direct\n");
|
||||
}
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user