reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/3] reiserfs xattr fixups
@ 2009-05-05 19:30 Jeff Mahoney
  2009-05-05 19:30 ` [patch 1/3] reiserfs: fixup xattr_root caching Jeff Mahoney
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jeff Mahoney @ 2009-05-05 19:30 UTC (permalink / raw)
  To: ReiserFS Devel, Andrew Morton, LKML; +Cc: Al Viron

 This series consists of three patches:

 1) rework the bit of locking after Al's privroot lookup patch
 2) Fix up security xattrs so they don't apply to other xattrs
 3) Clean up the privroot hiding since we now cache the privroot early

 -Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 1/3] reiserfs: fixup xattr_root caching
  2009-05-05 19:30 [patch 0/3] reiserfs xattr fixups Jeff Mahoney
@ 2009-05-05 19:30 ` Jeff Mahoney
  2009-05-05 19:30 ` [patch 2/3] reiserfs: dont associate security.* with xattr files Jeff Mahoney
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Jeff Mahoney @ 2009-05-05 19:30 UTC (permalink / raw)
  To: ReiserFS Devel, Andrew Morton, LKML; +Cc: Al Viron

[-- Attachment #1: reiserfs-fixup-caching --]
[-- Type: text/plain, Size: 5352 bytes --]

 The xattr_root caching was broken from my previous patch set. It wouldn't
 cause corruption, but could cause decreased performance due to allocating
 a larger chunk of the journal (~ 27 blocks) than it would actually use.

 This patch loads the xattr root dentry at xattr initialization and creates
 it on-demand. Since we're using the cached dentry, there's no point
 in keeping lookup_or_create_dir around, so that's removed.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/xattr.c            |   73 +++++++++++++++++++++++++----------------
 include/linux/reiserfs_fs_sb.h |    2 -
 include/linux/reiserfs_xattr.h |    2 -
 3 files changed, 48 insertions(+), 29 deletions(-)

--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -113,36 +113,28 @@ static int xattr_rmdir(struct inode *dir
 
 #define xattr_may_create(flags)	(!flags || flags & XATTR_CREATE)
 
-/* Returns and possibly creates the xattr dir. */
-static struct dentry *lookup_or_create_dir(struct dentry *parent,
-					    const char *name, int flags)
+static struct dentry *open_xa_root(struct super_block *sb, int flags)
 {
-	struct dentry *dentry;
-	BUG_ON(!parent);
+	struct dentry *privroot = REISERFS_SB(sb)->priv_root;
+	struct dentry *xaroot;
+	if (!privroot->d_inode)
+		return ERR_PTR(-ENODATA);
 
-	mutex_lock_nested(&parent->d_inode->i_mutex, I_MUTEX_XATTR);
-	dentry = lookup_one_len(name, parent, strlen(name));
-	if (!IS_ERR(dentry) && !dentry->d_inode) {
-		int err = -ENODATA;
+	mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR);
 
+	xaroot = dget(REISERFS_SB(sb)->xattr_root);
+	if (!xaroot->d_inode) {
+		int err = -ENODATA;
 		if (xattr_may_create(flags))
-			err = xattr_mkdir(parent->d_inode, dentry, 0700);
-
+			err = xattr_mkdir(privroot->d_inode, xaroot, 0700);
 		if (err) {
-			dput(dentry);
-			dentry = ERR_PTR(err);
+			dput(xaroot);
+			xaroot = ERR_PTR(err);
 		}
 	}
-	mutex_unlock(&parent->d_inode->i_mutex);
-	return dentry;
-}
 
-static struct dentry *open_xa_root(struct super_block *sb, int flags)
-{
-	struct dentry *privroot = REISERFS_SB(sb)->priv_root;
-	if (!privroot)
-		return ERR_PTR(-ENODATA);
-	return lookup_or_create_dir(privroot, XAROOT_NAME, flags);
+	mutex_unlock(&privroot->d_inode->i_mutex);
+	return xaroot;
 }
 
 static struct dentry *open_xa_dir(const struct inode *inode, int flags)
@@ -158,10 +150,22 @@ static struct dentry *open_xa_dir(const
 		 le32_to_cpu(INODE_PKEY(inode)->k_objectid),
 		 inode->i_generation);
 
-	xadir = lookup_or_create_dir(xaroot, namebuf, flags);
+	mutex_lock_nested(&xaroot->d_inode->i_mutex, I_MUTEX_XATTR);
+
+	xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf));
+	if (!IS_ERR(xadir) && !xadir->d_inode) {
+		int err = -ENODATA;
+		if (xattr_may_create(flags))
+			err = xattr_mkdir(xaroot->d_inode, xadir, 0700);
+		if (err) {
+			dput(xadir);
+			xadir = ERR_PTR(err);
+		}
+	}
+
+	mutex_unlock(&xaroot->d_inode->i_mutex);
 	dput(xaroot);
 	return xadir;
-
 }
 
 /* The following are side effects of other operations that aren't explicitly
@@ -986,19 +990,33 @@ int reiserfs_lookup_privroot(struct supe
 int reiserfs_xattr_init(struct super_block *s, int mount_flags)
 {
 	int err = 0;
+	struct dentry *privroot = REISERFS_SB(s)->priv_root;
 
 #ifdef CONFIG_REISERFS_FS_XATTR
 	err = xattr_mount_check(s);
 	if (err)
 		goto error;

-	if (!REISERFS_SB(s)->priv_root->d_inode && !(mount_flags & MS_RDONLY)) {
+	if (!privroot->d_inode && !(mount_flags & MS_RDONLY)) {
 		mutex_lock(&s->s_root->d_inode->i_mutex);
 		err = create_privroot(REISERFS_SB(s)->priv_root);
 		mutex_unlock(&s->s_root->d_inode->i_mutex);
 	}
-	if (!err)
+
+	if (privroot->d_inode) {
 		s->s_xattr = reiserfs_xattr_handlers;
+		mutex_lock(&privroot->d_inode->i_mutex);
+		if (!REISERFS_SB(s)->xattr_root) {
+			struct dentry *dentry;
+			dentry = lookup_one_len(XAROOT_NAME, privroot,
+						strlen(XAROOT_NAME));
+			if (!IS_ERR(dentry))
+				REISERFS_SB(s)->xattr_root = dentry;
+			else
+				err = PTR_ERR(dentry);
+		}
+		mutex_unlock(&privroot->d_inode->i_mutex);
+	}
 
 error:
 	if (err) {
@@ -1008,11 +1026,12 @@ error:
 #endif
 
 	/* The super_block MS_POSIXACL must mirror the (no)acl mount option. */
-	s->s_flags = s->s_flags & ~MS_POSIXACL;
 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
 	if (reiserfs_posixacl(s))
 		s->s_flags |= MS_POSIXACL;
+	else
 #endif
+		s->s_flags &= ~MS_POSIXACL;
 
 	return err;
 }
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -402,7 +402,7 @@ struct reiserfs_sb_info {
 	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 */
 	struct dentry *priv_root;	/* root of /.reiserfs_priv */
-	struct dentry *xattr_root;	/* root of /.reiserfs_priv/.xa */
+	struct dentry *xattr_root;	/* root of /.reiserfs_priv/xattrs */
 	int j_errno;
 #ifdef CONFIG_QUOTA
 	char *s_qf_names[MAXQUOTAS];
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -98,7 +98,7 @@ static inline size_t reiserfs_xattr_jcre
 
 	if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
 		nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
-		if (REISERFS_SB(inode->i_sb)->xattr_root == NULL)
+		if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode)
 			nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
 	}
 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 2/3] reiserfs: dont associate security.* with xattr files
  2009-05-05 19:30 [patch 0/3] reiserfs xattr fixups Jeff Mahoney
  2009-05-05 19:30 ` [patch 1/3] reiserfs: fixup xattr_root caching Jeff Mahoney
