diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2012-10-09 10:03:21 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-10-09 10:04:25 -0400 |
commit | ffe315012510165ce82e4dd4767f0a5dba9edbf7 (patch) | |
tree | f601cd980af9d0ced5ca9aedecef4fa0d2ca0e15 /fs/jffs2 | |
parent | e2d3a35ee427aaba99b6c68a56609ce276c51270 (diff) | |
parent | 4a8e43feeac7996b8de2d5b2823e316917493df4 (diff) |
Merge tag 'disintegrate-mtd-20121009' of git://git.infradead.org/users/dhowells/linux-headers
UAPI Disintegration 2012-10-09
Conflicts:
MAINTAINERS
arch/arm/configs/bcmring_defconfig
arch/arm/mach-imx/clk-imx51-imx53.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/bcm_umi_nand.c
drivers/mtd/nand/nand_bcm_umi.h
drivers/mtd/nand/orion_nand.c
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/acl.c | 30 | ||||
-rw-r--r-- | fs/jffs2/file.c | 8 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 24 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 4 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 13 | ||||
-rw-r--r-- | fs/jffs2/super.c | 6 |
6 files changed, 55 insertions, 30 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 922f146e4235..223283c30111 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -94,15 +94,23 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size) | |||
94 | case ACL_MASK: | 94 | case ACL_MASK: |
95 | case ACL_OTHER: | 95 | case ACL_OTHER: |
96 | value += sizeof(struct jffs2_acl_entry_short); | 96 | value += sizeof(struct jffs2_acl_entry_short); |
97 | acl->a_entries[i].e_id = ACL_UNDEFINED_ID; | ||
98 | break; | 97 | break; |
99 | 98 | ||
100 | case ACL_USER: | 99 | case ACL_USER: |
100 | value += sizeof(struct jffs2_acl_entry); | ||
101 | if (value > end) | ||
102 | goto fail; | ||
103 | acl->a_entries[i].e_uid = | ||
104 | make_kuid(&init_user_ns, | ||
105 | je32_to_cpu(entry->e_id)); | ||
106 | break; | ||
101 | case ACL_GROUP: | 107 | case ACL_GROUP: |
102 | value += sizeof(struct jffs2_acl_entry); | 108 | value += sizeof(struct jffs2_acl_entry); |
103 | if (value > end) | 109 | if (value > end) |
104 | goto fail; | 110 | goto fail; |
105 | acl->a_entries[i].e_id = je32_to_cpu(entry->e_id); | 111 | acl->a_entries[i].e_gid = |
112 | make_kgid(&init_user_ns, | ||
113 | je32_to_cpu(entry->e_id)); | ||
106 | break; | 114 | break; |
107 | 115 | ||
108 | default: | 116 | default: |
@@ -131,13 +139,19 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size) | |||
131 | header->a_version = cpu_to_je32(JFFS2_ACL_VERSION); | 139 | header->a_version = cpu_to_je32(JFFS2_ACL_VERSION); |
132 | e = header + 1; | 140 | e = header + 1; |
133 | for (i=0; i < acl->a_count; i++) { | 141 | for (i=0; i < acl->a_count; i++) { |
142 | const struct posix_acl_entry *acl_e = &acl->a_entries[i]; | ||
134 | entry = e; | 143 | entry = e; |
135 | entry->e_tag = cpu_to_je16(acl->a_entries[i].e_tag); | 144 | entry->e_tag = cpu_to_je16(acl_e->e_tag); |
136 | entry->e_perm = cpu_to_je16(acl->a_entries[i].e_perm); | 145 | entry->e_perm = cpu_to_je16(acl_e->e_perm); |
137 | switch(acl->a_entries[i].e_tag) { | 146 | switch(acl_e->e_tag) { |
138 | case ACL_USER: | 147 | case ACL_USER: |
148 | entry->e_id = cpu_to_je32( | ||
149 | from_kuid(&init_user_ns, acl_e->e_uid)); | ||
150 | e += sizeof(struct jffs2_acl_entry); | ||
151 | break; | ||
139 | case ACL_GROUP: | 152 | case ACL_GROUP: |
140 | entry->e_id = cpu_to_je32(acl->a_entries[i].e_id); | 153 | entry->e_id = cpu_to_je32( |
154 | from_kgid(&init_user_ns, acl_e->e_gid)); | ||
141 | e += sizeof(struct jffs2_acl_entry); | 155 | e += sizeof(struct jffs2_acl_entry); |
142 | break; | 156 | break; |
143 | 157 | ||
@@ -363,7 +377,7 @@ static int jffs2_acl_getxattr(struct dentry *dentry, const char *name, | |||
363 | return PTR_ERR(acl); | 377 | return PTR_ERR(acl); |
364 | if (!acl) | 378 | if (!acl) |
365 | return -ENODATA; | 379 | return -ENODATA; |
366 | rc = posix_acl_to_xattr(acl, buffer, size); | 380 | rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); |
367 | posix_acl_release(acl); | 381 | posix_acl_release(acl); |
368 | 382 | ||
369 | return rc; | 383 | return rc; |
@@ -381,7 +395,7 @@ static int jffs2_acl_setxattr(struct dentry *dentry, const char *name, | |||
381 | return -EPERM; | 395 | return -EPERM; |
382 | 396 | ||
383 | if (value) { | 397 | if (value) { |
384 | acl = posix_acl_from_xattr(value, size); | 398 | acl = posix_acl_from_xattr(&init_user_ns, value, size); |
385 | if (IS_ERR(acl)) | 399 | if (IS_ERR(acl)) |
386 | return PTR_ERR(acl); | 400 | return PTR_ERR(acl); |
387 | if (acl) { | 401 | if (acl) { |
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index db3889ba8818..60ef3fb707ff 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -175,8 +175,8 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | |||
175 | ri.ino = cpu_to_je32(f->inocache->ino); | 175 | ri.ino = cpu_to_je32(f->inocache->ino); |
176 | ri.version = cpu_to_je32(++f->highest_version); | 176 | ri.version = cpu_to_je32(++f->highest_version); |
177 | ri.mode = cpu_to_jemode(inode->i_mode); | 177 | ri.mode = cpu_to_jemode(inode->i_mode); |
178 | ri.uid = cpu_to_je16(inode->i_uid); | 178 | ri.uid = cpu_to_je16(i_uid_read(inode)); |
179 | ri.gid = cpu_to_je16(inode->i_gid); | 179 | ri.gid = cpu_to_je16(i_gid_read(inode)); |
180 | ri.isize = cpu_to_je32(max((uint32_t)inode->i_size, pageofs)); | 180 | ri.isize = cpu_to_je32(max((uint32_t)inode->i_size, pageofs)); |
181 | ri.atime = ri.ctime = ri.mtime = cpu_to_je32(get_seconds()); | 181 | ri.atime = ri.ctime = ri.mtime = cpu_to_je32(get_seconds()); |
182 | ri.offset = cpu_to_je32(inode->i_size); | 182 | ri.offset = cpu_to_je32(inode->i_size); |
@@ -283,8 +283,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, | |||
283 | /* Set the fields that the generic jffs2_write_inode_range() code can't find */ | 283 | /* Set the fields that the generic jffs2_write_inode_range() code can't find */ |
284 | ri->ino = cpu_to_je32(inode->i_ino); | 284 | ri->ino = cpu_to_je32(inode->i_ino); |
285 | ri->mode = cpu_to_jemode(inode->i_mode); | 285 | ri->mode = cpu_to_jemode(inode->i_mode); |
286 | ri->uid = cpu_to_je16(inode->i_uid); | 286 | ri->uid = cpu_to_je16(i_uid_read(inode)); |
287 | ri->gid = cpu_to_je16(inode->i_gid); | 287 | ri->gid = cpu_to_je16(i_gid_read(inode)); |
288 | ri->isize = cpu_to_je32((uint32_t)inode->i_size); | 288 | ri->isize = cpu_to_je32((uint32_t)inode->i_size); |
289 | ri->atime = ri->ctime = ri->mtime = cpu_to_je32(get_seconds()); | 289 | ri->atime = ri->ctime = ri->mtime = cpu_to_je32(get_seconds()); |
290 | 290 | ||
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 3d3092eda811..fe3c0527545f 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -99,8 +99,10 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
99 | ri->ino = cpu_to_je32(inode->i_ino); | 99 | ri->ino = cpu_to_je32(inode->i_ino); |
100 | ri->version = cpu_to_je32(++f->highest_version); | 100 | ri->version = cpu_to_je32(++f->highest_version); |
101 | 101 | ||
102 | ri->uid = cpu_to_je16((ivalid & ATTR_UID)?iattr->ia_uid:inode->i_uid); | 102 | ri->uid = cpu_to_je16((ivalid & ATTR_UID)? |
103 | ri->gid = cpu_to_je16((ivalid & ATTR_GID)?iattr->ia_gid:inode->i_gid); | 103 | from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode)); |
104 | ri->gid = cpu_to_je16((ivalid & ATTR_GID)? | ||
105 | from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode)); | ||
104 | 106 | ||
105 | if (ivalid & ATTR_MODE) | 107 | if (ivalid & ATTR_MODE) |
106 | ri->mode = cpu_to_jemode(iattr->ia_mode); | 108 | ri->mode = cpu_to_jemode(iattr->ia_mode); |
@@ -147,8 +149,8 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
147 | inode->i_ctime = ITIME(je32_to_cpu(ri->ctime)); | 149 | inode->i_ctime = ITIME(je32_to_cpu(ri->ctime)); |
148 | inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); | 150 | inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); |
149 | inode->i_mode = jemode_to_cpu(ri->mode); | 151 | inode->i_mode = jemode_to_cpu(ri->mode); |
150 | inode->i_uid = je16_to_cpu(ri->uid); | 152 | i_uid_write(inode, je16_to_cpu(ri->uid)); |
151 | inode->i_gid = je16_to_cpu(ri->gid); | 153 | i_gid_write(inode, je16_to_cpu(ri->gid)); |
152 | 154 | ||
153 | 155 | ||
154 | old_metadata = f->metadata; | 156 | old_metadata = f->metadata; |
@@ -276,8 +278,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) | |||
276 | return ERR_PTR(ret); | 278 | return ERR_PTR(ret); |
277 | } | 279 | } |
278 | inode->i_mode = jemode_to_cpu(latest_node.mode); | 280 | inode->i_mode = jemode_to_cpu(latest_node.mode); |
279 | inode->i_uid = je16_to_cpu(latest_node.uid); | 281 | i_uid_write(inode, je16_to_cpu(latest_node.uid)); |
280 | inode->i_gid = je16_to_cpu(latest_node.gid); | 282 | i_gid_write(inode, je16_to_cpu(latest_node.gid)); |
281 | inode->i_size = je32_to_cpu(latest_node.isize); | 283 | inode->i_size = je32_to_cpu(latest_node.isize); |
282 | inode->i_atime = ITIME(je32_to_cpu(latest_node.atime)); | 284 | inode->i_atime = ITIME(je32_to_cpu(latest_node.atime)); |
283 | inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); | 285 | inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); |
@@ -440,14 +442,14 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r | |||
440 | 442 | ||
441 | memset(ri, 0, sizeof(*ri)); | 443 | memset(ri, 0, sizeof(*ri)); |
442 | /* Set OS-specific defaults for new inodes */ | 444 | /* Set OS-specific defaults for new inodes */ |
443 | ri->uid = cpu_to_je16(current_fsuid()); | 445 | ri->uid = cpu_to_je16(from_kuid(&init_user_ns, current_fsuid())); |
444 | 446 | ||
445 | if (dir_i->i_mode & S_ISGID) { | 447 | if (dir_i->i_mode & S_ISGID) { |
446 | ri->gid = cpu_to_je16(dir_i->i_gid); | 448 | ri->gid = cpu_to_je16(i_gid_read(dir_i)); |
447 | if (S_ISDIR(mode)) | 449 | if (S_ISDIR(mode)) |
448 | mode |= S_ISGID; | 450 | mode |= S_ISGID; |
449 | } else { | 451 | } else { |
450 | ri->gid = cpu_to_je16(current_fsgid()); | 452 | ri->gid = cpu_to_je16(from_kgid(&init_user_ns, current_fsgid())); |
451 | } | 453 | } |
452 | 454 | ||
453 | /* POSIX ACLs have to be processed now, at least partly. | 455 | /* POSIX ACLs have to be processed now, at least partly. |
@@ -467,8 +469,8 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r | |||
467 | set_nlink(inode, 1); | 469 | set_nlink(inode, 1); |
468 | inode->i_ino = je32_to_cpu(ri->ino); | 470 | inode->i_ino = je32_to_cpu(ri->ino); |
469 | inode->i_mode = jemode_to_cpu(ri->mode); | 471 | inode->i_mode = jemode_to_cpu(ri->mode); |
470 | inode->i_gid = je16_to_cpu(ri->gid); | 472 | i_gid_write(inode, je16_to_cpu(ri->gid)); |
471 | inode->i_uid = je16_to_cpu(ri->uid); | 473 | i_uid_write(inode, je16_to_cpu(ri->uid)); |
472 | inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; | 474 | inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; |
473 | ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime)); | 475 | ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime)); |
474 | 476 | ||
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index bcd983d7e7f9..d200a9b8fd5e 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -27,8 +27,8 @@ struct kvec; | |||
27 | 27 | ||
28 | #define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) | 28 | #define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) |
29 | #define JFFS2_F_I_MODE(f) (OFNI_EDONI_2SFFJ(f)->i_mode) | 29 | #define JFFS2_F_I_MODE(f) (OFNI_EDONI_2SFFJ(f)->i_mode) |
30 | #define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) | 30 | #define JFFS2_F_I_UID(f) (i_uid_read(OFNI_EDONI_2SFFJ(f))) |
31 | #define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) | 31 | #define JFFS2_F_I_GID(f) (i_gid_read(OFNI_EDONI_2SFFJ(f))) |
32 | #define JFFS2_F_I_RDEV(f) (OFNI_EDONI_2SFFJ(f)->i_rdev) | 32 | #define JFFS2_F_I_RDEV(f) (OFNI_EDONI_2SFFJ(f)->i_rdev) |
33 | 33 | ||
34 | #define ITIME(sec) ((struct timespec){sec, 0}) | 34 | #define ITIME(sec) ((struct timespec){sec, 0}) |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 1ea349fff68b..ae81b01e6fd7 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -394,8 +394,11 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, | |||
394 | } | 394 | } |
395 | 395 | ||
396 | /* Trivial function to remove the last node in the tree. Which by definition | 396 | /* Trivial function to remove the last node in the tree. Which by definition |
397 | has no right-hand -- so can be removed just by making its only child (if | 397 | has no right-hand child — so can be removed just by making its left-hand |
398 | any) take its place under its parent. */ | 398 | child (if any) take its place under its parent. Since this is only done |
399 | when we're consuming the whole tree, there's no need to use rb_erase() | ||
400 | and let it worry about adjusting colours and balancing the tree. That | ||
401 | would just be a waste of time. */ | ||
399 | static void eat_last(struct rb_root *root, struct rb_node *node) | 402 | static void eat_last(struct rb_root *root, struct rb_node *node) |
400 | { | 403 | { |
401 | struct rb_node *parent = rb_parent(node); | 404 | struct rb_node *parent = rb_parent(node); |
@@ -412,12 +415,12 @@ static void eat_last(struct rb_root *root, struct rb_node *node) | |||
412 | link = &parent->rb_right; | 415 | link = &parent->rb_right; |
413 | 416 | ||
414 | *link = node->rb_left; | 417 | *link = node->rb_left; |
415 | /* Colour doesn't matter now. Only the parent pointer. */ | ||
416 | if (node->rb_left) | 418 | if (node->rb_left) |
417 | node->rb_left->rb_parent_color = node->rb_parent_color; | 419 | node->rb_left->__rb_parent_color = node->__rb_parent_color; |
418 | } | 420 | } |
419 | 421 | ||
420 | /* We put this in reverse order, so we can just use eat_last */ | 422 | /* We put the version tree in reverse order, so we can use the same eat_last() |
423 | function that we use to consume the tmpnode tree (tn_root). */ | ||
421 | static void ver_insert(struct rb_root *ver_root, struct jffs2_tmp_dnode_info *tn) | 424 | static void ver_insert(struct rb_root *ver_root, struct jffs2_tmp_dnode_info *tn) |
422 | { | 425 | { |
423 | struct rb_node **link = &ver_root->rb_node; | 426 | struct rb_node **link = &ver_root->rb_node; |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 1224d6b48e7e..d3d8799e2187 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -422,6 +422,12 @@ static void __exit exit_jffs2_fs(void) | |||
422 | unregister_filesystem(&jffs2_fs_type); | 422 | unregister_filesystem(&jffs2_fs_type); |
423 | jffs2_destroy_slab_caches(); | 423 | jffs2_destroy_slab_caches(); |
424 | jffs2_compressors_exit(); | 424 | jffs2_compressors_exit(); |
425 | |||
426 | /* | ||
427 | * Make sure all delayed rcu free inodes are flushed before we | ||
428 | * destroy cache. | ||
429 | */ | ||
430 | rcu_barrier(); | ||
425 | kmem_cache_destroy(jffs2_inode_cachep); | 431 | kmem_cache_destroy(jffs2_inode_cachep); |
426 | } | 432 | } |
427 | 433 | ||