Commit a68979b857283daf4acc405e476dcc8812a3ff2b
Committed by
Mark Fasheh
1 parent
89c38bd0ad
Exists in
master
and in
4 other branches
ocfs2: add mount option and Kconfig option for acl
This patch adds the Kconfig option "CONFIG_OCFS2_FS_POSIX_ACL" and mount options "acl" to enable acls in Ocfs2. Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Showing 3 changed files with 44 additions and 1 deletions Side-by-side Diff
Documentation/filesystems/ocfs2.txt
... | ... | @@ -31,7 +31,6 @@ |
31 | 31 | - quotas |
32 | 32 | - Directory change notification (F_NOTIFY) |
33 | 33 | - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) |
34 | - - POSIX ACLs | |
35 | 34 | |
36 | 35 | Mount options |
37 | 36 | ============= |
... | ... | @@ -79,4 +78,6 @@ |
79 | 78 | bits of significance. |
80 | 79 | user_xattr (*) Enables Extended User Attributes. |
81 | 80 | nouser_xattr Disables Extended User Attributes. |
81 | +acl Enables POSIX Access Control Lists support. | |
82 | +noacl (*) Disables POSIX Access Control Lists support. |
fs/Kconfig
... | ... | @@ -268,6 +268,15 @@ |
268 | 268 | is backwards compatible with JBD. It is safe to say N here. |
269 | 269 | However, if you really want to use the original JBD, say Y here. |
270 | 270 | |
271 | +config OCFS2_FS_POSIX_ACL | |
272 | + bool "OCFS2 POSIX Access Control Lists" | |
273 | + depends on OCFS2_FS | |
274 | + select FS_POSIX_ACL | |
275 | + default n | |
276 | + help | |
277 | + Posix Access Control Lists (ACLs) support permissions for users and | |
278 | + groups beyond the owner/group/world scheme. | |
279 | + | |
271 | 280 | endif # BLOCK |
272 | 281 | |
273 | 282 | source "fs/notify/Kconfig" |
fs/ocfs2/super.c
... | ... | @@ -158,6 +158,8 @@ |
158 | 158 | Opt_user_xattr, |
159 | 159 | Opt_nouser_xattr, |
160 | 160 | Opt_inode64, |
161 | + Opt_acl, | |
162 | + Opt_noacl, | |
161 | 163 | Opt_err, |
162 | 164 | }; |
163 | 165 | |
... | ... | @@ -180,6 +182,8 @@ |
180 | 182 | {Opt_user_xattr, "user_xattr"}, |
181 | 183 | {Opt_nouser_xattr, "nouser_xattr"}, |
182 | 184 | {Opt_inode64, "inode64"}, |
185 | + {Opt_acl, "acl"}, | |
186 | + {Opt_noacl, "noacl"}, | |
183 | 187 | {Opt_err, NULL} |
184 | 188 | }; |
185 | 189 | |
... | ... | @@ -466,6 +470,8 @@ |
466 | 470 | if (!ret) { |
467 | 471 | /* Only save off the new mount options in case of a successful |
468 | 472 | * remount. */ |
473 | + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | |
474 | + parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
469 | 475 | osb->s_mount_opt = parsed_options.mount_opt; |
470 | 476 | osb->s_atime_quantum = parsed_options.atime_quantum; |
471 | 477 | osb->preferred_slot = parsed_options.slot; |
... | ... | @@ -651,6 +657,10 @@ |
651 | 657 | } |
652 | 658 | brelse(bh); |
653 | 659 | bh = NULL; |
660 | + | |
661 | + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | |
662 | + parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
663 | + | |
654 | 664 | osb->s_mount_opt = parsed_options.mount_opt; |
655 | 665 | osb->s_atime_quantum = parsed_options.atime_quantum; |
656 | 666 | osb->preferred_slot = parsed_options.slot; |
... | ... | @@ -664,6 +674,9 @@ |
664 | 674 | |
665 | 675 | sb->s_magic = OCFS2_SUPER_MAGIC; |
666 | 676 | |
677 | + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | |
678 | + ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | |
679 | + | |
667 | 680 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, |
668 | 681 | * heartbeat=none */ |
669 | 682 | if (bdev_read_only(sb->s_bdev)) { |
... | ... | @@ -945,6 +958,19 @@ |
945 | 958 | case Opt_inode64: |
946 | 959 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; |
947 | 960 | break; |
961 | +#ifdef CONFIG_OCFS2_FS_POSIX_ACL | |
962 | + case Opt_acl: | |
963 | + mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL; | |
964 | + break; | |
965 | + case Opt_noacl: | |
966 | + mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | |
967 | + break; | |
968 | +#else | |
969 | + case Opt_acl: | |
970 | + case Opt_noacl: | |
971 | + printk(KERN_INFO "ocfs2 (no)acl options not supported\n"); | |
972 | + break; | |
973 | +#endif | |
948 | 974 | default: |
949 | 975 | mlog(ML_ERROR, |
950 | 976 | "Unrecognized mount option \"%s\" " |
... | ... | @@ -1016,6 +1042,13 @@ |
1016 | 1042 | |
1017 | 1043 | if (opts & OCFS2_MOUNT_INODE64) |
1018 | 1044 | seq_printf(s, ",inode64"); |
1045 | + | |
1046 | +#ifdef CONFIG_OCFS2_FS_POSIX_ACL | |
1047 | + if (opts & OCFS2_MOUNT_POSIX_ACL) | |
1048 | + seq_printf(s, ",acl"); | |
1049 | + else | |
1050 | + seq_printf(s, ",noacl"); | |
1051 | +#endif | |
1019 | 1052 | |
1020 | 1053 | return 0; |
1021 | 1054 | } |