[Devel] [PATCH RHEL7 COMMIT] ext4: Fix error handling after filesystem abort

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 22 03:38:18 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.15
------>
commit 3fe1b2312918eeb35ef751e73047b7e4e87e394e
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Jun 22 14:38:18 2015 +0400

    ext4: Fix error handling after filesystem abort
    
    If filesystem was aborted after inode's write back is complete
    but before its metadata was updated we may return success
    results in data loss.
    In order to handle fs abort correctly we have to check
    fs state once we discover that it is in MS_RDONLY state
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/ext4/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a40e3c8..bb35b9f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4710,7 +4710,11 @@ int ext4_force_commit(struct super_block *sb)
 {
 	journal_t *journal;
 
-	if (sb->s_flags & MS_RDONLY)
+	if (sb->s_flags & MS_RDONLY) {
+		smp_rmb();
+		if (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
+			return -EROFS;
+	}
 		return 0;
 
 	journal = EXT4_SB(sb)->s_journal;



More information about the Devel mailing list