@ 2009-05-05 19:30 ` Jeff Mahoney
  2009-05-05 19:30 ` [patch 3/3] reiserfs: remove privroot hiding in lookup Jeff Mahoney
  2009-05-05 20:13 ` [patch 0/3] reiserfs xattr fixups Al Viro
  3 siblings, 0 replies; 8+ messages in thread
From: Jeff Mahoney @ 2009-05-05 19:30 UTC (permalink / raw)
  To: ReiserFS Devel, Andrew Morton, LKML; +Cc: Al Viron

[-- Attachment #1: reiserfs-fixup-security --]
[-- Type: text/plain, Size: 834 bytes --]

 The security.* xattrs are ignored for xattr files, so don't create them.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---

 fs/reiserfs/xattr_security.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -55,8 +55,16 @@ int reiserfs_security_init(struct inode
 			   struct reiserfs_security_handle *sec)
 {
 	int blocks = 0;
-	int error = security_inode_init_security(inode, dir, &sec->name,
-						 &sec->value, &sec->length);
+	int error;
+
+	sec->name = NULL;
+
+	/* Don't add selinux attributes on xattrs - they'll never get used */
+	if (IS_PRIVATE(dir))
+		return 0;
+
+	error = security_inode_init_security(inode, dir, &sec->name,
+					     &sec->value, &sec->length);
 	if (error) {
 		if (error == -EOPNOTSUPP)
 			error = 0;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 3/3] reiserfs: remove privroot hiding in lookup
  2009-05-05 19:30 [patch 0/3] reiserfs xattr fixups Jeff Mahoney
  2009-05-05 19:30 ` [patch 1/3] reiserfs: fixup xattr_root caching Jeff Mahoney
  2009-05-05 19:30 ` [patch 2/3] reiserfs: dont associate security.* with xattr files Jeff Mahoney
@ 2009-05-05 19:30 ` Jeff Mahoney
  2010-04-02 15:22   ` Edward Shishkin
  2009-05-05 20:13 ` [patch 0/3] reiserfs xattr fixups Al Viro
  3 siblings, 1 reply; 8+ messages in thread
