1 From 037369b872940cd923835a0a589763180c4a36bc Mon Sep 17 00:00:00 2001
2 From: Mikulas Patocka <mikulas@twibright.com>
3 Date: Tue, 24 May 2016 22:49:18 +0200
4 Subject: hpfs: implement the show_options method
6 From: Mikulas Patocka <mikulas@twibright.com>
8 commit 037369b872940cd923835a0a589763180c4a36bc upstream.
10 The HPFS filesystem used generic_show_options to produce string that is
11 displayed in /proc/mounts. However, there is a problem that the options
12 may disappear after remount. If we mount the filesystem with option1
13 and then remount it with option2, /proc/mounts should show both option1
14 and option2, however it only shows option2 because the whole option
15 string is replaced with replace_mount_options in hpfs_remount_fs.
17 To fix this bug, implement the hpfs_show_options function that prints
18 options that are currently selected.
20 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
21 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 fs/hpfs/super.c | 43 ++++++++++++++++++++++++++++++++-----------
26 1 file changed, 32 insertions(+), 11 deletions(-)
31 #include <linux/sched.h>
32 #include <linux/bitmap.h>
33 #include <linux/slab.h>
34 +#include <linux/seq_file.h>
36 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
38 @@ -453,10 +454,6 @@ static int hpfs_remount_fs(struct super_
39 int lowercase, eas, chk, errs, chkdsk, timeshift;
41 struct hpfs_sb_info *sbi = hpfs_sb(s);
42 - char *new_opts = kstrdup(data, GFP_KERNEL);
44 - if (data && !new_opts)
49 @@ -493,18 +490,44 @@ static int hpfs_remount_fs(struct super_
51 if (!(*flags & MS_RDONLY)) mark_dirty(s, 1);
54 - replace_mount_options(s, new_opts);
65 +static int hpfs_show_options(struct seq_file *seq, struct dentry *root)
67 + struct hpfs_sb_info *sbi = hpfs_sb(root->d_sb);
69 + seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, sbi->sb_uid));
70 + seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, sbi->sb_gid));
71 + seq_printf(seq, ",umask=%03o", (~sbi->sb_mode & 0777));
72 + if (sbi->sb_lowercase)
73 + seq_printf(seq, ",case=lower");
75 + seq_printf(seq, ",check=none");
76 + if (sbi->sb_chk == 2)
77 + seq_printf(seq, ",check=strict");
79 + seq_printf(seq, ",errors=continue");
80 + if (sbi->sb_err == 2)
81 + seq_printf(seq, ",errors=panic");
82 + if (!sbi->sb_chkdsk)
83 + seq_printf(seq, ",chkdsk=no");
84 + if (sbi->sb_chkdsk == 2)
85 + seq_printf(seq, ",chkdsk=always");
87 + seq_printf(seq, ",eas=no");
88 + if (sbi->sb_eas == 1)
89 + seq_printf(seq, ",eas=ro");
90 + if (sbi->sb_timeshift)
91 + seq_printf(seq, ",timeshift=%d", sbi->sb_timeshift);
95 /* Super operations */
97 static const struct super_operations hpfs_sops =
98 @@ -515,7 +538,7 @@ static const struct super_operations hpf
99 .put_super = hpfs_put_super,
100 .statfs = hpfs_statfs,
101 .remount_fs = hpfs_remount_fs,
102 - .show_options = generic_show_options,
103 + .show_options = hpfs_show_options,
106 static int hpfs_fill_super(struct super_block *s, void *options, int silent)
107 @@ -538,8 +561,6 @@ static int hpfs_fill_super(struct super_
111 - save_mount_options(s, options);
113 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);