Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327318
b: refs/heads/master
c: c18cdc1
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Sep 21, 2012
1 parent 173313d commit b48deea
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cfe53d3c3875e1dd565b30737cd5c6691c00188
refs/heads/master: c18cdc1a3ec643b5c6c0d65aac1a6bf8e461778f
4 changes: 2 additions & 2 deletions trunk/fs/jfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)

if (is_quota_modification(inode, iattr))
dquot_initialize(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
if ((iattr->ia_valid & ATTR_UID && !uid_eq(iattr->ia_uid, inode->i_uid)) ||
(iattr->ia_valid & ATTR_GID && !gid_eq(iattr->ia_gid, inode->i_gid))) {
rc = dquot_transfer(inode, iattr);
if (rc)
return rc;
Expand Down
22 changes: 12 additions & 10 deletions trunk/fs/jfs/jfs_imap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3078,15 +3078,15 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip)
}
set_nlink(ip, le32_to_cpu(dip->di_nlink));

jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
if (sbi->uid == -1)
jfs_ip->saved_uid = make_kuid(&init_user_ns, le32_to_cpu(dip->di_uid));
if (!uid_valid(sbi->uid))
ip->i_uid = jfs_ip->saved_uid;
else {
ip->i_uid = sbi->uid;
}

jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
if (sbi->gid == -1)
jfs_ip->saved_gid = make_kgid(&init_user_ns, le32_to_cpu(dip->di_gid));
if (!gid_valid(sbi->gid))
ip->i_gid = jfs_ip->saved_gid;
else {
ip->i_gid = sbi->gid;
Expand Down Expand Up @@ -3150,14 +3150,16 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip)
dip->di_size = cpu_to_le64(ip->i_size);
dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
dip->di_nlink = cpu_to_le32(ip->i_nlink);
if (sbi->uid == -1)
dip->di_uid = cpu_to_le32(ip->i_uid);
if (!uid_valid(sbi->uid))
dip->di_uid = cpu_to_le32(i_uid_read(ip));
else
dip->di_uid = cpu_to_le32(jfs_ip->saved_uid);
if (sbi->gid == -1)
dip->di_gid = cpu_to_le32(ip->i_gid);
dip->di_uid =cpu_to_le32(from_kuid(&init_user_ns,
jfs_ip->saved_uid));
if (!gid_valid(sbi->gid))
dip->di_gid = cpu_to_le32(i_gid_read(ip));
else
dip->di_gid = cpu_to_le32(jfs_ip->saved_gid);
dip->di_gid = cpu_to_le32(from_kgid(&init_user_ns,
jfs_ip->saved_gid));
jfs_get_inode_flags(jfs_ip);
/*
* mode2 is only needed for storing the higher order bits.
Expand Down
8 changes: 4 additions & 4 deletions trunk/fs/jfs/jfs_incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
struct jfs_inode_info {
int fileset; /* fileset number (always 16)*/
uint mode2; /* jfs-specific mode */
uint saved_uid; /* saved for uid mount option */
uint saved_gid; /* saved for gid mount option */
kuid_t saved_uid; /* saved for uid mount option */
kgid_t saved_gid; /* saved for gid mount option */
pxd_t ixpxd; /* inode extent descriptor */
dxd_t acl; /* dxd describing acl */
dxd_t ea; /* dxd describing ea */
Expand Down Expand Up @@ -192,8 +192,8 @@ struct jfs_sb_info {
uint state; /* mount/recovery state */
unsigned long flag; /* mount time flags */
uint p_state; /* state prior to going no integrity */
uint uid; /* uid to override on-disk uid */
uint gid; /* gid to override on-disk gid */
kuid_t uid; /* uid to override on-disk uid */
kgid_t gid; /* gid to override on-disk gid */
uint umask; /* umask to override on-disk umask */
};

Expand Down
22 changes: 15 additions & 7 deletions trunk/fs/jfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,19 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_uid:
{
char *uid = args[0].from;
sbi->uid = simple_strtoul(uid, &uid, 0);
uid_t val = simple_strtoul(uid, &uid, 0);
sbi->uid = make_kuid(current_user_ns(), val);
if (!uid_valid(sbi->uid))
goto cleanup;
break;
}
case Opt_gid:
{
char *gid = args[0].from;
sbi->gid = simple_strtoul(gid, &gid, 0);
gid_t val = simple_strtoul(gid, &gid, 0);
sbi->gid = make_kgid(current_user_ns(), val);
if (!gid_valid(sbi->gid))
goto cleanup;
break;
}
case Opt_umask:
Expand Down Expand Up @@ -443,7 +449,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = sbi;
sb->s_max_links = JFS_LINK_MAX;
sbi->sb = sb;
sbi->uid = sbi->gid = sbi->umask = -1;
sbi->uid = INVALID_UID;
sbi->gid = INVALID_GID;
sbi->umask = -1;

/* initialize the mount flag and determine the default error handler */
flag = JFS_ERR_REMOUNT_RO;
Expand Down Expand Up @@ -617,10 +625,10 @@ static int jfs_show_options(struct seq_file *seq, struct dentry *root)
{
struct jfs_sb_info *sbi = JFS_SBI(root->d_sb);

if (sbi->uid != -1)
seq_printf(seq, ",uid=%d", sbi->uid);
if (sbi->gid != -1)
seq_printf(seq, ",gid=%d", sbi->gid);
if (uid_valid(sbi->uid))
seq_printf(seq, ",uid=%d", from_kuid(&init_user_ns, sbi->uid));
if (gid_valid(sbi->gid))
seq_printf(seq, ",gid=%d", from_kgid(&init_user_ns, sbi->gid));
if (sbi->umask != -1)
seq_printf(seq, ",umask=%03o", sbi->umask);
if (sbi->flag & JFS_NOINTEGRITY)
Expand Down
1 change: 0 additions & 1 deletion trunk/init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,6 @@ config UIDGID_CONVERTED
depends on CODA_FS = n
depends on FUSE_FS = n
depends on GFS2_FS = n
depends on JFS_FS = n
depends on NCP_FS = n
depends on NFSD = n
depends on NFS_FS = n
Expand Down

0 comments on commit b48deea

Please sign in to comment.