From: Jeff Mahoney @ 2009-05-05 19:30 UTC (permalink / raw)
  To: ReiserFS Devel, Andrew Morton, LKML; +Cc: Al Viron

[-- Attachment #1: reiserfs-skip-privroot-hiding --]
[-- Type: text/plain, Size: 3732 bytes --]

 With Al Viro's patch to move privroot lookup to fs mount, there's no need
 to have special code to hide the privroot in reiserfs_lookup.

 I've also cleaned up the privroot hiding in reiserfs_readdir_dentry and
 removed the last user of reiserfs_xattrs().

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/dir.c              |   24 +++++++++++++-----------
 fs/reiserfs/namei.c            |   17 ++---------------
 fs/reiserfs/xattr.c            |    2 +-
 include/linux/reiserfs_fs_sb.h |    1 -
 4 files changed, 16 insertions(+), 28 deletions(-)

--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -41,6 +41,18 @@ static int reiserfs_dir_fsync(struct fil
 
 #define store_ih(where,what) copy_item_head (where, what)
 
+static inline bool is_privroot_deh(struct dentry *dir,
+				   struct reiserfs_de_head *deh)
+{
+	int ret = 0;
+#ifdef CONFIG_REISERFS_FS_XATTR
+	struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
+	ret = (dir == dir->d_parent && privroot->d_inode &&
+	       deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
+#endif
+	return ret;
+}
+
 int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
 			   filldir_t filldir, loff_t *pos)
 {
@@ -138,18 +150,8 @@ int reiserfs_readdir_dentry(struct dentr
 				}
 
 				/* Ignore the .reiserfs_priv entry */
-				if (reiserfs_xattrs(inode->i_sb) &&
-				    !old_format_only(inode->i_sb) &&
-				    dentry == inode->i_sb->s_root &&
-				    REISERFS_SB(inode->i_sb)->priv_root &&
-				    REISERFS_SB(inode->i_sb)->priv_root->d_inode
-				    && deh_objectid(deh) ==
-				    le32_to_cpu(INODE_PKEY
-						(REISERFS_SB(inode->i_sb)->
-						 priv_root->d_inode)->
-						k_objectid)) {
+				if (is_privroot_deh(dentry, deh))
 					continue;
-				}
 
 				d_off = deh_offset(deh);
 				*pos = d_off;
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -338,21 +338,8 @@ static struct dentry *reiserfs_lookup(st
 				&path_to_entry, &de);
 	pathrelse(&path_to_entry);
 	if (retval == NAME_FOUND) {
-		/* Hide the .reiserfs_priv directory */
-		if (reiserfs_xattrs(dir->i_sb) &&
-		    !old_format_only(dir->i_sb) &&
-		    REISERFS_SB(dir->i_sb)->priv_root &&
-		    REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
-		    de.de_objectid ==
-		    le32_to_cpu(INODE_PKEY
-				(REISERFS_SB(dir->i_sb)->priv_root->d_inode)->
-				k_objectid)) {
-			reiserfs_write_unlock(dir->i_sb);
-			return ERR_PTR(-EACCES);
-		}
-
-		inode =
-		    reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
+		inode = reiserfs_iget(dir->i_sb,
+				      (struct cpu_key *)&(de.de_dir_id));
 		if (!inode || IS_ERR(inode)) {
 			reiserfs_write_unlock(dir->i_sb);
 			return ERR_PTR(-EACCES);
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -841,7 +841,7 @@ ssize_t reiserfs_listxattr(struct dentry
 	if (!dentry->d_inode)
 		return -EINVAL;
 
-	if (!reiserfs_xattrs(dentry->d_sb) ||
+	if (!dentry->d_sb->s_xattr ||
 	    get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
 		return -EOPNOTSUPP;
 
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -488,7 +488,6 @@ 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_xattrs(s) ((s)->s_xattr != NULL)
 #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_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 0/3] reiserfs xattr fixups
  2009-05-05 19:30 [patch 0/3] reiserfs xattr fixups Jeff Mahoney
                   ` (2 preceding siblings ...)
  2009-05-05 19:30 ` [patch 3/3] reiserfs: remove privroot hiding in lookup Jeff Mahoney
@ 2009-05-05 20:13 ` Al Viro
  2009-05-05 20:14   ` Jeff Mahoney
  3 siblings, 1 reply; 8+ messages in thread
From: Al Viro @ 2009-05-05 20:13 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Devel, Andrew Morton, LKML

On Tue, May 05, 2009 at 03:30:14PM -0400, Jeff Mahoney wrote:
>  This series consists of three patches:
> 
>  1) rework the bit of locking after Al's privroot lookup patch
>  2) Fix up security xattrs so they don't apply to other xattrs
>  3) Clean up the privroot hiding since we now cache the privroot early

Applied and pushed to for-next

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 0/3] reiserfs xattr fixups
  2009-05-05 20:13 ` [patch 0/3] reiserfs xattr fixups Al Viro
@ 2009-05-05 20:14   ` Jeff Mahoney
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Mahoney @ 2009-05-05 20:14 UTC (permalink / raw)
  To: Al Viro; +Cc: ReiserFS Devel, Andrew Morton, LKML

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Al Viro wrote:
> On Tue, May 05, 2009 at 03:30:14PM -0400, Jeff Mahoney wrote:
>>  This series consists of three patches:
>>
>>  1) rework the bit of locking after Al's privroot lookup patch
>>  2) Fix up security xattrs so they don't apply to other xattrs
>>  3) Clean up the privroot hiding since we now cache the privroot early
> 
> Applied and pushed to for-next

Thanks.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkoAnjQACgkQLPWxlyuTD7L6/gCfWy7fkY4B9wHyGmQZm4oZB0AG
udwAoI9+kobU+lNPPmBhJRXZ/F9ffSyQ
=EUQL
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 3/3] reiserfs: remove privroot hiding in lookup
  2009-05-05 19:30 ` [patch 3/3] reiserfs: remove privroot hiding in lookup Jeff Mahoney
@ 2010-04-02 15:22   ` Edward Shishkin
  2010-04-06 17:54     ` Jeff Mahoney
  0 siblings, 1 reply; 8+ messages in thread
From: Edward Shishkin @ 2010-04-02 15:22 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: ReiserFS Devel, Andrew Morton, LKML, Al Viro

Jeff Mahoney wrote:
>  With Al Viro's patch to move privroot lookup to fs mount, there's no need
>  to have special code to hide the privroot in reiserfs_lookup.
>   

Jeff, this implication looks strange. IMHO Viro's patch just pins this in
the cache for mount session, while after your "cleanup" everyone can
walk here (including non-privileged users) and do what they want. Um?

Edward.

>  I've also cleaned up the privroot hiding in reiserfs_readdir_dentry and
>  removed the last user of reiserfs_xattrs().
>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
>  fs/reiserfs/dir.c              |   24 +++++++++++++-----------
>  fs/reiserfs/namei.c            |   17 ++---------------
>  fs/reiserfs/xattr.c            |    2 +-
>  include/linux/reiserfs_fs_sb.h |    1 -
>  4 files changed, 16 insertions(+), 28 deletions(-)
>
> --- a/fs/reiserfs/dir.c
> +++ b/fs/reiserfs/dir.c
> @@ -41,6 +41,18 @@ static int reiserfs_dir_fsync(struct fil
>  
>  #define store_ih(where,what) copy_item_head (where, what)
>  
> +static inline bool is_privroot_deh(struct dentry *dir,
> +				   struct reiserfs_de_head *deh)
> +{
> +	int ret = 0;
> +#ifdef CONFIG_REISERFS_FS_XATTR
> +	struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
> +	ret = (dir == dir->d_parent && privroot->d_inode &&
> +	       deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
> +#endif
> +	return ret;
> +}
> +
>  int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
>  			   filldir_t filldir, loff_t *pos)
>  {
> @@ -138,18 +150,8 @@ int reiserfs_readdir_dentry(struct dentr
>  				}
>  
>  				/* Ignore the .reiserfs_priv entry */
> -				if (reiserfs_xattrs(inode->i_sb) &&
> -				    !old_format_only(inode->i_sb) &&
> -				    dentry == inode->i_sb->s_root &&
> -				    REISERFS_SB(inode->i_sb)->priv_root &&
> -				    REISERFS_SB(inode->i_sb)->priv_root->d_inode
> -				    && deh_objectid(deh) ==
> -				    le32_to_cpu(INODE_PKEY
> -						(REISERFS_SB(inode->i_sb)->
> -						 priv_root->d_inode)->
> -						k_objectid)) {
> +				if (is_privroot_deh(dentry, deh))
>  					continue;
> -				}
>  
>  				d_off = deh_offset(deh);
>  				*pos = d_off;
> --- a/fs/reiserfs/namei.c
> +++ b/fs/reiserfs/namei.c
> @@ -338,21 +338,8 @@ static struct dentry *reiserfs_lookup(st
>  				&path_to_entry, &de);
>  	pathrelse(&path_to_entry);
>  	if (retval == NAME_FOUND) {
> -		/* Hide the .reiserfs_priv directory */
> -		if (reiserfs_xattrs(dir->i_sb) &&
> -		    !old_format_only(dir->i_sb) &&
> -		    REISERFS_SB(dir->i_sb)->priv_root &&
> -		    REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
> -		    de.de_objectid ==
> -		    le32_to_cpu(INODE_PKEY
> -				(REISERFS_SB(dir->i_sb)->priv_root->d_inode)->
> -				k_objectid)) {
> -			reiserfs_write_unlock(dir->i_sb);
> -			return ERR_PTR(-EACCES);
> -		}
> -
> -		inode =
> -		    reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
> +		inode = reiserfs_iget(dir->i_sb,
> +				      (struct cpu_key *)&(de.de_dir_id));
>  		if (!inode || IS_ERR(inode)) {
>  			reiserfs_write_unlock(dir->i_sb);
>  			return ERR_PTR(-EACCES);
> --- a/fs/reiserfs/xattr.c
> +++ b/fs/reiserfs/xattr.c
> @@ -841,7 +841,7 @@ ssize_t reiserfs_listxattr(struct dentry
>  	if (!dentry->d_inode)
>  		return -EINVAL;
>  
> -	if (!reiserfs_xattrs(dentry->d_sb) ||
> +	if (!dentry->d_sb->s_xattr ||
>  	    get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
>  		return -EOPNOTSUPP;
>  
> --- a/include/linux/reiserfs_fs_sb.h
> +++ b/include/linux/reiserfs_fs_sb.h
> @@ -488,7 +488,6 @@ 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_xattrs(s) ((s)->s_xattr != NULL)
>  #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_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 3/3] reiserfs: remove privroot hiding in lookup
  2010-04-02 15:22   ` Edward Shishkin
