Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e77819e5 authored by Linus Torvalds's avatar Linus Torvalds Committed by Al Viro
Browse files

vfs: move ACL cache lookup into generic code



This moves logic for checking the cached ACL values from low-level
filesystems into generic code.  The end result is a streamlined ACL
check that doesn't need to load the inode->i_op->check_acl pointer at
all for the common cached case.

The filesystems also don't need to check for a non-blocking RCU walk
case in their acl_check() functions, because that is all handled at a
VFS layer.

Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3ca30d40
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -101,9 +101,6 @@ int v9fs_check_acl(struct inode *inode, int mask)
	struct posix_acl *acl;
	struct v9fs_session_info *v9ses;

	if (mask & MAY_NOT_BLOCK)
		return -ECHILD;

	v9ses = v9fs_inode2v9ses(inode);
	if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
			((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
+7 −12
Original line number Diff line number Diff line
@@ -198,12 +198,8 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
int btrfs_check_acl(struct inode *inode, int mask)
{
	int error = -EAGAIN;

	if (mask & MAY_NOT_BLOCK) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			error = -ECHILD;
	} else {
	struct posix_acl *acl;

	acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
@@ -211,7 +207,6 @@ int btrfs_check_acl(struct inode *inode, int mask)
		error = posix_acl_permission(inode, acl, mask);
		posix_acl_release(acl);
	}
	}

	return error;
}
+0 −6
Original line number Diff line number Diff line
@@ -236,12 +236,6 @@ ext2_check_acl(struct inode *inode, int mask)
{
	struct posix_acl *acl;

	if (mask & MAY_NOT_BLOCK) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			return -ECHILD;
		return -EAGAIN;
	}

	acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
+0 −6
Original line number Diff line number Diff line
@@ -244,12 +244,6 @@ ext3_check_acl(struct inode *inode, int mask)
{
	struct posix_acl *acl;

	if (mask & MAY_NOT_BLOCK) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			return -ECHILD;
		return -EAGAIN;
	}

	acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
+0 −6
Original line number Diff line number Diff line
@@ -242,12 +242,6 @@ ext4_check_acl(struct inode *inode, int mask)
{
	struct posix_acl *acl;

	if (mask & MAY_NOT_BLOCK) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			return -ECHILD;
		return -EAGAIN;
	}

	acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
Loading