reiserfs: make extended attributes support more configurable
PATCH 1/3 reiserfs: make extended attributes support more configurable
From: Eugene Kapun <[email protected]>
Adds configuration options which control how reiserfs supports extended attributes. This makes support for POSIX ACLs and security labels independent on support for normal xattrs. This also makes possible to compile reiserfs without any xattrs support.
---
This patch applies to linux-2.6.31-rc2-git4.
This patch may be useful since there are currently no means to fix some problems which prevent reiserfs from being mounted and therefore can't be solved by expose_privroot.
fs/reiserfs/Kconfig | 14 ++++++-- fs/reiserfs/Makefile | 6 ++- fs/reiserfs/dir.c | 4 ++ fs/reiserfs/super.c | 8 ++++ fs/reiserfs/xattr.c | 48 +++++++++++++++------------- include/linux/reiserfs_fs_i.h | 8 ++++ include/linux/reiserfs_fs_sb.h | 20 ++++++++++- include/linux/reiserfs_xattr.h | 53 ++++++++++++++++++++++--------- 8 files changed, 118 insertions(+), 43 deletions(-)
fs/reiserfs/dir.c +4 -0
@@ -44,11 +44,15 @@ static int reiserfs_dir_fsync(struct filstatic inline bool is_privroot_deh (struct dentry *dir,struct reiserfs_de_head *deh) { +#ifdef CONFIG_REISERFS_FS_EXTENDED struct dentry *privroot =REISERFS_SB (dir->d_sb)->priv_root;if (reiserfs_expose_privroot (dir->d_sb))return 0 ;return (dir == dir->d_parent && privroot->d_inode && deh->deh_objectid ==INODE_PKEY (privroot->d_inode)->k_objectid); +#else +return 0 ; +#endif } int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
fs/reiserfs/Kconfig +11 -3
@@ -50,9 +50,17 @@ config REISERFS_PROC_INFO Almost everyone but ReiserFS developers and people fine-tuning reiserfs or tracing problems should say N. +config REISERFS_FS_EXTENDED + bool "ReiserFS extended metadata" + depends on REISERFS_FS + help + Allows ReiserFS to reserve a special directory for storage of + extended attributes, POSIX ACLs and/or security labels. If you + don't need any of these, say N. + config REISERFS_FS_XATTR bool "ReiserFS extended attributes" - depends on REISERFS_FS + depends on REISERFS_FS_EXTENDED help Extended attributes are name:value pairs associated with inodes by the kernel or by users (see the attr(5) manual page, or visit
@@ -62,7 +70,7 @@ config REISERFS_FS_XATTR config REISERFS_FS_POSIX_ACL bool "ReiserFS POSIX Access Control Lists" - depends on REISERFS_FS_XATTR + depends on REISERFS_FS_EXTENDED select FS_POSIX_ACL help Posix Access Control Lists (ACLs) support permissions for users and
@@ -75,7 +83,7 @@ config REISERFS_FS_POSIX_ACL config REISERFS_FS_SECURITY bool "ReiserFS Security Labels" - depends on REISERFS_FS_XATTR + depends on REISERFS_FS_EXTENDED help Security labels support alternative access control models implemented by security modules like SELinux. This option
fs/reiserfs/Makefile +5 -1
@@ -7,7 +7,11 @@ obj-$(CONFIG_REISERFS_FS) += reiserfs.o reiserfs-objs := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o \ super.o prints.o objectid.o lbalance.o ibalance.o stree.o \ hashes.o tail_conversion.o journal.o resize.o \ - item_ops.o ioctl.o procfs.o xattr.o + item_ops.o ioctl.o procfs.o + +ifeq ($(CONFIG_REISERFS_FS_EXTENDED),y) +reiserfs-objs += xattr.o +endif ifeq ($(CONFIG_REISERFS_FS_XATTR),y) reiserfs-objs += xattr_user.o xattr_trusted.o
fs/reiserfs/super.c +8 -0
@@ -444,6 +444,7 @@ int remove_save_link(struct inode *inodestatic void reiserfs_kill_sb (struct super_block *s) { +#ifdef CONFIG_REISERFS_FS_EXTENDED if (REISERFS_SB (s)) {if (REISERFS_SB (s)->xattr_root) {d_invalidate (REISERFS_SB (s)->xattr_root);
@@ -456,6 +457,7 @@ static void reiserfs_kill_sb(struct supe REISERFS_SB(s)->priv_root = NULL; } } +#endif kill_block_super (s); }
@@ -876,7 +878,9 @@ static int reiserfs_parse_options(struct {"conv",.setmask = 1 << REISERFS_CONVERT}, {"attrs",.setmask = 1 << REISERFS_ATTRS}, {"noattrs",.clrmask = 1 << REISERFS_ATTRS}, +#ifdef CONFIG_REISERFS_FS_EXTENDED {"expose_privroot", .setmask = 1 << REISERFS_EXPOSE_PRIVROOT}, +#endif #ifdef CONFIG_REISERFS_FS_XATTR {"user_xattr",.setmask = 1 << REISERFS_XATTRS_USER}, {"nouser_xattr",.clrmask = 1 << REISERFS_XATTRS_USER},
@@ -1200,8 +1204,12 @@ static int reiserfs_remount(struct super safe_mask |=1 <<REISERFS_HASHED_RELOCATION ; safe_mask |=1 <<REISERFS_TEST4 ; safe_mask |=1 <<REISERFS_ATTRS ; +#ifdef CONFIG_REISERFS_FS_XATTR safe_mask |=1 <<REISERFS_XATTRS_USER ; +#endif +#ifdef CONFIG_REISERFS_FS_POSIX_ACL safe_mask |=1 <<REISERFS_POSIXACL ; +#endif safe_mask |=1 <<REISERFS_BARRIER_FLUSH ; safe_mask |=1 <<REISERFS_BARRIER_NONE ; safe_mask |=1 <<REISERFS_ERROR_RO ;
fs/reiserfs/xattr.c +27 -21
86 lines not on this page · raw message
include/linux/reiserfs_fs_i.h +7 -1
@@ -3,6 +3,12 @@#include <linux/list.h> +#if defined(CONFIG_REISERFS_FS_XATTR ) || \ + defined(CONFIG_REISERFS_FS_POSIX_ACL ) || \ + defined(CONFIG_REISERFS_FS_SECURITY ) +#define CONFIG_REISERFS_FS_ANY_XATTR +#endif +struct reiserfs_journal_list ;/** bitmasks for i_flags field in reiserfs-specific part of inode */
@@ -54,7 +60,7 @@ struct reiserfs_inode_info {unsigned int i_trans_id;struct reiserfs_journal_list *i_jl;struct mutex i_mmap; -#ifdef CONFIG_REISERFS_FS_XATTR +#ifdef CONFIG_REISERFS_FS_ANY_XATTR struct rw_semaphore i_xattr_sem;#endif struct inode vfs_inode;
include/linux/reiserfs_fs_sb.h +18 -2
@@ -401,8 +401,10 @@ struct reiserfs_sb_info {struct proc_dir_entry *procdir;int reserved_blocks;/* amount of blocks reserved for further allocations */ spinlock_t bitmap_lock;/* this lock on now only used to protect reserved_blocks variable */ +#ifdef CONFIG_REISERFS_FS_EXTENDED struct dentry *priv_root;/* root of /.reiserfs_priv */ struct dentry *xattr_root;/* root of /.reiserfs_priv/xattrs */ +#endif int j_errno;#ifdef CONFIG_QUOTA char *s_qf_names[MAXQUOTAS ];
@@ -451,9 +453,15 @@ enum reiserfs_mount_options {REISERFS_NO_UNHASHED_RELOCATION ,REISERFS_HASHED_RELOCATION ,REISERFS_ATTRS , +#ifdef CONFIG_REISERFS_FS_EXTENDED +REISERFS_EXPOSE_PRIVROOT , +#endif +#ifdef CONFIG_REISERFS_FS_XATTRREISERFS_XATTRS_USER , +#endif +#ifdef CONFIG_REISERFS_FS_POSIX_ACLREISERFS_POSIXACL , -REISERFS_EXPOSE_PRIVROOT , +#endifREISERFS_BARRIER_NONE , REISERFS_BARRIER_FLUSH,
@@ -489,9 +497,17 @@ enum reiserfs_mount_options {#define reiserfs_data_log (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))#define reiserfs_data_ordered (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))#define reiserfs_data_writeback (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) +#define reiserfs_expose_privroot (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT)) +#ifdef CONFIG_REISERFS_FS_XATTR #define reiserfs_xattrs_user (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) +#else +#define reiserfs_xattrs_user (s) 0 +#endif +#ifdef CONFIG_REISERFS_FS_POSIX_ACL #define reiserfs_posixacl (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) -#define reiserfs_expose_privroot (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT)) +#else +#define reiserfs_posixacl (s) 0 +#endif #define reiserfs_xattrs_optional (s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))#define reiserfs_barrier_none (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE))#define reiserfs_barrier_flush (s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH))
include/linux/reiserfs_xattr.h +38 -15
79 lines not on this page · raw message
Quoted 6 lines · Eugene Kapun
From: Eugene Kapun <[email protected]>
Adds configuration options which control how reiserfs supports extended attributes. This makes support for POSIX ACLs and security labels independent on support for normal xattrs. This also makes possible to compile reiserfs without any xattrs support.
There's absoutely no reason for adding even more horrible ifdef churn.