[Devel] [PATCH RHEL7 COMMIT] ms/sget(): handle failures of register_shrinker()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 27 18:05:26 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.4
------>
commit 5c99fa0a17a02bdb498c1d4d29f3eb09860a9427
Author: Al Viro <viro at zeniv.linux.org.uk>
Date:   Mon Aug 27 18:05:26 2018 +0300

    ms/sget(): handle failures of register_shrinker()
    
    ms commit 9ee332d99e4d
    
    Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
    
    [This may cause never shrinked SB and memory leak]
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index fcc01a129752..7e6352370a45 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -538,7 +538,11 @@ struct super_block *sget_userns(struct file_system_type *type,
 	hlist_add_head(&s->s_instances, &type->fs_supers);
 	spin_unlock(&sb_lock);
 	get_filesystem(type);
-	register_shrinker(&s->s_shrink);
+	err = register_shrinker(&s->s_shrink);
+	if (err) {
+		deactivate_locked_super(s);
+		s = ERR_PTR(err);
+	}
 	return s;
 }
 


More information about the Devel mailing list