]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.1/hpfs-implement-the-show_options-method.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.1 / hpfs-implement-the-show_options-method.patch
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
5
6 From: Mikulas Patocka <mikulas@twibright.com>
7
8 commit 037369b872940cd923835a0a589763180c4a36bc upstream.
9
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.
16
17 To fix this bug, implement the hpfs_show_options function that prints
18 options that are currently selected.
19
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>
23
24 ---
25 fs/hpfs/super.c | 43 ++++++++++++++++++++++++++++++++-----------
26 1 file changed, 32 insertions(+), 11 deletions(-)
27
28 --- a/fs/hpfs/super.c
29 +++ b/fs/hpfs/super.c
30 @@ -15,6 +15,7 @@
31 #include <linux/sched.h>
32 #include <linux/bitmap.h>
33 #include <linux/slab.h>
34 +#include <linux/seq_file.h>
35
36 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
37
38 @@ -453,10 +454,6 @@ static int hpfs_remount_fs(struct super_
39 int lowercase, eas, chk, errs, chkdsk, timeshift;
40 int o;
41 struct hpfs_sb_info *sbi = hpfs_sb(s);
42 - char *new_opts = kstrdup(data, GFP_KERNEL);
43 -
44 - if (data && !new_opts)
45 - return -ENOMEM;
46
47 sync_filesystem(s);
48
49 @@ -493,18 +490,44 @@ static int hpfs_remount_fs(struct super_
50
51 if (!(*flags & MS_RDONLY)) mark_dirty(s, 1);
52
53 - if (new_opts)
54 - replace_mount_options(s, new_opts);
55 -
56 hpfs_unlock(s);
57 return 0;
58
59 out_err:
60 hpfs_unlock(s);
61 - kfree(new_opts);
62 return -EINVAL;
63 }
64
65 +static int hpfs_show_options(struct seq_file *seq, struct dentry *root)
66 +{
67 + struct hpfs_sb_info *sbi = hpfs_sb(root->d_sb);
68 +
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");
74 + if (!sbi->sb_chk)
75 + seq_printf(seq, ",check=none");
76 + if (sbi->sb_chk == 2)
77 + seq_printf(seq, ",check=strict");
78 + if (!sbi->sb_err)
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");
86 + if (!sbi->sb_eas)
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);
92 + return 0;
93 +}
94 +
95 /* Super operations */
96
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,
104 };
105
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_
108
109 int o;
110
111 - save_mount_options(s, options);
112 -
113 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
114 if (!sbi) {
115 return -ENOMEM;