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

Konstantin Khorenko khorenko at virtuozzo.com
Tue Aug 6 12:35:46 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.21.3.vz7.106.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.3.vz7.106.7
------>
commit 1e96054ee10b18e06155f5402fe7ec5bf4b2c984
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Aug 6 12:35:44 2019 +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>
---
 fs/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 02c9dc94e555..f131d14587ca 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -339,7 +339,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