[Devel] [PATCH RHEL9 COMMIT] fs/super: don't destroy super_block in case of leaked inodes

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 20 11:40:45 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.12
------>
commit 7f0a51b44f51ae5d7605fd4da7d96647e3fd52d0
Author: Andrey Ryabinin <ryabinin.a.a at gmail.com>
Date:   Wed Oct 20 11:40:44 2021 +0300

    fs/super: don't destroy super_block in case of leaked inodes
    
    In case of leaked inode don't destroy superblock to decrease
    possibility of crash.
    
    https://jira.sw.ru/browse/PSBM-95177
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    
    (cherry picked from vz7 commit 1e96054ee10b ("fs/super: don't destroy
    super_block in case of leaked inodes"))
    
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    
    (cherry picked from vz8 commit 1239a87d573073462d4e2cecebc9a2e29095fa7b)
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 fs/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index d3f48cfb142b..c306a6f3641a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -358,7 +358,15 @@ void deactivate_locked_super(struct super_block *s)
 		cleancache_invalidate_fs(s);
 		unregister_shrinker(&s->s_shrink);
 		fs->kill_sb(s);
-
+		if (!list_empty(&s->s_inodes)) {
+			pr_err("deactivate_locked_super: busy inodes...\n");
+			spin_lock(&sb_lock);
+			if (!--s->s_count)
+				list_del_init(&s->s_list);
+			spin_unlock(&sb_lock);
+			up_write(&s->s_umount);
+			return;
+		}
 		/*
 		 * Since list_lru_destroy() may sleep, we cannot call it from
 		 * put_super(), where we hold the sb_lock. Therefore we destroy


More information about the Devel mailing list