Skip to contentSkip to conversation

2.5.8-pre3 & ext3: cannot chown

DISCUSSION Duncan Sands 3 participants 4 messages Apr 11, 2002 VFS

lore
Share & tools
lore
#0 lore raw

The subject just about says it all. After 12 hours of uptime running 2.5.8-pre3 on an ext3 partition, I noticed that changing the owner of a file had no effect. Rebooting with 2.4.18, there was no problem in using chown.

All the best,

Duncan.

#1 lore raw
Quoted 6 lines · Duncan Sands

The subject just about says it all. After 12 hours of uptime running 2.5.8-pre3 on an ext3 partition, I noticed that changing the owner of a file had no effect. Rebooting with 2.4.18, there was no problem in using chown.

How does this look?

fs/open.c +2 -2
@@ -524,11 +524,11 @@ static int chown_common(struct dentry * 
 		goto out;
 	newattrs.ia_valid =  ATTR_CTIME;
 	if (user != (uid_t) -1) {
-		newattrs.ia_valid =  ATTR_UID;
+		newattrs.ia_valid |= ATTR_UID;
 		newattrs.ia_uid = user;
 	}
 	if (group != (gid_t) -1) {
-		newattrs.ia_valid =  ATTR_GID;
+		newattrs.ia_valid |= ATTR_GID;
 		newattrs.ia_gid = group;
 	}
 	if (!S_ISDIR(inode->i_mode))

-

#2 lore raw
Quoted 13 lines · Andrew Morton
Quoted 6 lines · Duncan Sands

The subject just about says it all. After 12 hours of uptime running 2.5.8-pre3 on an ext3 partition, I noticed that changing the owner of a file had no effect. Rebooting with 2.4.18, there was no problem in using chown.

How does this look?

fs/open.c static int chown_common(struct dentry * · line 531

Quoted 10 lines
fs/open.c +2 -2
@@ -524,11 +524,11 @@ static int chown_common(struct dentry * 
 		goto out;
 	newattrs.ia_valid =  ATTR_CTIME;
 	if (user != (uid_t) -1) {
-		newattrs.ia_valid =  ATTR_UID;
+		newattrs.ia_valid |= ATTR_UID;
 		newattrs.ia_uid = user;
 	}
 	if (group != (gid_t) -1) {
-		newattrs.ia_valid =  ATTR_GID;
+		newattrs.ia_valid |= ATTR_GID;

Good catch. Linus, please apply.

#3 lore raw
In reply to Duncan Sands
Quoted 8 lines · Andrew Morton
Quoted 5 lines · Duncan Sands

The subject just about says it all. After 12 hours of uptime running 2.5.8-pre3 on an ext3 partition, I noticed that changing the owner of a file had no effect. Rebooting with 2.4.18, there was no problem in using chown.

How does this look?

It looks good: with this patch I can now chown and chgrp as usual.

Thanks for fixing this,

Duncan.

Quoted 18 lines
fs/open.c +2 -3
@@ -524,11 +524,11 @@ static int chown_common(struct dentry *
 		goto out;
 	newattrs.ia_valid =  ATTR_CTIME;
 	if (user != (uid_t) -1) {
-		newattrs.ia_valid =  ATTR_UID;
+		newattrs.ia_valid |= ATTR_UID;
 		newattrs.ia_uid = user;
 	}
 	if (group != (gid_t) -1) {
-		newattrs.ia_valid =  ATTR_GID;
+		newattrs.ia_valid |= ATTR_GID;
 		newattrs.ia_gid = group;
 	}
 	if (!S_ISDIR(inode->i_mode))
 
-