[Devel] [PATCH RH8 1/4] fs/super: don't destroy super_block in case of leaked inodes

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Wed Jun 16 17:42:32 MSK 2021


From: Andrey Ryabinin <aryabinin at virtuozzo.com>

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 commit 1e96054ee10b18e06155f5402fe7ec5bf4b2c984)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

diff --git a/fs/super.c b/fs/super.c
index c0d97ea..bacf015 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -354,7 +354,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
-- 
1.8.3.1



More information about the Devel mailing list