
From: Jeffrey Mahoney <jeffm@novell.com>

This patch adds the selinux private flag to inodes marked as reiserfs-private.

It also avoids the use of vfs_rmdir, since it will use the selinux permissions
check.  The permission checks aren't valid in this context.  Also, some of the
checks performed are superfluous for this case.

Signed-off-by: Jeff Mahoney <jeffm@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/reiserfs/xattr.c            |   10 +++++++++-
 25-akpm/include/linux/reiserfs_xattr.h |    2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff -puN fs/reiserfs/xattr.c~reiserfs-fixes-to-allow-reiserfs-to-use-selinux-attributes fs/reiserfs/xattr.c
--- 25/fs/reiserfs/xattr.c~reiserfs-fixes-to-allow-reiserfs-to-use-selinux-attributes	2004-11-21 16:06:29.701236000 -0800
+++ 25-akpm/fs/reiserfs/xattr.c	2004-11-21 16:06:29.708234936 -0800
@@ -834,7 +834,15 @@ reiserfs_delete_xattrs (struct inode *in
     if (dir->d_inode->i_nlink <= 2) {
         root = get_xa_root (inode->i_sb);
         reiserfs_write_lock_xattrs (inode->i_sb);
-        err = vfs_rmdir (root->d_inode, dir);
+
+        /* security checks can cause vfs_rmdir to fail when it shouldn't */
+        dentry_unhash (dir);
+        err = root->d_inode->i_op->rmdir (root->d_inode, dir);
+        if (!err) {
+            dir->d_inode->i_flags |= S_DEAD;
+            d_delete (dir);
+        }
+        dput (dir);
         reiserfs_write_unlock_xattrs (inode->i_sb);
         dput (root);
     } else {
diff -puN include/linux/reiserfs_xattr.h~reiserfs-fixes-to-allow-reiserfs-to-use-selinux-attributes include/linux/reiserfs_xattr.h
--- 25/include/linux/reiserfs_xattr.h~reiserfs-fixes-to-allow-reiserfs-to-use-selinux-attributes	2004-11-21 16:06:29.702235848 -0800
+++ 25-akpm/include/linux/reiserfs_xattr.h	2004-11-21 16:06:29.706235240 -0800
@@ -5,6 +5,7 @@
 #include <linux/config.h>
 #include <linux/init.h>
 #include <linux/xattr.h>
+#include <linux/security.h>
 
 /* Magic value in header */
 #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
@@ -107,6 +108,7 @@ static inline void
 reiserfs_mark_inode_private(struct inode *inode)
 {
     REISERFS_I(inode)->i_flags |= i_priv_object;
+    security_inode_mark_private (inode);
 }
 
 #else
_
