Fix broken put_bh->brelse conversion
[ext4-patch-queue.git] / fix-show-options.patch
blobb1db2ff906626cc24215e83d542db904498a1ed8
1 ext4: Fix ext4_show_options to show the correct mount options.
3 From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
5 We need to look at the default value and make sure
6 the mount options are not set via default value
7 before showing them via ext4_show_options
9 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
10 ---
12 fs/ext4/super.c | 26 +++++++++++++++-----------
13 1 files changed, 15 insertions(+), 11 deletions(-)
16 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
17 index aa22acd..64fc7f1 100644
18 --- a/fs/ext4/super.c
19 +++ b/fs/ext4/super.c
20 @@ -665,18 +665,20 @@ static inline void ext4_show_quota_options(struct seq_file *seq, struct super_bl
22 static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
24 + int def_errors;
25 + unsigned long def_mount_opts;
26 struct super_block *sb = vfs->mnt_sb;
27 struct ext4_sb_info *sbi = EXT4_SB(sb);
28 struct ext4_super_block *es = sbi->s_es;
29 - unsigned long def_mount_opts;
31 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
32 + def_errors = le16_to_cpu(es->s_errors);
34 if (sbi->s_sb_block != 1)
35 seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
36 if (test_opt(sb, MINIX_DF))
37 seq_puts(seq, ",minixdf");
38 - if (test_opt(sb, GRPID))
39 + if (test_opt(sb, GRPID) && !(def_mount_opts & EXT4_DEFM_BSDGROUPS))
40 seq_puts(seq, ",grpid");
41 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
42 seq_puts(seq, ",nogrpid");
43 @@ -689,25 +691,24 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
44 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
46 if (test_opt(sb, ERRORS_RO)) {
47 - int def_errors = le16_to_cpu(es->s_errors);
49 if (def_errors == EXT4_ERRORS_PANIC ||
50 def_errors == EXT4_ERRORS_CONTINUE) {
51 seq_puts(seq, ",errors=remount-ro");
54 - if (test_opt(sb, ERRORS_CONT))
55 + if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE)
56 seq_puts(seq, ",errors=continue");
57 - if (test_opt(sb, ERRORS_PANIC))
58 + if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC)
59 seq_puts(seq, ",errors=panic");
60 - if (test_opt(sb, NO_UID32))
61 + if (test_opt(sb, NO_UID32) && !(def_mount_opts & EXT4_DEFM_UID16))
62 seq_puts(seq, ",nouid32");
63 - if (test_opt(sb, DEBUG))
64 + if (test_opt(sb, DEBUG) && !(def_mount_opts & EXT4_DEFM_DEBUG))
65 seq_puts(seq, ",debug");
66 if (test_opt(sb, OLDALLOC))
67 seq_puts(seq, ",oldalloc");
68 #ifdef CONFIG_EXT4DEV_FS_XATTR
69 - if (test_opt(sb, XATTR_USER))
70 + if (test_opt(sb, XATTR_USER) &&
71 + !(def_mount_opts & EXT4_DEFM_XATTR_USER))
72 seq_puts(seq, ",user_xattr");
73 if (!test_opt(sb, XATTR_USER) &&
74 (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
75 @@ -715,7 +716,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
77 #endif
78 #ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
79 - if (test_opt(sb, POSIX_ACL))
80 + if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL))
81 seq_puts(seq, ",acl");
82 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
83 seq_puts(seq, ",noacl");
84 @@ -735,6 +736,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
85 if (test_opt(sb, I_VERSION))
86 seq_puts(seq, ",i_version");
88 + /*
89 + * journal mode get enabled in different ways
90 + * So just print the value even if we didn't specify it
91 + */
92 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
93 seq_puts(seq, ",data=journal");
94 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
95 @@ -743,7 +748,6 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
96 seq_puts(seq, ",data=writeback");
98 ext4_show_quota_options(seq, sb);
100 return 0;