aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/acl.c2
-rw-r--r--fs/btrfs/acl.c2
-rw-r--r--fs/ext2/acl.c2
-rw-r--r--fs/ext3/acl.c2
-rw-r--r--fs/ext4/acl.c2
-rw-r--r--fs/f2fs/acl.c2
-rw-r--r--fs/generic_acl.c2
-rw-r--r--fs/gfs2/acl.c2
-rw-r--r--fs/hfsplus/posix_acl.c2
-rw-r--r--fs/jffs2/acl.c2
-rw-r--r--fs/jfs/acl.c2
-rw-r--r--fs/ocfs2/acl.c2
-rw-r--r--fs/posix_acl.c30
-rw-r--r--fs/reiserfs/xattr_acl.c2
-rw-r--r--fs/xfs/xfs_acl.c2
-rw-r--r--include/linux/posix_acl.h17
16 files changed, 54 insertions, 21 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 7af425f53bee..f5ce5c50c57e 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -156,7 +156,7 @@ int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
156 return -EOPNOTSUPP; 156 return -EOPNOTSUPP;
157 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS); 157 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
158 if (acl) { 158 if (acl) {
159 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 159 retval = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
160 if (retval) 160 if (retval)
161 return retval; 161 return retval;
162 set_cached_acl(inode, ACL_TYPE_ACCESS, acl); 162 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 0890c83643e9..1af04ff88986 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -256,7 +256,7 @@ int btrfs_acl_chmod(struct inode *inode)
256 if (IS_ERR_OR_NULL(acl)) 256 if (IS_ERR_OR_NULL(acl))
257 return PTR_ERR(acl); 257 return PTR_ERR(acl);
258 258
259 ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 259 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
260 if (ret) 260 if (ret)
261 return ret; 261 return ret;
262 ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS); 262 ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS);
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 110b6b371a4e..7006ced45324 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -308,7 +308,7 @@ ext2_acl_chmod(struct inode *inode)
308 acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); 308 acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
309 if (IS_ERR(acl) || !acl) 309 if (IS_ERR(acl) || !acl)
310 return PTR_ERR(acl); 310 return PTR_ERR(acl);
311 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 311 error = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
312 if (error) 312 if (error)
313 return error; 313 return error;
314 error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl); 314 error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl);
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index dbb5ad59a7fc..6691a6c6b211 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -314,7 +314,7 @@ ext3_acl_chmod(struct inode *inode)
314 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); 314 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
315 if (IS_ERR(acl) || !acl) 315 if (IS_ERR(acl) || !acl)
316 return PTR_ERR(acl); 316 return PTR_ERR(acl);
317 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 317 error = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
318 if (error) 318 if (error)
319 return error; 319 return error;
320retry: 320retry:
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 39a54a0e9fe4..2eebe02fdf09 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -320,7 +320,7 @@ ext4_acl_chmod(struct inode *inode)
320 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); 320 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
321 if (IS_ERR(acl) || !acl) 321 if (IS_ERR(acl) || !acl)
322 return PTR_ERR(acl); 322 return PTR_ERR(acl);
323 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 323 error = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
324 if (error) 324 if (error)
325 return error; 325 return error;
326retry: 326retry:
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index d0fc287efeff..14c4df0ede34 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -311,7 +311,7 @@ int f2fs_acl_chmod(struct inode *inode)
311 if (IS_ERR(acl) || !acl) 311 if (IS_ERR(acl) || !acl)
312 return PTR_ERR(acl); 312 return PTR_ERR(acl);
313 313
314 error = posix_acl_chmod(&acl, GFP_KERNEL, mode); 314 error = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
315 if (error) 315 if (error)
316 return error; 316 return error;
317 317
diff --git a/fs/generic_acl.c b/fs/generic_acl.c
index b3f3676796d3..46a5076e9776 100644
--- a/fs/generic_acl.c
+++ b/fs/generic_acl.c
@@ -158,7 +158,7 @@ generic_acl_chmod(struct inode *inode)
158 return -EOPNOTSUPP; 158 return -EOPNOTSUPP;
159 acl = get_cached_acl(inode, ACL_TYPE_ACCESS); 159 acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
160 if (acl) { 160 if (acl) {
161 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 161 error = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
162 if (error) 162 if (error)
163 return error; 163 return error;
164 set_cached_acl(inode, ACL_TYPE_ACCESS, acl); 164 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index f69ac0af5496..3e200c7ca7ad 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -162,7 +162,7 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
162 if (!acl) 162 if (!acl)
163 return gfs2_setattr_simple(inode, attr); 163 return gfs2_setattr_simple(inode, attr);
164 164
165 error = posix_acl_chmod(&acl, GFP_NOFS, attr->ia_mode); 165 error = __posix_acl_chmod(&acl, GFP_NOFS, attr->ia_mode);
166 if (error) 166 if (error)
167 return error; 167 return error;
168 168
diff --git a/fs/hfsplus/posix_acl.c b/fs/hfsplus/posix_acl.c
index b609cc14c72e..cab5fd6fdb72 100644
--- a/fs/hfsplus/posix_acl.c
+++ b/fs/hfsplus/posix_acl.c
@@ -167,7 +167,7 @@ int hfsplus_posix_acl_chmod(struct inode *inode)
167 if (IS_ERR(acl) || !acl) 167 if (IS_ERR(acl) || !acl)
168 return PTR_ERR(acl); 168 return PTR_ERR(acl);
169 169
170 err = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 170 err = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
171 if (unlikely(err)) 171 if (unlikely(err))
172 return err; 172 return err;
173 173
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 223283c30111..5853969a51bc 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -335,7 +335,7 @@ int jffs2_acl_chmod(struct inode *inode)
335 acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); 335 acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
336 if (IS_ERR(acl) || !acl) 336 if (IS_ERR(acl) || !acl)
337 return PTR_ERR(acl); 337 return PTR_ERR(acl);
338 rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 338 rc = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
339 if (rc) 339 if (rc)
340 return rc; 340 return rc;
341 rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, acl); 341 rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, acl);
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index d254d6d35995..9c0fca8073da 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -161,7 +161,7 @@ int jfs_acl_chmod(struct inode *inode)
161 if (IS_ERR(acl) || !acl) 161 if (IS_ERR(acl) || !acl)
162 return PTR_ERR(acl); 162 return PTR_ERR(acl);
163 163
164 rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 164 rc = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
165 if (rc) 165 if (rc)
166 return rc; 166 return rc;
167 167
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index b4f788e0ca31..73ccf0e22ec5 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -350,7 +350,7 @@ int ocfs2_acl_chmod(struct inode *inode)
350 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS); 350 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
351 if (IS_ERR(acl) || !acl) 351 if (IS_ERR(acl) || !acl)
352 return PTR_ERR(acl); 352 return PTR_ERR(acl);
353 ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 353 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
354 if (ret) 354 if (ret)
355 return ret; 355 return ret;
356 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS, 356 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index e699b076cdd8..08218550b0db 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -364,7 +364,7 @@ static int posix_acl_create_masq(struct posix_acl *acl, umode_t *mode_p)
364/* 364/*
365 * Modify the ACL for the chmod syscall. 365 * Modify the ACL for the chmod syscall.
366 */ 366 */
367static int posix_acl_chmod_masq(struct posix_acl *acl, umode_t mode) 367static int __posix_acl_chmod_masq(struct posix_acl *acl, umode_t mode)
368{ 368{
369 struct posix_acl_entry *group_obj = NULL, *mask_obj = NULL; 369 struct posix_acl_entry *group_obj = NULL, *mask_obj = NULL;
370 struct posix_acl_entry *pa, *pe; 370 struct posix_acl_entry *pa, *pe;
@@ -428,12 +428,12 @@ posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p)
428EXPORT_SYMBOL(posix_acl_create); 428EXPORT_SYMBOL(posix_acl_create);
429 429
430int 430int
431posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode) 431__posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
432{ 432{
433 struct posix_acl *clone = posix_acl_clone(*acl, gfp); 433 struct posix_acl *clone = posix_acl_clone(*acl, gfp);
434 int err = -ENOMEM; 434 int err = -ENOMEM;
435 if (clone) { 435 if (clone) {
436 err = posix_acl_chmod_masq(clone, mode); 436 err = __posix_acl_chmod_masq(clone, mode);
437 if (err) { 437 if (err) {
438 posix_acl_release(clone); 438 posix_acl_release(clone);
439 clone = NULL; 439 clone = NULL;
@@ -443,6 +443,30 @@ posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
443 *acl = clone; 443 *acl = clone;
444 return err; 444 return err;
445} 445}
446EXPORT_SYMBOL(__posix_acl_chmod);
447
448int
449posix_acl_chmod(struct inode *inode)
450{
451 struct posix_acl *acl;
452 int ret = 0;
453
454 if (!IS_POSIXACL(inode))
455 return 0;
456 if (!inode->i_op->set_acl)
457 return -EOPNOTSUPP;
458
459 acl = get_acl(inode, ACL_TYPE_ACCESS);
460 if (IS_ERR_OR_NULL(acl))
461 return PTR_ERR(acl);
462
463 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
464 if (ret)
465 return ret;
466 ret = inode->i_op->set_acl(inode, acl, ACL_TYPE_ACCESS);
467 posix_acl_release(acl);
468 return ret;
469}
446EXPORT_SYMBOL(posix_acl_chmod); 470EXPORT_SYMBOL(posix_acl_chmod);
447 471
448/* 472/*
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 6f721ea94039..ea4e44351f76 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -463,7 +463,7 @@ int reiserfs_acl_chmod(struct inode *inode)
463 return 0; 463 return 0;
464 if (IS_ERR(acl)) 464 if (IS_ERR(acl))
465 return PTR_ERR(acl); 465 return PTR_ERR(acl);
466 error = posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode); 466 error = __posix_acl_chmod(&acl, GFP_NOFS, inode->i_mode);
467 if (error) 467 if (error)
468 return error; 468 return error;
469 469
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 370eb3e121d1..4eac1058b680 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -334,7 +334,7 @@ xfs_acl_chmod(struct inode *inode)
334 if (IS_ERR(acl) || !acl) 334 if (IS_ERR(acl) || !acl)
335 return PTR_ERR(acl); 335 return PTR_ERR(acl);
336 336
337 error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 337 error = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
338 if (error) 338 if (error)
339 return error; 339 return error;
340 340
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index a8d9918c0b20..8b64e7899989 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -89,12 +89,14 @@ extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
89extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t); 89extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
90extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *); 90extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
91extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *); 91extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
92extern int posix_acl_chmod(struct posix_acl **, gfp_t, umode_t); 92extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
93 93
94extern struct posix_acl *get_posix_acl(struct inode *, int); 94extern struct posix_acl *get_posix_acl(struct inode *, int);
95extern int set_posix_acl(struct inode *, int, struct posix_acl *); 95extern int set_posix_acl(struct inode *, int, struct posix_acl *);
96 96
97#ifdef CONFIG_FS_POSIX_ACL 97#ifdef CONFIG_FS_POSIX_ACL
98extern int posix_acl_chmod(struct inode *);
99
98static inline struct posix_acl **acl_by_type(struct inode *inode, int type) 100static inline struct posix_acl **acl_by_type(struct inode *inode, int type)
99{ 101{
100 switch (type) { 102 switch (type) {
@@ -165,15 +167,22 @@ static inline void forget_all_cached_acls(struct inode *inode)
165 if (old_default != ACL_NOT_CACHED) 167 if (old_default != ACL_NOT_CACHED)
166 posix_acl_release(old_default); 168 posix_acl_release(old_default);
167} 169}
168#endif
169 170
170static inline void cache_no_acl(struct inode *inode) 171static inline void cache_no_acl(struct inode *inode)
171{ 172{
172#ifdef CONFIG_FS_POSIX_ACL
173 inode->i_acl = NULL; 173 inode->i_acl = NULL;
174 inode->i_default_acl = NULL; 174 inode->i_default_acl = NULL;
175#endif
176} 175}
176#else
177static inline int posix_acl_chmod(struct inode *inode)
178{
179 return 0;
180}
181
182static inline void cache_no_acl(struct inode *inode)
183{
184}
185#endif /* CONFIG_FS_POSIX_ACL */
177 186
178struct posix_acl *get_acl(struct inode *inode, int type); 187struct posix_acl *get_acl(struct inode *inode, int type);
179 188