[RHEL7,COMMIT] nfs: skip bdi_unregister() if inodes are leaked.

Submitted by Konstantin Khorenko on Aug. 6, 2019, 9:35 a.m.

Details

Message ID 201908060935.x769ZjD2004115@finist-ce7.sw.ru
State New
Series "nfs: skip bdi_unregister() if inodes are leaked."
Headers show

Commit Message

Konstantin Khorenko Aug. 6, 2019, 9:35 a.m.
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 160e886e8adc095ac9f01420f66962732ee9683d
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Tue Aug 6 12:35:45 2019 +0300

    nfs: skip bdi_unregister() if inodes are leaked.
    
    https://jira.sw.ru/browse/PSBM-95177
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 fs/nfs/super.c | 3 +++
 fs/super.c     | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 64b52b7188c9..f9c0a02c25af 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2711,6 +2711,9 @@  void nfs_put_super(struct super_block *s)
 {
 	struct nfs_server *server = NFS_SB(s);
 
+	if (!list_empty(&s->s_inodes))
+		pr_err("nfs_put_super: busy inodes skip bdi_unregister\n");
+
 	bdi_unregister(&server->backing_dev_info);
 }
 EXPORT_SYMBOL_GPL(nfs_put_super);
diff --git a/fs/super.c b/fs/super.c
index f131d14587ca..e5551b8462a8 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1046,7 +1046,8 @@  void kill_anon_super(struct super_block *sb)
 {
 	dev_t dev = sb->s_dev;
 	generic_shutdown_super(sb);
-	free_anon_bdev(dev);
+	if (!list_empty(&sb->s_inodes))
+		free_anon_bdev(dev);
 }
 
 EXPORT_SYMBOL(kill_anon_super);