diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-23 11:37:31 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:30:23 -0400 |
commit | 4e34e719e457f2e031297175410fc0bd4016a085 (patch) | |
tree | ab969a371e0d2efc6bfbf503ca6cdfce3af3bf6c /fs/namei.c | |
parent | edde854e8bb34a7f32fa993d721f1da0faf64165 (diff) |
fs: take the ACL checks to common code
Replace the ->check_acl method with a ->get_acl method that simply reads an
ACL from disk after having a cache miss. This means we can replace the ACL
checking boilerplate code with a single implementation in namei.c.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/namei.c b/fs/namei.c index 120efc76d3d0..ec2e5656b444 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -196,20 +196,22 @@ static int check_acl(struct inode *inode, int mask) | |||
196 | acl = get_cached_acl(inode, ACL_TYPE_ACCESS); | 196 | acl = get_cached_acl(inode, ACL_TYPE_ACCESS); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * A filesystem can force a ACL callback by just never | 199 | * A filesystem can force a ACL callback by just never filling the |
200 | * filling the ACL cache. But normally you'd fill the | 200 | * ACL cache. But normally you'd fill the cache either at inode |
201 | * cache either at inode instantiation time, or on the | 201 | * instantiation time, or on the first ->get_acl call. |
202 | * first ->check_acl call. | ||
203 | * | 202 | * |
204 | * If the filesystem doesn't have a check_acl() function | 203 | * If the filesystem doesn't have a get_acl() function at all, we'll |
205 | * at all, we'll just create the negative cache entry. | 204 | * just create the negative cache entry. |
206 | */ | 205 | */ |
207 | if (acl == ACL_NOT_CACHED) { | 206 | if (acl == ACL_NOT_CACHED) { |
208 | if (inode->i_op->check_acl) | 207 | if (inode->i_op->get_acl) { |
209 | return inode->i_op->check_acl(inode, mask); | 208 | acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS); |
210 | 209 | if (IS_ERR(acl)) | |
211 | set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); | 210 | return PTR_ERR(acl); |
212 | return -EAGAIN; | 211 | } else { |
212 | set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); | ||
213 | return -EAGAIN; | ||
214 | } | ||
213 | } | 215 | } |
214 | 216 | ||
215 | if (acl) { | 217 | if (acl) { |