[Devel] [PATCH RHEL7 COMMIT] ve/devmnt: initialize s_mode before deactivate_locked_super to suppress warning

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 19 15:47:52 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.6.3.vz7.62.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.6.3.vz7.62.4
------>
commit c6a602289bee10362028abe32a841b097e5def6a
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu Jul 19 15:47:52 2018 +0300

    ve/devmnt: initialize s_mode before deactivate_locked_super to suppress warning
    
    WARNING: CPU: 12 PID: 898592 at fs/super.c:1120 kill_block_super+0x63/0x70
    Call Trace:
    [<ffffffff816a02f8>] dump_stack+0x19/0x1b
    [<ffffffff81088be8>] __warn+0xd8/0x100
    [<ffffffff81088d2d>] warn_slowpath_null+0x1d/0x20
    [<ffffffff8121dfa3>] kill_block_super+0x63/0x70
    [<ffffffffc04891ec>] ext4_kill_sb+0x4c/0x60 [ext4]
    [<ffffffff8121e499>] deactivate_locked_super+0x49/0x80
    [<ffffffff8121efd7>] mount_bdev+0x227/0x240
    [<ffffffffc048f330>] ? ext4_calculate_overhead+0x430/0x430 [ext4]
    [<ffffffffc0489f34>] ext4_mount+0x44/0x60 [ext4]
    [<ffffffff8121fb35>] mount_fs+0x15/0xc0
    [<ffffffff8123c757>] vfs_kern_mount+0x67/0x110
    [<ffffffff8123efb9>] do_mount+0x219/0xae0
    [<ffffffff8123fbc6>] SyS_mount+0x96/0xf0
    [<ffffffff816b1649>] system_call_fastpath+0x16/0x1b
    
    On 3.10.0-693.1.1.vz7.37.30 kernel.
    
    We warn on no FMODE_EXCL on super block at kill_block_super. We get
    there from ve_devmnt_process's error path in mount_bdev, here we have
    yet uninitialized sb, thus it's s_mode has no FMODE_EXCL. So lets move
    s_mode initialization before these error path.
    
    Fixes commit 0759581712eb ("ve/fs/devmnt: process mount options")
    
    https://jira.sw.ru/browse/PSBM-80743
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index ca9bd0d261ba..fcc01a129752 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1147,7 +1147,10 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
 #ifdef CONFIG_VE
 		void *data_orig = data;
 		struct ve_struct *ve = get_exec_env();
+#endif
 
+		s->s_mode = mode;
+#ifdef CONFIG_VE
 		if (!ve_is_super(ve)) {
 			error = ve_devmnt_process(ve, bdev->bd_dev, &data, 0);
 			if (error) {
@@ -1156,7 +1159,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
 			}
 		}
 #endif
-		s->s_mode = mode;
 		strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
 		sb_set_blocksize(s, block_size(bdev));
 		error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);


More information about the Devel mailing list