diff options
-rw-r--r-- | fs/ext2/acl.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index 79dafa71effd..069c0dceda01 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
@@ -175,11 +175,8 @@ ext2_get_acl(struct inode *inode, int type) | |||
175 | return acl; | 175 | return acl; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* | 178 | static int |
179 | * inode->i_mutex: down | 179 | __ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
180 | */ | ||
181 | int | ||
182 | ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) | ||
183 | { | 180 | { |
184 | int name_index; | 181 | int name_index; |
185 | void *value = NULL; | 182 | void *value = NULL; |
@@ -189,13 +186,6 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
189 | switch(type) { | 186 | switch(type) { |
190 | case ACL_TYPE_ACCESS: | 187 | case ACL_TYPE_ACCESS: |
191 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; | 188 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; |
192 | if (acl) { | ||
193 | error = posix_acl_update_mode(inode, &inode->i_mode, &acl); | ||
194 | if (error) | ||
195 | return error; | ||
196 | inode->i_ctime = current_time(inode); | ||
197 | mark_inode_dirty(inode); | ||
198 | } | ||
199 | break; | 189 | break; |
200 | 190 | ||
201 | case ACL_TYPE_DEFAULT: | 191 | case ACL_TYPE_DEFAULT: |
@@ -222,6 +212,24 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
222 | } | 212 | } |
223 | 213 | ||
224 | /* | 214 | /* |
215 | * inode->i_mutex: down | ||
216 | */ | ||
217 | int | ||
218 | ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) | ||
219 | { | ||
220 | int error; | ||
221 | |||
222 | if (type == ACL_TYPE_ACCESS && acl) { | ||
223 | error = posix_acl_update_mode(inode, &inode->i_mode, &acl); | ||
224 | if (error) | ||
225 | return error; | ||
226 | inode->i_ctime = current_time(inode); | ||
227 | mark_inode_dirty(inode); | ||
228 | } | ||
229 | return __ext2_set_acl(inode, acl, type); | ||
230 | } | ||
231 | |||
232 | /* | ||
225 | * Initialize the ACLs of a new inode. Called from ext2_new_inode. | 233 | * Initialize the ACLs of a new inode. Called from ext2_new_inode. |
226 | * | 234 | * |
227 | * dir->i_mutex: down | 235 | * dir->i_mutex: down |
@@ -238,12 +246,12 @@ ext2_init_acl(struct inode *inode, struct inode *dir) | |||
238 | return error; | 246 | return error; |
239 | 247 | ||
240 | if (default_acl) { | 248 | if (default_acl) { |
241 | error = ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); | 249 | error = __ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); |
242 | posix_acl_release(default_acl); | 250 | posix_acl_release(default_acl); |
243 | } | 251 | } |
244 | if (acl) { | 252 | if (acl) { |
245 | if (!error) | 253 | if (!error) |
246 | error = ext2_set_acl(inode, acl, ACL_TYPE_ACCESS); | 254 | error = __ext2_set_acl(inode, acl, ACL_TYPE_ACCESS); |
247 | posix_acl_release(acl); | 255 | posix_acl_release(acl); |
248 | } | 256 | } |
249 | return error; | 257 | return error; |