public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
	Andi Kleen <ak@linux.intel.com>,
	dchinner@redhat.com, aelder@sgi.com
Subject: [PATCH 4/4] XFS: Set NOSEC flag early when inode has no xattrs.
Date: Fri, 27 May 2011 15:54:05 -0700	[thread overview]
Message-ID: <1306536845-24162-4-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1306536845-24162-1-git-send-email-andi@firstfloor.org>

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

Set the S_NOSEC flag early if the inode has no xattrs for XFS.
This avoids a single xattr lookup for the first write on every
file, if the file has no xattrs.

Cc: dchinner@redhat.com
Cc: aelder@sgi.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 fs/xfs/linux-2.6/xfs_iops.c |    3 +++
 fs/xfs/xfs_attr.c           |    2 +-
 fs/xfs/xfs_attr.h           |    1 +
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index dd21784..4ed1e4c 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -763,6 +763,9 @@ xfs_setup_inode(
 		break;
 	}
 
+	if (!is_sgid(inode->i_mode) && !xfs_inode_hasattr(ip))
+		inode->i_flags |= S_NOSEC;
+
 	xfs_iflags_clear(ip, XFS_INEW);
 	barrier();
 
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index c863753..43140db 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -99,7 +99,7 @@ xfs_attr_name_to_xname(
 	return 0;
 }
 
-STATIC int
+int
 xfs_inode_hasattr(
 	struct xfs_inode	*ip)
 {
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index e920d68..20f4038 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -142,5 +142,6 @@ typedef struct xfs_attr_list_context {
 int xfs_attr_inactive(struct xfs_inode *dp);
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
 int xfs_attr_list_int(struct xfs_attr_list_context *);
+int xfs_inode_hasattr(struct xfs_inode *ip);
 
 #endif	/* __XFS_ATTR_H__ */
-- 
1.7.4.4


  parent reply	other threads:[~2011-05-27 22:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-27 22:54 [PATCH 1/4] Cache xattr security drop check for write Andi Kleen
2011-05-27 22:54 ` [PATCH 2/4] EXT4: Set NOSEC flag early when there are no xattrs Andi Kleen
2011-05-28  9:08   ` Marco Stornelli
2011-05-28 11:24     ` Chris Mason
2011-05-28 14:43     ` Andi Kleen
2011-05-27 22:54 ` [PATCH 3/4] BTRFS: Set NOSEC early for btrfs Andi Kleen
2011-05-27 22:54 ` Andi Kleen [this message]
2011-05-28 11:42 ` [PATCH 1/4] Cache xattr security drop check for write Al Viro
2011-05-29 13:52 ` Valdis.Kletnieks
2011-05-29 14:24   ` Andi Kleen
2011-05-29 17:48     ` Valdis.Kletnieks

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=1306536845-24162-4-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=aelder@sgi.com \
    --cc=ak@linux.intel.com \
    --cc=dchinner@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