|
@@ -2891,6 +2891,8 @@ struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
|
|
|
transaction_t *transaction;
|
|
transaction_t *transaction;
|
|
|
long ret;
|
|
long ret;
|
|
|
int block;
|
|
int block;
|
|
|
|
|
+ uid_t i_uid;
|
|
|
|
|
+ gid_t i_gid;
|
|
|
|
|
|
|
|
inode = iget_locked(sb, ino);
|
|
inode = iget_locked(sb, ino);
|
|
|
if (!inode)
|
|
if (!inode)
|
|
@@ -2907,12 +2909,14 @@ struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
|
|
|
bh = iloc.bh;
|
|
bh = iloc.bh;
|
|
|
raw_inode = ext3_raw_inode(&iloc);
|
|
raw_inode = ext3_raw_inode(&iloc);
|
|
|
inode->i_mode = le16_to_cpu(raw_inode->i_mode);
|
|
inode->i_mode = le16_to_cpu(raw_inode->i_mode);
|
|
|
- inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
|
|
|
|
|
- inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
|
|
|
|
|
|
|
+ i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
|
|
|
|
|
+ i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
|
|
|
if(!(test_opt (inode->i_sb, NO_UID32))) {
|
|
if(!(test_opt (inode->i_sb, NO_UID32))) {
|
|
|
- inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
|
|
|
|
|
- inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
|
|
|
|
|
|
|
+ i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
|
|
|
|
|
+ i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
|
|
|
}
|
|
}
|
|
|
|
|
+ i_uid_write(inode, i_uid);
|
|
|
|
|
+ i_gid_write(inode, i_gid);
|
|
|
set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
|
|
set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
|
|
|
inode->i_size = le32_to_cpu(raw_inode->i_size);
|
|
inode->i_size = le32_to_cpu(raw_inode->i_size);
|
|
|
inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
|
|
inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
|
|
@@ -3068,6 +3072,8 @@ static int ext3_do_update_inode(handle_t *handle,
|
|
|
struct ext3_inode_info *ei = EXT3_I(inode);
|
|
struct ext3_inode_info *ei = EXT3_I(inode);
|
|
|
struct buffer_head *bh = iloc->bh;
|
|
struct buffer_head *bh = iloc->bh;
|
|
|
int err = 0, rc, block;
|
|
int err = 0, rc, block;
|
|
|
|
|
+ uid_t i_uid;
|
|
|
|
|
+ gid_t i_gid;
|
|
|
|
|
|
|
|
again:
|
|
again:
|
|
|
/* we can't allow multiple procs in here at once, its a bit racey */
|
|
/* we can't allow multiple procs in here at once, its a bit racey */
|
|
@@ -3080,27 +3086,29 @@ again:
|
|
|
|
|
|
|
|
ext3_get_inode_flags(ei);
|
|
ext3_get_inode_flags(ei);
|
|
|
raw_inode->i_mode = cpu_to_le16(inode->i_mode);
|
|
raw_inode->i_mode = cpu_to_le16(inode->i_mode);
|
|
|
|
|
+ i_uid = i_uid_read(inode);
|
|
|
|
|
+ i_gid = i_gid_read(inode);
|
|
|
if(!(test_opt(inode->i_sb, NO_UID32))) {
|
|
if(!(test_opt(inode->i_sb, NO_UID32))) {
|
|
|
- raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
|
|
|
|
|
- raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
|
|
|
|
|
|
|
+ raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid));
|
|
|
|
|
+ raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid));
|
|
|
/*
|
|
/*
|
|
|
* Fix up interoperability with old kernels. Otherwise, old inodes get
|
|
* Fix up interoperability with old kernels. Otherwise, old inodes get
|
|
|
* re-used with the upper 16 bits of the uid/gid intact
|
|
* re-used with the upper 16 bits of the uid/gid intact
|
|
|
*/
|
|
*/
|
|
|
if(!ei->i_dtime) {
|
|
if(!ei->i_dtime) {
|
|
|
raw_inode->i_uid_high =
|
|
raw_inode->i_uid_high =
|
|
|
- cpu_to_le16(high_16_bits(inode->i_uid));
|
|
|
|
|
|
|
+ cpu_to_le16(high_16_bits(i_uid));
|
|
|
raw_inode->i_gid_high =
|
|
raw_inode->i_gid_high =
|
|
|
- cpu_to_le16(high_16_bits(inode->i_gid));
|
|
|
|
|
|
|
+ cpu_to_le16(high_16_bits(i_gid));
|
|
|
} else {
|
|
} else {
|
|
|
raw_inode->i_uid_high = 0;
|
|
raw_inode->i_uid_high = 0;
|
|
|
raw_inode->i_gid_high = 0;
|
|
raw_inode->i_gid_high = 0;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
raw_inode->i_uid_low =
|
|
raw_inode->i_uid_low =
|
|
|
- cpu_to_le16(fs_high2lowuid(inode->i_uid));
|
|
|
|
|
|
|
+ cpu_to_le16(fs_high2lowuid(i_uid));
|
|
|
raw_inode->i_gid_low =
|
|
raw_inode->i_gid_low =
|
|
|
- cpu_to_le16(fs_high2lowgid(inode->i_gid));
|
|
|
|
|
|
|
+ cpu_to_le16(fs_high2lowgid(i_gid));
|
|
|
raw_inode->i_uid_high = 0;
|
|
raw_inode->i_uid_high = 0;
|
|
|
raw_inode->i_gid_high = 0;
|
|
raw_inode->i_gid_high = 0;
|
|
|
}
|
|
}
|
|
@@ -3262,8 +3270,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
|
|
|
|
|
|
|
|
if (is_quota_modification(inode, attr))
|
|
if (is_quota_modification(inode, attr))
|
|
|
dquot_initialize(inode);
|
|
dquot_initialize(inode);
|
|
|
- if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
|
|
|
|
|
- (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
|
|
|
|
|
|
|
+ if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)) ||
|
|
|
|
|
+ (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid))) {
|
|
|
handle_t *handle;
|
|
handle_t *handle;
|
|
|
|
|
|
|
|
/* (user+group)*(old+new) structure, inode write (sb,
|
|
/* (user+group)*(old+new) structure, inode write (sb,
|