From b74c79e99389cd79b31fcc08f82c24e492e63c7e Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Fri, 7 Jan 2011 17:49:58 +1100 Subject: fs: provide rcu-walk aware permission i_ops Signed-off-by: Nick Piggin --- fs/ext2/acl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fs/ext2/acl.c') diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index 2bcc0431bad..dd9bb3f0c8d 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c @@ -232,10 +232,14 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) } int -ext2_check_acl(struct inode *inode, int mask) +ext2_check_acl(struct inode *inode, int mask, unsigned int flags) { - struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); + struct posix_acl *acl; + + if (flags & IPERM_FLAG_RCU) + return -ECHILD; + acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) return PTR_ERR(acl); if (acl) { -- cgit v1.2.3-70-g09d2 From 73598611ade7c85f0c3d52ba5130103f6709c6d3 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Fri, 7 Jan 2011 17:50:00 +1100 Subject: ext2,3,4: provide simple rcu-walk ACL implementation This simple implementation just checks for no ACLs on the inode, and if so, then the rcu-walk may proceed, otherwise fail it. Signed-off-by: Nick Piggin --- fs/ext2/acl.c | 7 +++++-- fs/ext3/acl.c | 7 +++++-- fs/ext4/acl.c | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'fs/ext2/acl.c') diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index dd9bb3f0c8d..7b4180554a6 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c @@ -236,8 +236,11 @@ ext2_check_acl(struct inode *inode, int mask, unsigned int flags) { struct posix_acl *acl; - if (flags & IPERM_FLAG_RCU) - return -ECHILD; + if (flags & IPERM_FLAG_RCU) { + if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) + return -ECHILD; + return -EAGAIN; + } acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 9e49da8302d..e4fa49e6c53 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c @@ -244,8 +244,11 @@ ext3_check_acl(struct inode *inode, int mask, unsigned int flags) { struct posix_acl *acl; - if (flags & IPERM_FLAG_RCU) - return -ECHILD; + if (flags & IPERM_FLAG_RCU) { + if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) + return -ECHILD; + return -EAGAIN; + } acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c index 373dcaeedba..e0270d1f8d8 100644 --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c @@ -242,8 +242,11 @@ ext4_check_acl(struct inode *inode, int mask, unsigned int flags) { struct posix_acl *acl; - if (flags & IPERM_FLAG_RCU) - return -ECHILD; + if (flags & IPERM_FLAG_RCU) { + if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) + return -ECHILD; + return -EAGAIN; + } acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) -- cgit v1.2.3-70-g09d2