diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-23 03:10:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:27:32 -0400 |
commit | 826cae2f2b4d726b925f43bc208a571639da4761 (patch) | |
tree | b7f83eecf3bde8c4e455d89c7c535988b3e8bd59 /fs/jfs | |
parent | 95203befa8887997f14077d8557e67d78457ee02 (diff) |
kill boilerplates around posix_acl_create_masq()
new helper: posix_acl_create(&acl, gfp, mode_p). Replaces acl with
modified clone, on failure releases acl and replaces with NULL.
Returns 0 or -ve on error. All callers of posix_acl_create_masq()
switched.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/acl.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 89ced71e225a..687a1ae42e3f 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -133,8 +133,6 @@ int jfs_check_acl(struct inode *inode, int mask) | |||
133 | int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir) | 133 | int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir) |
134 | { | 134 | { |
135 | struct posix_acl *acl = NULL; | 135 | struct posix_acl *acl = NULL; |
136 | struct posix_acl *clone; | ||
137 | mode_t mode; | ||
138 | int rc = 0; | 136 | int rc = 0; |
139 | 137 | ||
140 | if (S_ISLNK(inode->i_mode)) | 138 | if (S_ISLNK(inode->i_mode)) |
@@ -145,25 +143,18 @@ int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir) | |||
145 | return PTR_ERR(acl); | 143 | return PTR_ERR(acl); |
146 | 144 | ||
147 | if (acl) { | 145 | if (acl) { |
146 | mode_t mode = inode->i_mode; | ||
148 | if (S_ISDIR(inode->i_mode)) { | 147 | if (S_ISDIR(inode->i_mode)) { |
149 | rc = jfs_set_acl(tid, inode, ACL_TYPE_DEFAULT, acl); | 148 | rc = jfs_set_acl(tid, inode, ACL_TYPE_DEFAULT, acl); |
150 | if (rc) | 149 | if (rc) |
151 | goto cleanup; | 150 | goto cleanup; |
152 | } | 151 | } |
153 | clone = posix_acl_clone(acl, GFP_KERNEL); | 152 | rc = posix_acl_create(&acl, GFP_KERNEL, &mode); |
154 | if (!clone) { | 153 | if (rc < 0) |
155 | rc = -ENOMEM; | 154 | goto cleanup; /* posix_acl_release(NULL) is no-op */ |
156 | goto cleanup; | 155 | inode->i_mode = mode; |
157 | } | 156 | if (rc > 0) |
158 | mode = inode->i_mode; | 157 | rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, acl); |
159 | rc = posix_acl_create_masq(clone, &mode); | ||
160 | if (rc >= 0) { | ||
161 | inode->i_mode = mode; | ||
162 | if (rc > 0) | ||
163 | rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, | ||
164 | clone); | ||
165 | } | ||
166 | posix_acl_release(clone); | ||
167 | cleanup: | 158 | cleanup: |
168 | posix_acl_release(acl); | 159 | posix_acl_release(acl); |
169 | } else | 160 | } else |