[RHEL7,COMMIT] ms/ext4: remove extent status procfs files if journal load fails

Submitted by Konstantin Khorenko on April 27, 2018, 10:55 a.m.

Details

Message ID 201804271055.w3RAtBEd001138@finist_ce7.work
State New
Series "ms/ext4: remove extent status procfs files if journal load fails"
Headers show

Commit Message

Konstantin Khorenko April 27, 2018, 10:55 a.m.
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.47.2
------>
commit d8da24d3effa167e3c3649fd2758d79960f96524
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Fri Apr 27 13:55:11 2018 +0300

    ms/ext4: remove extent status procfs files if journal load fails
    
    commit 50460fe8c6d1d95b16427936e351f277a1c72d43 upstream.
    
    If we can't load the journal, remove the procfs files for the extent
    status information file to avoid leaking resources.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Cc: stable@vger.kernel.org
    
    [aryabinin: This bug causes the WARN bellow, eventually leading
      to crash in shrink_slab()]
    
    EXT4-fs (loop0): INFO: recovery required on readonly filesystem
    EXT4-fs (loop0): write access unavailable, cannot proceed
    Call Trace:
     [<ffffffff816d5d81>] dump_stack+0x19/0x1b
     [<ffffffff8108a8d8>] __warn+0xd8/0x100
     [<ffffffff8108a95f>] warn_slowpath_fmt+0x5f/0x80
     [<ffffffff81298c11>] remove_proc_entry+0x151/0x1a0
     [<ffffffffc03985e7>] ext4_fill_super+0x267/0x2cc0 [ext4]
     [<ffffffff81222c92>] mount_bdev+0x1f2/0x240
     [<ffffffffc0392ef4>] ext4_mount+0x44/0x60 [ext4]
     [<ffffffff81223849>] mount_fs+0x39/0x1b0
     [<ffffffff81240e87>] vfs_kern_mount+0x67/0x110
     [<ffffffff8124372c>] do_mount+0x24c/0xb30
     [<ffffffff81244356>] SyS_mount+0x96/0xf0
     [<ffffffff816e8a7d>] system_call_fastpath+0x16/0x1b
    ---[ end trace 8b5c76e01d611a1e ]---
    
    https://jira.sw.ru/browse/PSBM-83691
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 fs/ext4/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a8aae06a9336..f644bf01587a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4399,7 +4399,7 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) &&
 	    !(sb->s_flags & MS_RDONLY))
 		if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))
-			goto failed_mount3;
+			goto failed_mount3a;
 
 	/*
 	 * The first inode we look at is the journal inode.  Don't try
@@ -4409,7 +4409,7 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	    EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
 		err = ext4_load_journal(sb, es, journal_devnum);
 		if (err)
-			goto failed_mount3;
+			goto failed_mount3a;
 	} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
 	      EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {
 		ext4_msg(sb, KERN_ERR, "required journal recovery "
@@ -4694,6 +4694,7 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		jbd2_journal_destroy(sbi->s_journal);
 		sbi->s_journal = NULL;
 	}
+failed_mount3a:
 	ext4_es_unregister_shrinker(sbi);
 failed_mount3:
 	del_timer_sync(&sbi->s_err_report);