diff options
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 0d2003fb4377..134d494158d9 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -695,12 +695,16 @@ static inline void mangle(struct seq_file *m, const char *s) | |||
695 | */ | 695 | */ |
696 | int generic_show_options(struct seq_file *m, struct vfsmount *mnt) | 696 | int generic_show_options(struct seq_file *m, struct vfsmount *mnt) |
697 | { | 697 | { |
698 | const char *options = mnt->mnt_sb->s_options; | 698 | const char *options; |
699 | |||
700 | rcu_read_lock(); | ||
701 | options = rcu_dereference(mnt->mnt_sb->s_options); | ||
699 | 702 | ||
700 | if (options != NULL && options[0]) { | 703 | if (options != NULL && options[0]) { |
701 | seq_putc(m, ','); | 704 | seq_putc(m, ','); |
702 | mangle(m, options); | 705 | mangle(m, options); |
703 | } | 706 | } |
707 | rcu_read_unlock(); | ||
704 | 708 | ||
705 | return 0; | 709 | return 0; |
706 | } | 710 | } |
@@ -721,11 +725,22 @@ EXPORT_SYMBOL(generic_show_options); | |||
721 | */ | 725 | */ |
722 | void save_mount_options(struct super_block *sb, char *options) | 726 | void save_mount_options(struct super_block *sb, char *options) |
723 | { | 727 | { |
724 | kfree(sb->s_options); | 728 | BUG_ON(sb->s_options); |
725 | sb->s_options = kstrdup(options, GFP_KERNEL); | 729 | rcu_assign_pointer(sb->s_options, kstrdup(options, GFP_KERNEL)); |
726 | } | 730 | } |
727 | EXPORT_SYMBOL(save_mount_options); | 731 | EXPORT_SYMBOL(save_mount_options); |
728 | 732 | ||
733 | void replace_mount_options(struct super_block *sb, char *options) | ||
734 | { | ||
735 | char *old = sb->s_options; | ||
736 | rcu_assign_pointer(sb->s_options, options); | ||
737 | if (old) { | ||
738 | synchronize_rcu(); | ||
739 | kfree(old); | ||
740 | } | ||
741 | } | ||
742 | EXPORT_SYMBOL(replace_mount_options); | ||
743 | |||
729 | #ifdef CONFIG_PROC_FS | 744 | #ifdef CONFIG_PROC_FS |
730 | /* iterator */ | 745 | /* iterator */ |
731 | static void *m_start(struct seq_file *m, loff_t *pos) | 746 | static void *m_start(struct seq_file *m, loff_t *pos) |