mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>,
	josef@redhat.com, chris.mason@oracle.com
Subject: [PATCH 3/4] BTRFS: Set NOSEC early for btrfs v2
Date: Sat, 28 May 2011 08:25:53 -0700	[thread overview]
Message-ID: <1306596354-18453-3-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1306596354-18453-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

Based on a suggestion from Josef Bacik.

The btrfs inode lookup already does a quick check for xattrs.
If it doesn't find any and the file is not sgid set the NOSEC flag.
This avoids a xattr lookup on the first write.

v2: Use helper
Cc: josef@redhat.com
Cc: chris.mason@oracle.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 fs/btrfs/inode.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7cd8ab0..20cecb8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2544,8 +2544,10 @@ static void btrfs_read_locked_inode(struct inode *inode)
 	 * any xattrs or acls
 	 */
 	maybe_acls = acls_after_inode_item(leaf, path->slots[0], inode->i_ino);
-	if (!maybe_acls)
+	if (!maybe_acls) {
 		cache_no_acl(inode);
+		inode_has_no_xattr(inode);
+	}
 
 	BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0,
 						alloc_group_block, 0);
@@ -4616,6 +4618,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 		    (BTRFS_I(dir)->flags & BTRFS_INODE_NODATACOW))
 			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
 	}
+	/* 
+ 	 * A new inode has no xattrs yet.
+ 	 */
+	inode_has_no_xattr(inode);
 
 	insert_inode_hash(inode);
 	inode_tree_add(inode);
-- 
1.7.4.4


  parent reply	other threads:[~2011-05-28 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 15:25 [PATCH 1/4] Cache xattr security drop check for write v2 Andi Kleen
2011-05-28 15:25 ` [PATCH 2/4] EXT4: Set NOSEC flag early when there are no xattrs v2 Andi Kleen
2011-05-28 15:25 ` Andi Kleen [this message]
2011-05-28 15:25 ` [PATCH 4/4] XFS: Set NOSEC flag early when inode has no xattrs. v2 Andi Kleen
2011-05-31 13:51 ` [PATCH 1/4] Cache xattr security drop check for write v2 Steven Whitehouse
2011-05-31 18:06   ` Andi Kleen
2011-05-31 18:42     ` Steven Whitehouse
2011-05-31 20:07       ` Al Viro
2011-05-31 20:18         ` Andi Kleen
2011-05-31 20:21           ` Al Viro
2011-06-18  6:58         ` Marco Stornelli
2011-06-18 18:04           ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306596354-18453-3-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=chris.mason@oracle.com \
    --cc=josef@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®