diff options
-rw-r--r-- | fs/9p/acl.c | 3 | ||||
-rw-r--r-- | fs/btrfs/acl.c | 19 | ||||
-rw-r--r-- | fs/ext2/acl.c | 6 | ||||
-rw-r--r-- | fs/ext3/acl.c | 6 | ||||
-rw-r--r-- | fs/ext4/acl.c | 6 | ||||
-rw-r--r-- | fs/generic_acl.c | 19 | ||||
-rw-r--r-- | fs/gfs2/acl.c | 6 | ||||
-rw-r--r-- | fs/jffs2/acl.c | 3 | ||||
-rw-r--r-- | fs/jfs/acl.c | 3 | ||||
-rw-r--r-- | fs/namei.c | 52 | ||||
-rw-r--r-- | fs/ocfs2/acl.c | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 8 |
12 files changed, 65 insertions, 69 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 7350f53f3b51..8be87857605c 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -101,9 +101,6 @@ int v9fs_check_acl(struct inode *inode, int mask) | |||
101 | struct posix_acl *acl; | 101 | struct posix_acl *acl; |
102 | struct v9fs_session_info *v9ses; | 102 | struct v9fs_session_info *v9ses; |
103 | 103 | ||
104 | if (mask & MAY_NOT_BLOCK) | ||
105 | return -ECHILD; | ||
106 | |||
107 | v9ses = v9fs_inode2v9ses(inode); | 104 | v9ses = v9fs_inode2v9ses(inode); |
108 | if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) || | 105 | if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) || |
109 | ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) { | 106 | ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) { |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 9f62ab2a7282..c13ea9fbf36b 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -198,19 +198,14 @@ out: | |||
198 | int btrfs_check_acl(struct inode *inode, int mask) | 198 | int btrfs_check_acl(struct inode *inode, int mask) |
199 | { | 199 | { |
200 | int error = -EAGAIN; | 200 | int error = -EAGAIN; |
201 | struct posix_acl *acl; | ||
201 | 202 | ||
202 | if (mask & MAY_NOT_BLOCK) { | 203 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); |
203 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | 204 | if (IS_ERR(acl)) |
204 | error = -ECHILD; | 205 | return PTR_ERR(acl); |
205 | } else { | 206 | if (acl) { |
206 | struct posix_acl *acl; | 207 | error = posix_acl_permission(inode, acl, mask); |
207 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); | 208 | posix_acl_release(acl); |
208 | if (IS_ERR(acl)) | ||
209 | return PTR_ERR(acl); | ||
210 | if (acl) { | ||
211 | error = posix_acl_permission(inode, acl, mask); | ||
212 | posix_acl_release(acl); | ||
213 | } | ||
214 | } | 209 | } |
215 | 210 | ||
216 | return error; | 211 | return error; |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index bfe651f9ae16..ced1c478ebdb 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
@@ -236,12 +236,6 @@ ext2_check_acl(struct inode *inode, int mask) | |||
236 | { | 236 | { |
237 | struct posix_acl *acl; | 237 | struct posix_acl *acl; |
238 | 238 | ||
239 | if (mask & MAY_NOT_BLOCK) { | ||
240 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
241 | return -ECHILD; | ||
242 | return -EAGAIN; | ||
243 | } | ||
244 | |||
245 | acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); | 239 | acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); |
246 | if (IS_ERR(acl)) | 240 | if (IS_ERR(acl)) |
247 | return PTR_ERR(acl); | 241 | return PTR_ERR(acl); |
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index edfeb293d4cb..5326038e8536 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -244,12 +244,6 @@ ext3_check_acl(struct inode *inode, int mask) | |||
244 | { | 244 | { |
245 | struct posix_acl *acl; | 245 | struct posix_acl *acl; |
246 | 246 | ||
247 | if (mask & MAY_NOT_BLOCK) { | ||
248 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
249 | return -ECHILD; | ||
250 | return -EAGAIN; | ||
251 | } | ||
252 | |||
253 | acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); | 247 | acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); |
254 | if (IS_ERR(acl)) | 248 | if (IS_ERR(acl)) |
255 | return PTR_ERR(acl); | 249 | return PTR_ERR(acl); |
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c index 60d900fcc3db..4cd9e2e4085e 100644 --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c | |||
@@ -242,12 +242,6 @@ ext4_check_acl(struct inode *inode, int mask) | |||
242 | { | 242 | { |
243 | struct posix_acl *acl; | 243 | struct posix_acl *acl; |
244 | 244 | ||
245 | if (mask & MAY_NOT_BLOCK) { | ||
246 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
247 | return -ECHILD; | ||
248 | return -EAGAIN; | ||
249 | } | ||
250 | |||
251 | acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); | 245 | acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); |
252 | if (IS_ERR(acl)) | 246 | if (IS_ERR(acl)) |
253 | return PTR_ERR(acl); | 247 | return PTR_ERR(acl); |
diff --git a/fs/generic_acl.c b/fs/generic_acl.c index 70e90b4974ce..4949473d3542 100644 --- a/fs/generic_acl.c +++ b/fs/generic_acl.c | |||
@@ -192,18 +192,13 @@ generic_acl_chmod(struct inode *inode) | |||
192 | int | 192 | int |
193 | generic_check_acl(struct inode *inode, int mask) | 193 | generic_check_acl(struct inode *inode, int mask) |
194 | { | 194 | { |
195 | if (mask & MAY_NOT_BLOCK) { | 195 | struct posix_acl *acl; |
196 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | 196 | |
197 | return -ECHILD; | 197 | acl = get_cached_acl(inode, ACL_TYPE_ACCESS); |
198 | } else { | 198 | if (acl) { |
199 | struct posix_acl *acl; | 199 | int error = posix_acl_permission(inode, acl, mask); |
200 | 200 | posix_acl_release(acl); | |
201 | acl = get_cached_acl(inode, ACL_TYPE_ACCESS); | 201 | return error; |
202 | if (acl) { | ||
203 | int error = posix_acl_permission(inode, acl, mask); | ||
204 | posix_acl_release(acl); | ||
205 | return error; | ||
206 | } | ||
207 | } | 202 | } |
208 | return -EAGAIN; | 203 | return -EAGAIN; |
209 | } | 204 | } |
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 8ef1079f1665..48171f4c943d 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -80,12 +80,6 @@ int gfs2_check_acl(struct inode *inode, int mask) | |||
80 | struct posix_acl *acl; | 80 | struct posix_acl *acl; |
81 | int error; | 81 | int error; |
82 | 82 | ||
83 | if (mask & MAY_NOT_BLOCK) { | ||
84 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
85 | return -ECHILD; | ||
86 | return -EAGAIN; | ||
87 | } | ||
88 | |||
89 | acl = gfs2_acl_get(GFS2_I(inode), ACL_TYPE_ACCESS); | 83 | acl = gfs2_acl_get(GFS2_I(inode), ACL_TYPE_ACCESS); |
90 | if (IS_ERR(acl)) | 84 | if (IS_ERR(acl)) |
91 | return PTR_ERR(acl); | 85 | return PTR_ERR(acl); |
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index f9c302430aa1..4933a8f8ecc9 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -264,9 +264,6 @@ int jffs2_check_acl(struct inode *inode, int mask) | |||
264 | struct posix_acl *acl; | 264 | struct posix_acl *acl; |
265 | int rc; | 265 | int rc; |
266 | 266 | ||
267 | if (mask & MAY_NOT_BLOCK) | ||
268 | return -ECHILD; | ||
269 | |||
270 | acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); | 267 | acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); |
271 | if (IS_ERR(acl)) | 268 | if (IS_ERR(acl)) |
272 | return PTR_ERR(acl); | 269 | return PTR_ERR(acl); |
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 8a0a0666d5a6..ead200eef5e4 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -118,9 +118,6 @@ int jfs_check_acl(struct inode *inode, int mask) | |||
118 | { | 118 | { |
119 | struct posix_acl *acl; | 119 | struct posix_acl *acl; |
120 | 120 | ||
121 | if (mask & MAY_NOT_BLOCK) | ||
122 | return -ECHILD; | ||
123 | |||
124 | acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); | 121 | acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); |
125 | if (IS_ERR(acl)) | 122 | if (IS_ERR(acl)) |
126 | return PTR_ERR(acl); | 123 | return PTR_ERR(acl); |
diff --git a/fs/namei.c b/fs/namei.c index b7fad009bbf6..120efc76d3d0 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/fcntl.h> | 32 | #include <linux/fcntl.h> |
33 | #include <linux/device_cgroup.h> | 33 | #include <linux/device_cgroup.h> |
34 | #include <linux/fs_struct.h> | 34 | #include <linux/fs_struct.h> |
35 | #include <linux/posix_acl.h> | ||
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
36 | 37 | ||
37 | #include "internal.h" | 38 | #include "internal.h" |
@@ -173,12 +174,58 @@ void putname(const char *name) | |||
173 | EXPORT_SYMBOL(putname); | 174 | EXPORT_SYMBOL(putname); |
174 | #endif | 175 | #endif |
175 | 176 | ||
177 | static int check_acl(struct inode *inode, int mask) | ||
178 | { | ||
179 | struct posix_acl *acl; | ||
180 | |||
181 | /* | ||
182 | * Under RCU walk, we cannot even do a "get_cached_acl()", | ||
183 | * because that involves locking and getting a refcount on | ||
184 | * a cached ACL. | ||
185 | * | ||
186 | * So the only case we handle during RCU walking is the | ||
187 | * case of a cached "no ACL at all", which needs no locks | ||
188 | * or refcounts. | ||
189 | */ | ||
190 | if (mask & MAY_NOT_BLOCK) { | ||
191 | if (negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
192 | return -EAGAIN; | ||
193 | return -ECHILD; | ||
194 | } | ||
195 | |||
196 | acl = get_cached_acl(inode, ACL_TYPE_ACCESS); | ||
197 | |||
198 | /* | ||
199 | * A filesystem can force a ACL callback by just never | ||
200 | * filling the ACL cache. But normally you'd fill the | ||
201 | * cache either at inode instantiation time, or on the | ||
202 | * first ->check_acl call. | ||
203 | * | ||
204 | * If the filesystem doesn't have a check_acl() function | ||
205 | * at all, we'll just create the negative cache entry. | ||
206 | */ | ||
207 | if (acl == ACL_NOT_CACHED) { | ||
208 | if (inode->i_op->check_acl) | ||
209 | return inode->i_op->check_acl(inode, mask); | ||
210 | |||
211 | set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); | ||
212 | return -EAGAIN; | ||
213 | } | ||
214 | |||
215 | if (acl) { | ||
216 | int error = posix_acl_permission(inode, acl, mask); | ||
217 | posix_acl_release(acl); | ||
218 | return error; | ||
219 | } | ||
220 | |||
221 | return -EAGAIN; | ||
222 | } | ||
223 | |||
176 | /* | 224 | /* |
177 | * This does basic POSIX ACL permission checking | 225 | * This does basic POSIX ACL permission checking |
178 | */ | 226 | */ |
179 | static int acl_permission_check(struct inode *inode, int mask) | 227 | static int acl_permission_check(struct inode *inode, int mask) |
180 | { | 228 | { |
181 | int (*check_acl)(struct inode *inode, int mask); | ||
182 | unsigned int mode = inode->i_mode; | 229 | unsigned int mode = inode->i_mode; |
183 | 230 | ||
184 | mask &= MAY_READ | MAY_WRITE | MAY_EXEC | MAY_NOT_BLOCK; | 231 | mask &= MAY_READ | MAY_WRITE | MAY_EXEC | MAY_NOT_BLOCK; |
@@ -189,8 +236,7 @@ static int acl_permission_check(struct inode *inode, int mask) | |||
189 | if (current_fsuid() == inode->i_uid) | 236 | if (current_fsuid() == inode->i_uid) |
190 | mode >>= 6; | 237 | mode >>= 6; |
191 | else { | 238 | else { |
192 | check_acl = inode->i_op->check_acl; | 239 | if (IS_POSIXACL(inode) && (mode & S_IRWXG)) { |
193 | if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) { | ||
194 | int error = check_acl(inode, mask); | 240 | int error = check_acl(inode, mask); |
195 | if (error != -EAGAIN) | 241 | if (error != -EAGAIN) |
196 | return error; | 242 | return error; |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index f4cf451ce6e8..aff23e59b58c 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -297,9 +297,6 @@ int ocfs2_check_acl(struct inode *inode, int mask) | |||
297 | struct posix_acl *acl; | 297 | struct posix_acl *acl; |
298 | int ret = -EAGAIN; | 298 | int ret = -EAGAIN; |
299 | 299 | ||
300 | if (mask & MAY_NOT_BLOCK) | ||
301 | return -ECHILD; | ||
302 | |||
303 | osb = OCFS2_SB(inode->i_sb); | 300 | osb = OCFS2_SB(inode->i_sb); |
304 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | 301 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) |
305 | return ret; | 302 | return ret; |
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index cac48fe22ad5..f6d065ac56b5 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -231,16 +231,12 @@ xfs_check_acl(struct inode *inode, int mask) | |||
231 | /* | 231 | /* |
232 | * If there is no attribute fork no ACL exists on this inode and | 232 | * If there is no attribute fork no ACL exists on this inode and |
233 | * we can skip the whole exercise. | 233 | * we can skip the whole exercise. |
234 | * | ||
235 | * FIXME! Fill the cache! Locking? | ||
234 | */ | 236 | */ |
235 | if (!XFS_IFORK_Q(ip)) | 237 | if (!XFS_IFORK_Q(ip)) |
236 | return -EAGAIN; | 238 | return -EAGAIN; |
237 | 239 | ||
238 | if (mask & MAY_NOT_BLOCK) { | ||
239 | if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) | ||
240 | return -ECHILD; | ||
241 | return -EAGAIN; | ||
242 | } | ||
243 | |||
244 | acl = xfs_get_acl(inode, ACL_TYPE_ACCESS); | 240 | acl = xfs_get_acl(inode, ACL_TYPE_ACCESS); |
245 | if (IS_ERR(acl)) | 241 | if (IS_ERR(acl)) |
246 | return PTR_ERR(acl); | 242 | return PTR_ERR(acl); |