diff options
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 67 |
1 files changed, 57 insertions, 10 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index e9c10cd01e13..63ced21c12dc 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -320,6 +320,50 @@ void mnt_unpin(struct vfsmount *mnt) | |||
320 | 320 | ||
321 | EXPORT_SYMBOL(mnt_unpin); | 321 | EXPORT_SYMBOL(mnt_unpin); |
322 | 322 | ||
323 | static inline void mangle(struct seq_file *m, const char *s) | ||
324 | { | ||
325 | seq_escape(m, s, " \t\n\\"); | ||
326 | } | ||
327 | |||
328 | /* | ||
329 | * Simple .show_options callback for filesystems which don't want to | ||
330 | * implement more complex mount option showing. | ||
331 | * | ||
332 | * See also save_mount_options(). | ||
333 | */ | ||
334 | int generic_show_options(struct seq_file *m, struct vfsmount *mnt) | ||
335 | { | ||
336 | const char *options = mnt->mnt_sb->s_options; | ||
337 | |||
338 | if (options != NULL && options[0]) { | ||
339 | seq_putc(m, ','); | ||
340 | mangle(m, options); | ||
341 | } | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | EXPORT_SYMBOL(generic_show_options); | ||
346 | |||
347 | /* | ||
348 | * If filesystem uses generic_show_options(), this function should be | ||
349 | * called from the fill_super() callback. | ||
350 | * | ||
351 | * The .remount_fs callback usually needs to be handled in a special | ||
352 | * way, to make sure, that previous options are not overwritten if the | ||
353 | * remount fails. | ||
354 | * | ||
355 | * Also note, that if the filesystem's .remount_fs function doesn't | ||
356 | * reset all options to their default value, but changes only newly | ||
357 | * given options, then the displayed options will not reflect reality | ||
358 | * any more. | ||
359 | */ | ||
360 | void save_mount_options(struct super_block *sb, char *options) | ||
361 | { | ||
362 | kfree(sb->s_options); | ||
363 | sb->s_options = kstrdup(options, GFP_KERNEL); | ||
364 | } | ||
365 | EXPORT_SYMBOL(save_mount_options); | ||
366 | |||
323 | /* iterator */ | 367 | /* iterator */ |
324 | static void *m_start(struct seq_file *m, loff_t *pos) | 368 | static void *m_start(struct seq_file *m, loff_t *pos) |
325 | { | 369 | { |
@@ -341,11 +385,6 @@ static void m_stop(struct seq_file *m, void *v) | |||
341 | up_read(&namespace_sem); | 385 | up_read(&namespace_sem); |
342 | } | 386 | } |
343 | 387 | ||
344 | static inline void mangle(struct seq_file *m, const char *s) | ||
345 | { | ||
346 | seq_escape(m, s, " \t\n\\"); | ||
347 | } | ||
348 | |||
349 | static int show_vfsmnt(struct seq_file *m, void *v) | 388 | static int show_vfsmnt(struct seq_file *m, void *v) |
350 | { | 389 | { |
351 | struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); | 390 | struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); |
@@ -897,8 +936,9 @@ out_unlock: | |||
897 | 936 | ||
898 | /* | 937 | /* |
899 | * recursively change the type of the mountpoint. | 938 | * recursively change the type of the mountpoint. |
939 | * noinline this do_mount helper to save do_mount stack space. | ||
900 | */ | 940 | */ |
901 | static int do_change_type(struct nameidata *nd, int flag) | 941 | static noinline int do_change_type(struct nameidata *nd, int flag) |
902 | { | 942 | { |
903 | struct vfsmount *m, *mnt = nd->mnt; | 943 | struct vfsmount *m, *mnt = nd->mnt; |
904 | int recurse = flag & MS_REC; | 944 | int recurse = flag & MS_REC; |
@@ -921,8 +961,10 @@ static int do_change_type(struct nameidata *nd, int flag) | |||
921 | 961 | ||
922 | /* | 962 | /* |
923 | * do loopback mount. | 963 | * do loopback mount. |
964 | * noinline this do_mount helper to save do_mount stack space. | ||
924 | */ | 965 | */ |
925 | static int do_loopback(struct nameidata *nd, char *old_name, int recurse) | 966 | static noinline int do_loopback(struct nameidata *nd, char *old_name, |
967 | int recurse) | ||
926 | { | 968 | { |
927 | struct nameidata old_nd; | 969 | struct nameidata old_nd; |
928 | struct vfsmount *mnt = NULL; | 970 | struct vfsmount *mnt = NULL; |
@@ -971,8 +1013,9 @@ out: | |||
971 | * change filesystem flags. dir should be a physical root of filesystem. | 1013 | * change filesystem flags. dir should be a physical root of filesystem. |
972 | * If you've mounted a non-root directory somewhere and want to do remount | 1014 | * If you've mounted a non-root directory somewhere and want to do remount |
973 | * on it - tough luck. | 1015 | * on it - tough luck. |
1016 | * noinline this do_mount helper to save do_mount stack space. | ||
974 | */ | 1017 | */ |
975 | static int do_remount(struct nameidata *nd, int flags, int mnt_flags, | 1018 | static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags, |
976 | void *data) | 1019 | void *data) |
977 | { | 1020 | { |
978 | int err; | 1021 | int err; |
@@ -1007,7 +1050,10 @@ static inline int tree_contains_unbindable(struct vfsmount *mnt) | |||
1007 | return 0; | 1050 | return 0; |
1008 | } | 1051 | } |
1009 | 1052 | ||
1010 | static int do_move_mount(struct nameidata *nd, char *old_name) | 1053 | /* |
1054 | * noinline this do_mount helper to save do_mount stack space. | ||
1055 | */ | ||
1056 | static noinline int do_move_mount(struct nameidata *nd, char *old_name) | ||
1011 | { | 1057 | { |
1012 | struct nameidata old_nd, parent_nd; | 1058 | struct nameidata old_nd, parent_nd; |
1013 | struct vfsmount *p; | 1059 | struct vfsmount *p; |
@@ -1082,8 +1128,9 @@ out: | |||
1082 | /* | 1128 | /* |
1083 | * create a new mount for userspace and request it to be added into the | 1129 | * create a new mount for userspace and request it to be added into the |
1084 | * namespace's tree | 1130 | * namespace's tree |
1131 | * noinline this do_mount helper to save do_mount stack space. | ||
1085 | */ | 1132 | */ |
1086 | static int do_new_mount(struct nameidata *nd, char *type, int flags, | 1133 | static noinline int do_new_mount(struct nameidata *nd, char *type, int flags, |
1087 | int mnt_flags, char *name, void *data) | 1134 | int mnt_flags, char *name, void *data) |
1088 | { | 1135 | { |
1089 | struct vfsmount *mnt; | 1136 | struct vfsmount *mnt; |