]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Tiger Yang <tiger.yang@oracle.com> |
2 | Date: Fri, 14 Nov 2008 11:17:52 +0800 | |
3 | Subject: ocfs2: add mount option and Kconfig option for acl | |
4 | Patch-mainline: 2.6.29 | |
5 | ||
6 | This patch adds the Kconfig option "CONFIG_OCFS2_FS_POSIX_ACL" | |
7 | and mount options "acl" to enable acls in Ocfs2. | |
8 | ||
9 | Signed-off-by: Tiger Yang <tiger.yang@oracle.com> | |
10 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
11 | --- | |
12 | fs/ocfs2/super.c | 33 +++++++++++++++++++++++++++++++++ | |
13 | 1 files changed, 33 insertions(+), 0 deletions(-) | |
14 | ||
15 | diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c | |
16 | index 304b63a..9e7accc 100644 | |
17 | --- a/fs/ocfs2/super.c | |
18 | +++ b/fs/ocfs2/super.c | |
19 | @@ -158,6 +158,8 @@ enum { | |
20 | Opt_user_xattr, | |
21 | Opt_nouser_xattr, | |
22 | Opt_inode64, | |
23 | + Opt_acl, | |
24 | + Opt_noacl, | |
25 | Opt_err, | |
26 | }; | |
27 | ||
28 | @@ -180,6 +182,8 @@ static const match_table_t tokens = { | |
29 | {Opt_user_xattr, "user_xattr"}, | |
30 | {Opt_nouser_xattr, "nouser_xattr"}, | |
31 | {Opt_inode64, "inode64"}, | |
32 | + {Opt_acl, "acl"}, | |
33 | + {Opt_noacl, "noacl"}, | |
34 | {Opt_err, NULL} | |
35 | }; | |
36 | ||
37 | @@ -466,6 +470,8 @@ unlock_osb: | |
38 | if (!ret) { | |
39 | /* Only save off the new mount options in case of a successful | |
40 | * remount. */ | |
41 | + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | |
42 | + parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
43 | osb->s_mount_opt = parsed_options.mount_opt; | |
44 | osb->s_atime_quantum = parsed_options.atime_quantum; | |
45 | osb->preferred_slot = parsed_options.slot; | |
46 | @@ -651,6 +657,10 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |
47 | } | |
48 | brelse(bh); | |
49 | bh = NULL; | |
50 | + | |
51 | + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | |
52 | + parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
53 | + | |
54 | osb->s_mount_opt = parsed_options.mount_opt; | |
55 | osb->s_atime_quantum = parsed_options.atime_quantum; | |
56 | osb->preferred_slot = parsed_options.slot; | |
57 | @@ -664,6 +674,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |
58 | ||
59 | sb->s_magic = OCFS2_SUPER_MAGIC; | |
60 | ||
61 | + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | |
62 | + ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | |
63 | + | |
64 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, | |
65 | * heartbeat=none */ | |
66 | if (bdev_read_only(sb->s_bdev)) { | |
67 | @@ -945,6 +958,19 @@ static int ocfs2_parse_options(struct super_block *sb, | |
68 | case Opt_inode64: | |
69 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; | |
70 | break; | |
71 | +#ifdef CONFIG_OCFS2_FS_POSIX_ACL | |
72 | + case Opt_acl: | |
73 | + mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL; | |
74 | + break; | |
75 | + case Opt_noacl: | |
76 | + mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
77 | + break; | |
78 | +#else | |
79 | + case Opt_acl: | |
80 | + case Opt_noacl: | |
81 | + printk(KERN_INFO "ocfs2 (no)acl options not supported\n"); | |
82 | + break; | |
83 | +#endif | |
84 | default: | |
85 | mlog(ML_ERROR, | |
86 | "Unrecognized mount option \"%s\" " | |
87 | @@ -1017,6 +1043,13 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |
88 | if (opts & OCFS2_MOUNT_INODE64) | |
89 | seq_printf(s, ",inode64"); | |
90 | ||
91 | +#ifdef CONFIG_OCFS2_FS_POSIX_ACL | |
92 | + if (opts & OCFS2_MOUNT_POSIX_ACL) | |
93 | + seq_printf(s, ",acl"); | |
94 | + else | |
95 | + seq_printf(s, ",noacl"); | |
96 | +#endif | |
97 | + | |
98 | return 0; | |
99 | } | |
100 | ||
101 | -- | |
102 | 1.5.6 | |
103 |