Created
April 29, 2021 21:56
-
-
Save mcgrof/316a627218305545fb84f05624973d0b to your computer and use it in GitHub Desktop.
fix sget / sget_fc thrashing on sb_lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/fs/super.c b/fs/super.c | |
index 59bbbd8a6..e029eb3f6 100644 | |
--- a/fs/super.c | |
+++ b/fs/super.c | |
@@ -566,6 +566,7 @@ struct super_block *sget_fc(struct fs_context *fc, | |
struct user_namespace *user_ns = fc->global ? &init_user_ns : fc->user_ns; | |
int err; | |
+ s = alloc_super(fc->fs_type, fc->sb_flags, user_ns); | |
retry: | |
spin_lock(&sb_lock); | |
if (test) { | |
@@ -576,10 +577,7 @@ struct super_block *sget_fc(struct fs_context *fc, | |
} | |
if (!s) { | |
spin_unlock(&sb_lock); | |
- s = alloc_super(fc->fs_type, fc->sb_flags, user_ns); | |
- if (!s) | |
- return ERR_PTR(-ENOMEM); | |
- goto retry; | |
+ return ERR_PTR(-ENOMEM); | |
} | |
s->s_fs_info = fc->s_fs_info; | |
@@ -640,6 +638,7 @@ struct super_block *sget(struct file_system_type *type, | |
if (flags & SB_SUBMOUNT) | |
user_ns = &init_user_ns; | |
+ s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); | |
retry: | |
spin_lock(&sb_lock); | |
if (test) { | |
@@ -659,10 +658,7 @@ struct super_block *sget(struct file_system_type *type, | |
} | |
if (!s) { | |
spin_unlock(&sb_lock); | |
- s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); | |
- if (!s) | |
- return ERR_PTR(-ENOMEM); | |
- goto retry; | |
+ return ERR_PTR(-ENOMEM); | |
} | |
err = set(s, data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment