From: Christoph Hellwig Subject: [PATCH 2/4] xfs: cache negative ACLs if there is no attribute fork Date: Sat, 23 Jul 2011 17:36:50 +0200 Message-ID: <20110723153650.GB10887@lst.de> References: <20110723153621.GA10832@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel To: Al Viro , Linus Torvalds Return-path: Received: from verein.lst.de ([213.95.11.211]:33437 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516Ab1GWPgu (ORCPT ); Sat, 23 Jul 2011 11:36:50 -0400 Content-Disposition: inline In-Reply-To: <20110723153621.GA10832@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Always set up a negative ACL cache entry if the inode doesn't have an attribute fork. That behaves much better than doing this check inside ->check_acl. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/xfs/linux-2.6/xfs_acl.c =================================================================== --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_acl.c 2011-07-23 15:53:07.267433023 +0200 +++ linux-2.6/fs/xfs/linux-2.6/xfs_acl.c 2011-07-23 15:54:03.474099354 +0200 @@ -221,21 +221,10 @@ xfs_set_acl(struct inode *inode, int typ int xfs_check_acl(struct inode *inode, int mask) { - struct xfs_inode *ip; struct posix_acl *acl; int error = -EAGAIN; - ip = XFS_I(inode); - trace_xfs_check_acl(ip); - - /* - * If there is no attribute fork no ACL exists on this inode and - * we can skip the whole exercise. - * - * FIXME! Fill the cache! Locking? - */ - if (!XFS_IFORK_Q(ip)) - return -EAGAIN; + trace_xfs_check_acl(XFS_I(inode)); acl = xfs_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) Index: linux-2.6/fs/xfs/linux-2.6/xfs_iops.c =================================================================== --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_iops.c 2011-07-23 15:54:59.134099020 +0200 +++ linux-2.6/fs/xfs/linux-2.6/xfs_iops.c 2011-07-23 15:56:58.634098306 +0200 @@ -1194,6 +1194,10 @@ xfs_setup_inode( break; } + /* if there is no attribute fork no ACL can exist on this inode */ + if (!XFS_IFORK_Q(ip)) + cache_no_acl(inode); + xfs_iflags_clear(ip, XFS_INEW); barrier();