Commit 73422811 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Al Viro

reiserfs: allow exposing privroot w/ xattrs enabled

This patch adds an -oexpose_privroot option to allow access to the privroot.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a525890c
...@@ -44,13 +44,11 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, ...@@ -44,13 +44,11 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
static inline bool is_privroot_deh(struct dentry *dir, static inline bool is_privroot_deh(struct dentry *dir,
struct reiserfs_de_head *deh) struct reiserfs_de_head *deh)
{ {
int ret = 0;
#ifdef CONFIG_REISERFS_FS_XATTR
struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root; struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
ret = (dir == dir->d_parent && privroot->d_inode && 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); deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
#endif
return ret;
} }
int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
......
...@@ -898,6 +898,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin ...@@ -898,6 +898,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
{"conv",.setmask = 1 << REISERFS_CONVERT}, {"conv",.setmask = 1 << REISERFS_CONVERT},
{"attrs",.setmask = 1 << REISERFS_ATTRS}, {"attrs",.setmask = 1 << REISERFS_ATTRS},
{"noattrs",.clrmask = 1 << REISERFS_ATTRS}, {"noattrs",.clrmask = 1 << REISERFS_ATTRS},
{"expose_privroot", .setmask = 1 << REISERFS_EXPOSE_PRIVROOT},
#ifdef CONFIG_REISERFS_FS_XATTR #ifdef CONFIG_REISERFS_FS_XATTR
{"user_xattr",.setmask = 1 << REISERFS_XATTRS_USER}, {"user_xattr",.setmask = 1 << REISERFS_XATTRS_USER},
{"nouser_xattr",.clrmask = 1 << REISERFS_XATTRS_USER}, {"nouser_xattr",.clrmask = 1 << REISERFS_XATTRS_USER},
......
...@@ -981,6 +981,7 @@ int reiserfs_lookup_privroot(struct super_block *s) ...@@ -981,6 +981,7 @@ int reiserfs_lookup_privroot(struct super_block *s)
strlen(PRIVROOT_NAME)); strlen(PRIVROOT_NAME));
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
REISERFS_SB(s)->priv_root = dentry; REISERFS_SB(s)->priv_root = dentry;
if (!reiserfs_expose_privroot(s))
s->s_root->d_op = &xattr_lookup_poison_ops; s->s_root->d_op = &xattr_lookup_poison_ops;
if (dentry->d_inode) if (dentry->d_inode)
dentry->d_inode->i_flags |= S_PRIVATE; dentry->d_inode->i_flags |= S_PRIVATE;
......
...@@ -453,6 +453,7 @@ enum reiserfs_mount_options { ...@@ -453,6 +453,7 @@ enum reiserfs_mount_options {
REISERFS_ATTRS, REISERFS_ATTRS,
REISERFS_XATTRS_USER, REISERFS_XATTRS_USER,
REISERFS_POSIXACL, REISERFS_POSIXACL,
REISERFS_EXPOSE_PRIVROOT,
REISERFS_BARRIER_NONE, REISERFS_BARRIER_NONE,
REISERFS_BARRIER_FLUSH, REISERFS_BARRIER_FLUSH,
...@@ -490,6 +491,7 @@ enum reiserfs_mount_options { ...@@ -490,6 +491,7 @@ enum reiserfs_mount_options {
#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) #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))
#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) #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_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)) #define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment