Skip to content

Commit

Permalink
ext4: Avoid writeback path when fs is shut down
Browse files Browse the repository at this point in the history
Patch suggtestd by Teodore Ts'o in

https://lore.kernel.org/linux-ext4/4e83fb26-4d4a-d482-640c-8104973b7ebf@molgen.mpg.de/T/#u

to avoid the error

EXT4-fs (dm-0): ext4_writepages: jbd2_start: 5120 pages, ino 11; err -5

which sometimed occurs, when we set the fs to EXT4_IOC_SHUTDOWN+EXT4_GOING_FLAGS_NOLOGFLUSH
  • Loading branch information
donald committed Sep 20, 2022
1 parent 8ea72db commit f50891a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ static int ext4_journalled_submit_inode_data_buffers(struct jbd2_inode *jinode)
static int ext4_journal_submit_inode_data_buffers(struct jbd2_inode *jinode)
{
int ret;
journal_t *journal = EXT4_SB(jinode->i_vfs_inode->i_sb)->s_journal;

if (!journal || is_journal_aborted(journal))
return 0;

if (ext4_should_journal_data(jinode->i_vfs_inode))
ret = ext4_journalled_submit_inode_data_buffers(jinode);
Expand All @@ -535,6 +539,10 @@ static int ext4_journal_submit_inode_data_buffers(struct jbd2_inode *jinode)
static int ext4_journal_finish_inode_data_buffers(struct jbd2_inode *jinode)
{
int ret = 0;
journal_t *journal = EXT4_SB(jinode->i_vfs_inode->i_sb)->s_journal;

if (!journal || is_journal_aborted(journal))
return 0;

if (!ext4_should_journal_data(jinode->i_vfs_inode))
ret = jbd2_journal_finish_inode_data_buffers(jinode);
Expand Down

0 comments on commit f50891a

Please sign in to comment.