Skip to content

Commit 4f879ca

Browse files
jankaratytso
authored andcommitted
ext4: bail early when clearing inode journal flag fails
When clearing inode journal flag, we call jbd2_journal_flush() to force all the journalled data to their final locations. Currently we ignore when this fails and continue clearing inode journal flag. This isn't a big problem because when jbd2_journal_flush() fails, journal is likely aborted anyway. But it can still lead to somewhat confusing results so rather bail out early. Coverity-id: 989044 Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 6050d47 commit 4f879ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/ext4/inode.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4959,7 +4959,12 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
49594959
if (val)
49604960
ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
49614961
else {
4962-
jbd2_journal_flush(journal);
4962+
err = jbd2_journal_flush(journal);
4963+
if (err < 0) {
4964+
jbd2_journal_unlock_updates(journal);
4965+
ext4_inode_resume_unlocked_dio(inode);
4966+
return err;
4967+
}
49634968
ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
49644969
}
49654970
ext4_set_aops(inode);

0 commit comments

Comments
 (0)