summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-12-19 14:36:58 -0500
committerBen Hutchings <ben@decadent.org.uk>2019-04-04 16:14:00 +0100
commit607ac35fcd12d4f446fc0038fd17dbb68f18bc0e (patch)
treec49cfff0503bea7a92fec3779c8ddeabcda5699a /fs
parentdf3654402e4201a19f0ee33208779a3989f4c70f (diff)
ext4: check for shutdown and r/o file system in ext4_write_inode()
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@mit.edu> [bwh: Backported to 3.16: - Open-code sb_rdonly() - Drop ext4_forced_shutdown() check] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fa245fe92e5a..fe2407b3d92d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4658,7 +4658,8 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
{
int err;
- if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
+ if (WARN_ON_ONCE(current->flags & PF_MEMALLOC) ||
+ (inode->i_sb->s_flags & MS_RDONLY))
return 0;
if (EXT4_SB(inode->i_sb)->s_journal) {
@@ -4676,7 +4677,8 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
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;