summaryrefslogtreecommitdiff
path: root/fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/super.c b/fs/super.c
index d1e2f46bad7e..2c38541cd89f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -514,12 +514,6 @@ struct super_block *sget_fc(struct fs_context *fc,
struct user_namespace *user_ns = fc->global ? &init_user_ns : fc->user_ns;
int err;
- if (!(fc->sb_flags & SB_KERNMOUNT) &&
- fc->purpose != FS_CONTEXT_FOR_SUBMOUNT) {
- if (!mount_capable(fc))
- return ERR_PTR(-EPERM);
- }
-
retry:
spin_lock(&sb_lock);
if (test) {
@@ -1421,6 +1415,12 @@ int vfs_get_tree(struct fs_context *fc)
if (fc->root)
return -EBUSY;
+ if (!(fc->sb_flags & SB_KERNMOUNT) &&
+ fc->purpose != FS_CONTEXT_FOR_SUBMOUNT) {
+ if (!mount_capable(fc))
+ return -EPERM;
+ }
+
/* Get the mountable root in fc->root, with a ref on the root and a ref
* on the superblock.
*/