summaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 13:06:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 13:06:57 -0400
commitbc7d9aee3f3ce0c0633c20ea55b81efb3ca7984d (patch)
tree24e17a197a1b84d3576a69cd8955fbf8b8a9dc76 /fs/super.c
parentcfb82e1df8b7c76991ea12958855897c2fb4debc (diff)
parent74983ac20aeafc88d9ceed64a8bf2a9024c488d5 (diff)
Merge branch 'work.mount2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc mount API conversions from Al Viro: "Conversions to new API for shmem and friends and for mount_mtd()-using filesystems. As for the rest of the mount API conversions in -next, some of them belong in the individual trees (e.g. binderfs one should definitely go through android folks, after getting redone on top of their changes). I'm going to drop those and send the rest (trivial ones + stuff ACKed by maintainers) in a separate series - by that point they are independent from each other. Some stuff has already migrated into individual trees (NFS conversion, for example, or FUSE stuff, etc.); those presumably will go through the regular merges from corresponding trees." * 'work.mount2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: vfs: Make fs_parse() handle fs_param_is_fd-type params better vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the new mount API shmem_parse_one(): switch to use of fs_parse() shmem_parse_options(): take handling a single option into a helper shmem_parse_options(): don't bother with mpol in separate variable shmem_parse_options(): use a separate structure to keep the results make shmem_fill_super() static make ramfs_fill_super() static devtmpfs: don't mix {ramfs,shmem}_fill_super() with mount_single() vfs: Convert squashfs to use the new mount API mtd: Kill mount_mtd() vfs: Convert jffs2 to use the new mount API vfs: Convert cramfs to use the new mount API vfs: Convert romfs to use the new mount API vfs: Add a single-or-reconfig keying to vfs_get_super()
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/fs/super.c b/fs/super.c
index 2d679db9e8c7..8020974b2a68 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1164,9 +1164,11 @@ int vfs_get_super(struct fs_context *fc,
1164{ 1164{
1165 int (*test)(struct super_block *, struct fs_context *); 1165 int (*test)(struct super_block *, struct fs_context *);
1166 struct super_block *sb; 1166 struct super_block *sb;
1167 int err;
1167 1168
1168 switch (keying) { 1169 switch (keying) {
1169 case vfs_get_single_super: 1170 case vfs_get_single_super:
1171 case vfs_get_single_reconf_super:
1170 test = test_single_super; 1172 test = test_single_super;
1171 break; 1173 break;
1172 case vfs_get_keyed_super: 1174 case vfs_get_keyed_super:
@@ -1184,18 +1186,29 @@ int vfs_get_super(struct fs_context *fc,
1184 return PTR_ERR(sb); 1186 return PTR_ERR(sb);
1185 1187
1186 if (!sb->s_root) { 1188 if (!sb->s_root) {
1187 int err = fill_super(sb, fc); 1189 err = fill_super(sb, fc);
1188 if (err) { 1190 if (err)
1189 deactivate_locked_super(sb); 1191 goto error;
1190 return err;
1191 }
1192 1192
1193 sb->s_flags |= SB_ACTIVE; 1193 sb->s_flags |= SB_ACTIVE;
1194 fc->root = dget(sb->s_root);
1195 } else {
1196 fc->root = dget(sb->s_root);
1197 if (keying == vfs_get_single_reconf_super) {
1198 err = reconfigure_super(fc);
1199 if (err < 0) {
1200 dput(fc->root);
1201 fc->root = NULL;
1202 goto error;
1203 }
1204 }
1194 } 1205 }
1195 1206
1196 BUG_ON(fc->root);
1197 fc->root = dget(sb->s_root);
1198 return 0; 1207 return 0;
1208
1209error:
1210 deactivate_locked_super(sb);
1211 return err;
1199} 1212}
1200EXPORT_SYMBOL(vfs_get_super); 1213EXPORT_SYMBOL(vfs_get_super);
1201 1214
@@ -1215,6 +1228,14 @@ int get_tree_single(struct fs_context *fc,
1215} 1228}
1216EXPORT_SYMBOL(get_tree_single); 1229EXPORT_SYMBOL(get_tree_single);
1217 1230
1231int get_tree_single_reconf(struct fs_context *fc,
1232 int (*fill_super)(struct super_block *sb,
1233 struct fs_context *fc))
1234{
1235 return vfs_get_super(fc, vfs_get_single_reconf_super, fill_super);
1236}
1237EXPORT_SYMBOL(get_tree_single_reconf);
1238
1218int get_tree_keyed(struct fs_context *fc, 1239int get_tree_keyed(struct fs_context *fc,
1219 int (*fill_super)(struct super_block *sb, 1240 int (*fill_super)(struct super_block *sb,
1220 struct fs_context *fc), 1241 struct fs_context *fc),