diff options
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/acl.c | 4 | ||||
-rw-r--r-- | fs/jfs/file.c | 4 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 22 | ||||
-rw-r--r-- | fs/jfs/jfs_incore.h | 8 | ||||
-rw-r--r-- | fs/jfs/super.c | 28 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 4 |
6 files changed, 43 insertions, 27 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 45559dc3ea2f..d254d6d35995 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -64,7 +64,7 @@ struct posix_acl *jfs_get_acl(struct inode *inode, int type) | |||
64 | else | 64 | else |
65 | acl = ERR_PTR(size); | 65 | acl = ERR_PTR(size); |
66 | } else { | 66 | } else { |
67 | acl = posix_acl_from_xattr(value, size); | 67 | acl = posix_acl_from_xattr(&init_user_ns, value, size); |
68 | } | 68 | } |
69 | kfree(value); | 69 | kfree(value); |
70 | if (!IS_ERR(acl)) | 70 | if (!IS_ERR(acl)) |
@@ -100,7 +100,7 @@ static int jfs_set_acl(tid_t tid, struct inode *inode, int type, | |||
100 | value = kmalloc(size, GFP_KERNEL); | 100 | value = kmalloc(size, GFP_KERNEL); |
101 | if (!value) | 101 | if (!value) |
102 | return -ENOMEM; | 102 | return -ENOMEM; |
103 | rc = posix_acl_to_xattr(acl, value, size); | 103 | rc = posix_acl_to_xattr(&init_user_ns, acl, value, size); |
104 | if (rc < 0) | 104 | if (rc < 0) |
105 | goto out; | 105 | goto out; |
106 | } | 106 | } |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 844f9460cb11..9d3afd157f99 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -108,8 +108,8 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
108 | 108 | ||
109 | if (is_quota_modification(inode, iattr)) | 109 | if (is_quota_modification(inode, iattr)) |
110 | dquot_initialize(inode); | 110 | dquot_initialize(inode); |
111 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 111 | if ((iattr->ia_valid & ATTR_UID && !uid_eq(iattr->ia_uid, inode->i_uid)) || |
112 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 112 | (iattr->ia_valid & ATTR_GID && !gid_eq(iattr->ia_gid, inode->i_gid))) { |
113 | rc = dquot_transfer(inode, iattr); | 113 | rc = dquot_transfer(inode, iattr); |
114 | if (rc) | 114 | if (rc) |
115 | return rc; | 115 | return rc; |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 1b6f15f191b3..6ba4006e011b 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -3078,15 +3078,15 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) | |||
3078 | } | 3078 | } |
3079 | set_nlink(ip, le32_to_cpu(dip->di_nlink)); | 3079 | set_nlink(ip, le32_to_cpu(dip->di_nlink)); |
3080 | 3080 | ||
3081 | jfs_ip->saved_uid = le32_to_cpu(dip->di_uid); | 3081 | jfs_ip->saved_uid = make_kuid(&init_user_ns, le32_to_cpu(dip->di_uid)); |
3082 | if (sbi->uid == -1) | 3082 | if (!uid_valid(sbi->uid)) |
3083 | ip->i_uid = jfs_ip->saved_uid; | 3083 | ip->i_uid = jfs_ip->saved_uid; |
3084 | else { | 3084 | else { |
3085 | ip->i_uid = sbi->uid; | 3085 | ip->i_uid = sbi->uid; |
3086 | } | 3086 | } |
3087 | 3087 | ||
3088 | jfs_ip->saved_gid = le32_to_cpu(dip->di_gid); | 3088 | jfs_ip->saved_gid = make_kgid(&init_user_ns, le32_to_cpu(dip->di_gid)); |
3089 | if (sbi->gid == -1) | 3089 | if (!gid_valid(sbi->gid)) |
3090 | ip->i_gid = jfs_ip->saved_gid; | 3090 | ip->i_gid = jfs_ip->saved_gid; |
3091 | else { | 3091 | else { |
3092 | ip->i_gid = sbi->gid; | 3092 | ip->i_gid = sbi->gid; |
@@ -3150,14 +3150,16 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip) | |||
3150 | dip->di_size = cpu_to_le64(ip->i_size); | 3150 | dip->di_size = cpu_to_le64(ip->i_size); |
3151 | dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); | 3151 | dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks)); |
3152 | dip->di_nlink = cpu_to_le32(ip->i_nlink); | 3152 | dip->di_nlink = cpu_to_le32(ip->i_nlink); |
3153 | if (sbi->uid == -1) | 3153 | if (!uid_valid(sbi->uid)) |
3154 | dip->di_uid = cpu_to_le32(ip->i_uid); | 3154 | dip->di_uid = cpu_to_le32(i_uid_read(ip)); |
3155 | else | 3155 | else |
3156 | dip->di_uid = cpu_to_le32(jfs_ip->saved_uid); | 3156 | dip->di_uid =cpu_to_le32(from_kuid(&init_user_ns, |
3157 | if (sbi->gid == -1) | 3157 | jfs_ip->saved_uid)); |
3158 | dip->di_gid = cpu_to_le32(ip->i_gid); | 3158 | if (!gid_valid(sbi->gid)) |
3159 | dip->di_gid = cpu_to_le32(i_gid_read(ip)); | ||
3159 | else | 3160 | else |
3160 | dip->di_gid = cpu_to_le32(jfs_ip->saved_gid); | 3161 | dip->di_gid = cpu_to_le32(from_kgid(&init_user_ns, |
3162 | jfs_ip->saved_gid)); | ||
3161 | jfs_get_inode_flags(jfs_ip); | 3163 | jfs_get_inode_flags(jfs_ip); |
3162 | /* | 3164 | /* |
3163 | * mode2 is only needed for storing the higher order bits. | 3165 | * mode2 is only needed for storing the higher order bits. |
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h index 4fa958ae1986..cf47f09e8ac8 100644 --- a/fs/jfs/jfs_incore.h +++ b/fs/jfs/jfs_incore.h | |||
@@ -38,8 +38,8 @@ | |||
38 | struct jfs_inode_info { | 38 | struct jfs_inode_info { |
39 | int fileset; /* fileset number (always 16)*/ | 39 | int fileset; /* fileset number (always 16)*/ |
40 | uint mode2; /* jfs-specific mode */ | 40 | uint mode2; /* jfs-specific mode */ |
41 | uint saved_uid; /* saved for uid mount option */ | 41 | kuid_t saved_uid; /* saved for uid mount option */ |
42 | uint saved_gid; /* saved for gid mount option */ | 42 | kgid_t saved_gid; /* saved for gid mount option */ |
43 | pxd_t ixpxd; /* inode extent descriptor */ | 43 | pxd_t ixpxd; /* inode extent descriptor */ |
44 | dxd_t acl; /* dxd describing acl */ | 44 | dxd_t acl; /* dxd describing acl */ |
45 | dxd_t ea; /* dxd describing ea */ | 45 | dxd_t ea; /* dxd describing ea */ |
@@ -192,8 +192,8 @@ struct jfs_sb_info { | |||
192 | uint state; /* mount/recovery state */ | 192 | uint state; /* mount/recovery state */ |
193 | unsigned long flag; /* mount time flags */ | 193 | unsigned long flag; /* mount time flags */ |
194 | uint p_state; /* state prior to going no integrity */ | 194 | uint p_state; /* state prior to going no integrity */ |
195 | uint uid; /* uid to override on-disk uid */ | 195 | kuid_t uid; /* uid to override on-disk uid */ |
196 | uint gid; /* gid to override on-disk gid */ | 196 | kgid_t gid; /* gid to override on-disk gid */ |
197 | uint umask; /* umask to override on-disk umask */ | 197 | uint umask; /* umask to override on-disk umask */ |
198 | uint minblks_trim; /* minimum blocks, for online trim */ | 198 | uint minblks_trim; /* minimum blocks, for online trim */ |
199 | }; | 199 | }; |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 6f4ac1c070f0..1a543be09c79 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -322,14 +322,20 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
322 | case Opt_uid: | 322 | case Opt_uid: |
323 | { | 323 | { |
324 | char *uid = args[0].from; | 324 | char *uid = args[0].from; |
325 | sbi->uid = simple_strtoul(uid, &uid, 0); | 325 | uid_t val = simple_strtoul(uid, &uid, 0); |
326 | sbi->uid = make_kuid(current_user_ns(), val); | ||
327 | if (!uid_valid(sbi->uid)) | ||
328 | goto cleanup; | ||
326 | break; | 329 | break; |
327 | } | 330 | } |
328 | 331 | ||
329 | case Opt_gid: | 332 | case Opt_gid: |
330 | { | 333 | { |
331 | char *gid = args[0].from; | 334 | char *gid = args[0].from; |
332 | sbi->gid = simple_strtoul(gid, &gid, 0); | 335 | gid_t val = simple_strtoul(gid, &gid, 0); |
336 | sbi->gid = make_kgid(current_user_ns(), val); | ||
337 | if (!gid_valid(sbi->gid)) | ||
338 | goto cleanup; | ||
333 | break; | 339 | break; |
334 | } | 340 | } |
335 | 341 | ||
@@ -482,7 +488,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
482 | sb->s_fs_info = sbi; | 488 | sb->s_fs_info = sbi; |
483 | sb->s_max_links = JFS_LINK_MAX; | 489 | sb->s_max_links = JFS_LINK_MAX; |
484 | sbi->sb = sb; | 490 | sbi->sb = sb; |
485 | sbi->uid = sbi->gid = sbi->umask = -1; | 491 | sbi->uid = INVALID_UID; |
492 | sbi->gid = INVALID_GID; | ||
493 | sbi->umask = -1; | ||
486 | 494 | ||
487 | /* initialize the mount flag and determine the default error handler */ | 495 | /* initialize the mount flag and determine the default error handler */ |
488 | flag = JFS_ERR_REMOUNT_RO; | 496 | flag = JFS_ERR_REMOUNT_RO; |
@@ -656,10 +664,10 @@ static int jfs_show_options(struct seq_file *seq, struct dentry *root) | |||
656 | { | 664 | { |
657 | struct jfs_sb_info *sbi = JFS_SBI(root->d_sb); | 665 | struct jfs_sb_info *sbi = JFS_SBI(root->d_sb); |
658 | 666 | ||
659 | if (sbi->uid != -1) | 667 | if (uid_valid(sbi->uid)) |
660 | seq_printf(seq, ",uid=%d", sbi->uid); | 668 | seq_printf(seq, ",uid=%d", from_kuid(&init_user_ns, sbi->uid)); |
661 | if (sbi->gid != -1) | 669 | if (gid_valid(sbi->gid)) |
662 | seq_printf(seq, ",gid=%d", sbi->gid); | 670 | seq_printf(seq, ",gid=%d", from_kgid(&init_user_ns, sbi->gid)); |
663 | if (sbi->umask != -1) | 671 | if (sbi->umask != -1) |
664 | seq_printf(seq, ",umask=%03o", sbi->umask); | 672 | seq_printf(seq, ",umask=%03o", sbi->umask); |
665 | if (sbi->flag & JFS_NOINTEGRITY) | 673 | if (sbi->flag & JFS_NOINTEGRITY) |
@@ -944,6 +952,12 @@ static void __exit exit_jfs_fs(void) | |||
944 | jfs_proc_clean(); | 952 | jfs_proc_clean(); |
945 | #endif | 953 | #endif |
946 | unregister_filesystem(&jfs_fs_type); | 954 | unregister_filesystem(&jfs_fs_type); |
955 | |||
956 | /* | ||
957 | * Make sure all delayed rcu free inodes are flushed before we | ||
958 | * destroy cache. | ||
959 | */ | ||
960 | rcu_barrier(); | ||
947 | kmem_cache_destroy(jfs_inode_cachep); | 961 | kmem_cache_destroy(jfs_inode_cachep); |
948 | } | 962 | } |
949 | 963 | ||
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 26683e15b3ac..42d67f9757bf 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -685,7 +685,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | |||
685 | * POSIX_ACL_XATTR_ACCESS is tied to i_mode | 685 | * POSIX_ACL_XATTR_ACCESS is tied to i_mode |
686 | */ | 686 | */ |
687 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) { | 687 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) { |
688 | acl = posix_acl_from_xattr(value, value_len); | 688 | acl = posix_acl_from_xattr(&init_user_ns, value, value_len); |
689 | if (IS_ERR(acl)) { | 689 | if (IS_ERR(acl)) { |
690 | rc = PTR_ERR(acl); | 690 | rc = PTR_ERR(acl); |
691 | printk(KERN_ERR "posix_acl_from_xattr returned %d\n", | 691 | printk(KERN_ERR "posix_acl_from_xattr returned %d\n", |
@@ -710,7 +710,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | |||
710 | 710 | ||
711 | return 0; | 711 | return 0; |
712 | } else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) { | 712 | } else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) { |
713 | acl = posix_acl_from_xattr(value, value_len); | 713 | acl = posix_acl_from_xattr(&init_user_ns, value, value_len); |
714 | if (IS_ERR(acl)) { | 714 | if (IS_ERR(acl)) { |
715 | rc = PTR_ERR(acl); | 715 | rc = PTR_ERR(acl); |
716 | printk(KERN_ERR "posix_acl_from_xattr returned %d\n", | 716 | printk(KERN_ERR "posix_acl_from_xattr returned %d\n", |