diff options
Diffstat (limited to 'fs/reiserfs/xattr_acl.c')
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index a6ce532402dc..44503e293790 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -25,8 +25,10 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
25 | int size = acl ? posix_acl_xattr_size(acl->a_count) : 0; | 25 | int size = acl ? posix_acl_xattr_size(acl->a_count) : 0; |
26 | 26 | ||
27 | 27 | ||
28 | /* Pessimism: We can't assume that anything from the xattr root up | 28 | /* |
29 | * has been created. */ | 29 | * Pessimism: We can't assume that anything from the xattr root up |
30 | * has been created. | ||
31 | */ | ||
30 | 32 | ||
31 | jcreate_blocks = reiserfs_xattr_jcreate_nblocks(inode) + | 33 | jcreate_blocks = reiserfs_xattr_jcreate_nblocks(inode) + |
32 | reiserfs_xattr_nblocks(inode, size) * 2; | 34 | reiserfs_xattr_nblocks(inode, size) * 2; |
@@ -37,7 +39,7 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
37 | if (error == 0) { | 39 | if (error == 0) { |
38 | error = __reiserfs_set_acl(&th, inode, type, acl); | 40 | error = __reiserfs_set_acl(&th, inode, type, acl); |
39 | reiserfs_write_lock(inode->i_sb); | 41 | reiserfs_write_lock(inode->i_sb); |
40 | error2 = journal_end(&th, inode->i_sb, jcreate_blocks); | 42 | error2 = journal_end(&th); |
41 | reiserfs_write_unlock(inode->i_sb); | 43 | reiserfs_write_unlock(inode->i_sb); |
42 | if (error2) | 44 | if (error2) |
43 | error = error2; | 45 | error = error2; |
@@ -111,7 +113,7 @@ static struct posix_acl *reiserfs_posix_acl_from_disk(const void *value, size_t | |||
111 | goto fail; | 113 | goto fail; |
112 | return acl; | 114 | return acl; |
113 | 115 | ||
114 | fail: | 116 | fail: |
115 | posix_acl_release(acl); | 117 | posix_acl_release(acl); |
116 | return ERR_PTR(-EINVAL); | 118 | return ERR_PTR(-EINVAL); |
117 | } | 119 | } |
@@ -164,7 +166,7 @@ static void *reiserfs_posix_acl_to_disk(const struct posix_acl *acl, size_t * si | |||
164 | } | 166 | } |
165 | return (char *)ext_acl; | 167 | return (char *)ext_acl; |
166 | 168 | ||
167 | fail: | 169 | fail: |
168 | kfree(ext_acl); | 170 | kfree(ext_acl); |
169 | return ERR_PTR(-EINVAL); | 171 | return ERR_PTR(-EINVAL); |
170 | } | 172 | } |
@@ -208,8 +210,10 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
208 | 210 | ||
209 | retval = reiserfs_xattr_get(inode, name, value, size); | 211 | retval = reiserfs_xattr_get(inode, name, value, size); |
210 | if (retval == -ENODATA || retval == -ENOSYS) { | 212 | if (retval == -ENODATA || retval == -ENOSYS) { |
211 | /* This shouldn't actually happen as it should have | 213 | /* |
212 | been caught above.. but just in case */ | 214 | * This shouldn't actually happen as it should have |
215 | * been caught above.. but just in case | ||
216 | */ | ||
213 | acl = NULL; | 217 | acl = NULL; |
214 | } else if (retval < 0) { | 218 | } else if (retval < 0) { |
215 | acl = ERR_PTR(retval); | 219 | acl = ERR_PTR(retval); |
@@ -290,8 +294,10 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, | |||
290 | return error; | 294 | return error; |
291 | } | 295 | } |
292 | 296 | ||
293 | /* dir->i_mutex: locked, | 297 | /* |
294 | * inode is new and not released into the wild yet */ | 298 | * dir->i_mutex: locked, |
299 | * inode is new and not released into the wild yet | ||
300 | */ | ||
295 | int | 301 | int |
296 | reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | 302 | reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, |
297 | struct inode *dir, struct dentry *dentry, | 303 | struct inode *dir, struct dentry *dentry, |
@@ -304,14 +310,18 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | |||
304 | if (S_ISLNK(inode->i_mode)) | 310 | if (S_ISLNK(inode->i_mode)) |
305 | return 0; | 311 | return 0; |
306 | 312 | ||
307 | /* ACLs can only be used on "new" objects, so if it's an old object | 313 | /* |
308 | * there is nothing to inherit from */ | 314 | * ACLs can only be used on "new" objects, so if it's an old object |
315 | * there is nothing to inherit from | ||
316 | */ | ||
309 | if (get_inode_sd_version(dir) == STAT_DATA_V1) | 317 | if (get_inode_sd_version(dir) == STAT_DATA_V1) |
310 | goto apply_umask; | 318 | goto apply_umask; |
311 | 319 | ||
312 | /* Don't apply ACLs to objects in the .reiserfs_priv tree.. This | 320 | /* |
321 | * Don't apply ACLs to objects in the .reiserfs_priv tree.. This | ||
313 | * would be useless since permissions are ignored, and a pain because | 322 | * would be useless since permissions are ignored, and a pain because |
314 | * it introduces locking cycles */ | 323 | * it introduces locking cycles |
324 | */ | ||
315 | if (IS_PRIVATE(dir)) { | 325 | if (IS_PRIVATE(dir)) { |
316 | inode->i_flags |= S_PRIVATE; | 326 | inode->i_flags |= S_PRIVATE; |
317 | goto apply_umask; | 327 | goto apply_umask; |
@@ -335,7 +345,7 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | |||
335 | 345 | ||
336 | return err; | 346 | return err; |
337 | 347 | ||
338 | apply_umask: | 348 | apply_umask: |
339 | /* no ACL, apply umask */ | 349 | /* no ACL, apply umask */ |
340 | inode->i_mode &= ~current_umask(); | 350 | inode->i_mode &= ~current_umask(); |
341 | return err; | 351 | return err; |