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

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 9 18:16:02 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.38
------>
commit 36055ea9885ae953a605087425da11c18a20d3d4
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Wed Jun 9 18:16:02 2021 +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.
    
    mFixes: vz7 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>
    
    (cherry picked from vz7 commit 3543274fc3f1 ("ve/devmnt: initialize s_mode
    before deactivate_locked_super to suppress warning"))
    
    Fixes: vz8 commit b7285b56b1a9 ("ve/fs/devmnt: process mount options")
    
    VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127837
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn 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 9fda135ee564..ca7863c56079 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1191,7 +1191,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) {
@@ -1200,7 +1203,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
 			}
 		}
 #endif
-		s->s_mode = mode;
 		snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
 		sb_set_blocksize(s, block_size(bdev));
 		error = fill_super(s, data, flags & SB_SILENT ? 1 : 0);


More information about the Devel mailing list