@ 2010-04-06 17:54     ` Jeff Mahoney
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Mahoney @ 2010-04-06 17:54 UTC (permalink / raw)
  To: Edward Shishkin; +Cc: ReiserFS Devel, Andrew Morton, LKML, Al Viro

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/02/2010 11:22 AM, Edward Shishkin wrote:
> Jeff Mahoney wrote:
>>  With Al Viro's patch to move privroot lookup to fs mount, there's no
>> need
>>  to have special code to hide the privroot in reiserfs_lookup.
>>   
> 
> Jeff, this implication looks strange. IMHO Viro's patch just pins this in
> the cache for mount session, while after your "cleanup" everyone can
> walk here (including non-privileged users) and do what they want. Um?


Oh hey. Yeah that's bad. I can reproduce that on my system. The privroot
lookup was supposed to be poisoned but apparently that's not working as
expected.

I'll take a look.

- -Jeff

> Edward.
> 
>>  I've also cleaned up the privroot hiding in reiserfs_readdir_dentry and
>>  removed the last user of reiserfs_xattrs().
>>
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>>  fs/reiserfs/dir.c              |   24 +++++++++++++-----------
>>  fs/reiserfs/namei.c            |   17 ++---------------
>>  fs/reiserfs/xattr.c            |    2 +-
>>  include/linux/reiserfs_fs_sb.h |    1 -
>>  4 files changed, 16 insertions(+), 28 deletions(-)
>>
>> --- a/fs/reiserfs/dir.c
>> +++ b/fs/reiserfs/dir.c
>> @@ -41,6 +41,18 @@ static int reiserfs_dir_fsync(struct fil
>>  
>>  #define store_ih(where,what) copy_item_head (where, what)
>>  
>> +static inline bool is_privroot_deh(struct dentry *dir,
>> +                   struct reiserfs_de_head *deh)
>> +{
>> +    int ret = 0;
>> +#ifdef CONFIG_REISERFS_FS_XATTR
>> +    struct dentry *privroot = REISERFS_SB(dir->d_sb)->priv_root;
>> +    ret = (dir == dir->d_parent && privroot->d_inode &&
>> +           deh->deh_objectid ==
>> INODE_PKEY(privroot->d_inode)->k_objectid);
>> +#endif
>> +    return ret;
>> +}
>> +
>>  int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
>>                 filldir_t filldir, loff_t *pos)
>>  {
>> @@ -138,18 +150,8 @@ int reiserfs_readdir_dentry(struct dentr
>>                  }
>>  
>>                  /* Ignore the .reiserfs_priv entry */
>> -                if (reiserfs_xattrs(inode->i_sb) &&
>> -                    !old_format_only(inode->i_sb) &&
>> -                    dentry == inode->i_sb->s_root &&
>> -                    REISERFS_SB(inode->i_sb)->priv_root &&
>> -                    REISERFS_SB(inode->i_sb)->priv_root->d_inode
>> -                    && deh_objectid(deh) ==
>> -                    le32_to_cpu(INODE_PKEY
>> -                        (REISERFS_SB(inode->i_sb)->
>> -                         priv_root->d_inode)->
>> -                        k_objectid)) {
>> +                if (is_privroot_deh(dentry, deh))
>>                      continue;
>> -                }
>>  
>>                  d_off = deh_offset(deh);
>>                  *pos = d_off;
>> --- a/fs/reiserfs/namei.c
>> +++ b/fs/reiserfs/namei.c
>> @@ -338,21 +338,8 @@ static struct dentry *reiserfs_lookup(st
>>                  &path_to_entry, &de);
>>      pathrelse(&path_to_entry);
>>      if (retval == NAME_FOUND) {
>> -        /* Hide the .reiserfs_priv directory */
>> -        if (reiserfs_xattrs(dir->i_sb) &&
>> -            !old_format_only(dir->i_sb) &&
>> -            REISERFS_SB(dir->i_sb)->priv_root &&
>> -            REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
>> -            de.de_objectid ==
>> -            le32_to_cpu(INODE_PKEY
>> -                (REISERFS_SB(dir->i_sb)->priv_root->d_inode)->
>> -                k_objectid)) {
>> -            reiserfs_write_unlock(dir->i_sb);
>> -            return ERR_PTR(-EACCES);
>> -        }
>> -
>> -        inode =
>> -            reiserfs_iget(dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
>> +        inode = reiserfs_iget(dir->i_sb,
>> +                      (struct cpu_key *)&(de.de_dir_id));
>>          if (!inode || IS_ERR(inode)) {
>>              reiserfs_write_unlock(dir->i_sb);
>>              return ERR_PTR(-EACCES);
>> --- a/fs/reiserfs/xattr.c
>> +++ b/fs/reiserfs/xattr.c
>> @@ -841,7 +841,7 @@ ssize_t reiserfs_listxattr(struct dentry
>>      if (!dentry->d_inode)
>>          return -EINVAL;
>>  
>> -    if (!reiserfs_xattrs(dentry->d_sb) ||
>> +    if (!dentry->d_sb->s_xattr ||
>>          get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
>>          return -EOPNOTSUPP;
>>  
>> --- a/include/linux/reiserfs_fs_sb.h
>> +++ b/include/linux/reiserfs_fs_sb.h
>> @@ -488,7 +488,6 @@ 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_xattrs(s) ((s)->s_xattr != NULL)
>>  #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_xattrs_optional(s) (reiserfs_xattrs_user(s) ||
>> reiserfs_posixacl(s))
>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe
>> reiserfs-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>   
> 


- -- 
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAku7dWoACgkQLPWxlyuTD7J8twCfeOXZTZot0wocKnhDoSy/ED/s
IrwAniBOs1YcTC67mH4dD+ggyx65ZA3X
=uKLG
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-06 17:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-05 19:30 [patch 0/3] reiserfs xattr fixups Jeff Mahoney
2009-05-05 19:30 ` [patch 1/3] reiserfs: fixup xattr_root caching Jeff Mahoney
2009-05-05 19:30 ` [patch 2/3] reiserfs: dont associate security.* with xattr files Jeff Mahoney
2009-05-05 19:30 ` [patch 3/3] reiserfs: remove privroot hiding in lookup Jeff Mahoney
2010-04-02 15:22   ` Edward Shishkin
2010-04-06 17:54     ` Jeff Mahoney
2009-05-05 20:13 ` [patch 0/3] reiserfs xattr fixups Al Viro
2009-05-05 20:14   ` Jeff Mahoney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).