diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-08-22 07:39:19 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-08-22 07:39:19 -0400 |
commit | 9ed437c50d89eabae763dd422579f73fdebf288d (patch) | |
tree | 22329b749200798165a8a07fe141e9cbc3b1c733 /fs/jffs2/acl.c | |
parent | 09b3fba562ce366312b90a6f71d0b727b4d93ba9 (diff) |
[JFFS2] Fix ACL vs. mode handling.
When POSIX ACL support was enabled, we weren't writing correct
legacy modes to the medium on inode creation, or when the ACL was set.
This meant that the permissions would be incorrect after the file system
was remounted.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/acl.c')
-rw-r--r-- | fs/jffs2/acl.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 65b3a1b5b88d..8ec9323e830a 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -176,7 +176,7 @@ static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct | |||
176 | spin_unlock(&inode->i_lock); | 176 | spin_unlock(&inode->i_lock); |
177 | } | 177 | } |
178 | 178 | ||
179 | static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) | 179 | struct posix_acl *jffs2_get_acl(struct inode *inode, int type) |
180 | { | 180 | { |
181 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 181 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
182 | struct posix_acl *acl; | 182 | struct posix_acl *acl; |
@@ -247,8 +247,13 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
247 | if (rc < 0) | 247 | if (rc < 0) |
248 | return rc; | 248 | return rc; |
249 | if (inode->i_mode != mode) { | 249 | if (inode->i_mode != mode) { |
250 | inode->i_mode = mode; | 250 | struct iattr attr; |
251 | jffs2_dirty_inode(inode); | 251 | |
252 | attr.ia_valid = ATTR_MODE; | ||
253 | attr.ia_mode = mode; | ||
254 | rc = jffs2_do_setattr(inode, &attr); | ||
255 | if (rc < 0) | ||
256 | return rc; | ||
252 | } | 257 | } |
253 | if (rc == 0) | 258 | if (rc == 0) |
254 | acl = NULL; | 259 | acl = NULL; |
@@ -307,22 +312,16 @@ int jffs2_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
307 | return generic_permission(inode, mask, jffs2_check_acl); | 312 | return generic_permission(inode, mask, jffs2_check_acl); |
308 | } | 313 | } |
309 | 314 | ||
310 | int jffs2_init_acl(struct inode *inode, struct inode *dir) | 315 | int jffs2_init_acl(struct inode *inode, struct posix_acl *acl) |
311 | { | 316 | { |
312 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 317 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
313 | struct posix_acl *acl = NULL, *clone; | 318 | struct posix_acl *clone; |
314 | mode_t mode; | 319 | mode_t mode; |
315 | int rc = 0; | 320 | int rc = 0; |
316 | 321 | ||
317 | f->i_acl_access = JFFS2_ACL_NOT_CACHED; | 322 | f->i_acl_access = JFFS2_ACL_NOT_CACHED; |
318 | f->i_acl_default = JFFS2_ACL_NOT_CACHED; | 323 | f->i_acl_default = JFFS2_ACL_NOT_CACHED; |
319 | if (!S_ISLNK(inode->i_mode)) { | 324 | |
320 | acl = jffs2_get_acl(dir, ACL_TYPE_DEFAULT); | ||
321 | if (IS_ERR(acl)) | ||
322 | return PTR_ERR(acl); | ||
323 | if (!acl) | ||
324 | inode->i_mode &= ~current->fs->umask; | ||
325 | } | ||
326 | if (acl) { | 325 | if (acl) { |
327 | if (S_ISDIR(inode->i_mode)) { | 326 | if (S_ISDIR(inode->i_mode)) { |
328 | rc = jffs2_set_acl(inode, ACL_TYPE_DEFAULT, acl); | 327 | rc = jffs2_set_acl(inode, ACL_TYPE_DEFAULT, acl); |