This is a note to let you know that I've just added the patch titled ext4: check for shutdown and r/o file system in ext4_write_inode() to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-check-for-shutdown-and-r-o-file-system-in-ext4_write_inode.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 18f2c4fcebf2582f96cbd5f2238f4f354a0e4847 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@xxxxxxx> Date: Wed, 19 Dec 2018 14:36:58 -0500 Subject: ext4: check for shutdown and r/o file system in ext4_write_inode() From: Theodore Ts'o <tytso@xxxxxxx> commit 18f2c4fcebf2582f96cbd5f2238f4f354a0e4847 upstream. If the file system has been shut down or is read-only, then ext4_write_inode() needs to bail out early. Also use jbd2_complete_transaction() instead of ext4_force_commit() so we only force a commit if it is needed. Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Cc: stable@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5218,9 +5218,13 @@ int ext4_write_inode(struct inode *inode { int err; - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC)) + if (WARN_ON_ONCE(current->flags & PF_MEMALLOC) || + sb_rdonly(inode->i_sb)) return 0; + if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) + return -EIO; + if (EXT4_SB(inode->i_sb)->s_journal) { if (ext4_journal_current_handle()) { jbd_debug(1, "called recursively, non-PF_MEMALLOC!\n"); @@ -5236,7 +5240,8 @@ int ext4_write_inode(struct inode *inode if (wbc->sync_mode != WB_SYNC_ALL || wbc->for_sync) return 0; - err = ext4_force_commit(inode->i_sb); + err = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, + EXT4_I(inode)->i_sync_tid); } else { struct ext4_iloc iloc; Patches currently in stable-queue which might be from tytso@xxxxxxx are queue-4.14/ext4-missing-unlock-put_page-in-ext4_try_to_write_inline_data.patch queue-4.14/ext4-fix-possible-use-after-free-in-ext4_quota_enable.patch queue-4.14/ext4-add-ext4_sb_bread-to-disambiguate-enomem-cases.patch queue-4.14/ext4-check-for-shutdown-and-r-o-file-system-in-ext4_write_inode.patch queue-4.14/ext4-fix-ext4_ioc_group_add-ioctl.patch queue-4.14/ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch queue-4.14/ext4-force-inode-writes-when-nfsd-calls-commit_metadata.patch