Skip to contentSkip to conversation

Update ctime when changing the file's permission by setfacl

PATCH In review Jan Kara 4 participants 9 messages Jun 4, 2010 – Jun 15, 2010

Subsystems (4)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

cover Update ctime when changing the file's permission by setfacl

Hi,

I went through filesystems in fs/ supporting acl's and checked which could
have the same issue as ext3. In the end I've ended up with just these four patches. I'll take care of merging the ext2-bit and I'm sending it just for completeness / review. The other patches should probably go through respective maintainers...

Honza

author reviewer
#1 lore raw

PATCH 1/4 ext2: update ctime when changing the file's permission by setfacl

ext2 didn't update the ctime of the file when its permission was changed.

Steps to reproduce:

 # touch aaa
 # stat -c %Z aaa
 1275289822
 # setfacl -m  'u::x,g::x,o::x' aaa
 # stat -c %Z aaa
 1275289822                         <- unchanged

But, according to the spec of the ctime, ext2 must update it.

Port of ext3 patch by Miao Xie <[email protected]>.

---
 fs/ext2/acl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ext2/acl.c +1 -0
index ca7e2a0..2bcc043 100644
@@ -200,6 +200,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 					return error;
 				else {
 					inode->i_mode = mode;
+					inode->i_ctime = CURRENT_TIME_SEC;
 					mark_inode_dirty(inode);
 					if (error == 0)
 						acl = NULL;
Signature · 1 line
1.6.4.2
author reviewer
#2 lore raw

PATCH 2/4 vfs: update ctime when changing the file's permission by setfacl

In reply to Jan Kara

generic_acl_set didn't update the ctime of the file when its permission was changed.

Steps to reproduce:

 # touch aaa
 # stat -c %Z aaa
 1275289822
 # setfacl -m  'u::x,g::x,o::x' aaa
 # stat -c %Z aaa
 1275289822                         <- unchanged

But, according to the spec of the ctime, vfs must update it.

Port of ext3 patch by Miao Xie <[email protected]>.

---
 fs/generic_acl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/generic_acl.c +1 -0
index 99800e5..6bc9e3a 100644
@@ -94,6 +94,7 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value,
 			if (error < 0)
 				goto failed;
 			inode->i_mode = mode;
+			inode->i_ctime = CURRENT_TIME;
 			if (error == 0) {
 				posix_acl_release(acl);
 				acl = NULL;
Signature · 1 line
1.6.4.2
author reviewer
#3 lore raw

PATCH 3/4 ext4: update ctime when changing the file's permission by setfacl

In reply to Jan Kara

ext4 didn't update the ctime of the file when its permission was changed.

Steps to reproduce:

 # touch aaa
 # stat -c %Z aaa
 1275289822
 # setfacl -m  'u::x,g::x,o::x' aaa
 # stat -c %Z aaa
 1275289822                         <- unchanged

But, according to the spec of the ctime, ext4 must update it.

Port of ext3 patch by Miao Xie <[email protected]>.

---
 fs/ext4/acl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ext4/acl.c +1 -0
index feaf498..5e2ed45 100644
@@ -204,6 +204,7 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
 				return error;
 			else {
 				inode->i_mode = mode;
+				inode->i_ctime = ext4_current_time(inode);
 				ext4_mark_inode_dirty(handle, inode);
 				if (error == 0)
 					acl = NULL;
Signature · 1 line
1.6.4.2
#4 lore raw

Re: [PATCH 3/4] ext4: update ctime when changing the file's permission by setfacl

Quoted 1 line · Jan Kara

ext4 didn't update the ctime of the file when its permission was changed.

I've added this to the ext4 tree, thanks.

- Ted

author reviewer
#5 lore raw

PATCH 4/4 jffs2: update ctime when changing the file's permission by setfacl

In reply to Jan Kara

jffs2 didn't update the ctime of the file when its permission was changed.

Steps to reproduce:

 # touch aaa
 # stat -c %Z aaa
 1275289822
 # setfacl -m  'u::x,g::x,o::x' aaa
 # stat -c %Z aaa
 1275289822                         <- unchanged

But, according to the spec of the ctime, jffs2 must update it.

Port of ext3 patch by Miao Xie <[email protected]>.

CC David Woodhouse <[email protected]>
---
 fs/jffs2/acl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/jffs2/acl.c +2 -1
index a33aab6..54a92fd 100644
@@ -234,8 +234,9 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 			if (inode->i_mode != mode) {
 				struct iattr attr;
 
-				attr.ia_valid = ATTR_MODE;
+				attr.ia_valid = ATTR_MODE | ATTR_CTIME;
 				attr.ia_mode = mode;
+				attr.ia_ctime = CURRENT_TIME_SEC;
 				rc = jffs2_do_setattr(inode, &attr);
 				if (rc < 0)
 					return rc;
Signature · 1 line
1.6.4.2
maintainer
#6 lore raw

Re: [PATCH 4/4] jffs2: update ctime when changing the file's permission by setfacl

Quoted 1 line · Jan Kara

jffs2 didn't update the ctime of the file when its permission was changed.

Thanks. I have a couple more JFFS2 bug fixes that Al pointed out a day or two ago, which I want to submit for 2.6.35; I'll merge this through my tree with those if that's OK.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation
maintainer
#7 lore raw

Re: [PATCH 4/4] jffs2: update ctime when changing the file's permission by setfacl

Quoted 6 lines · David Woodhouse
Quoted 1 line · Jan Kara

jffs2 didn't update the ctime of the file when its permission was changed.

Thanks. I have a couple more JFFS2 bug fixes that Al pointed out a day or two ago, which I want to submit for 2.6.35; I'll merge this through my tree with those if that's OK.

How much else is currently in your tree? I'm going to push to Linus in a bit and I'd simply pull your tree first if that's all there is...

maintainer
#8 lore raw

Re: [PATCH 4/4] jffs2: update ctime when changing the file's permission by setfacl

Quoted 10 lines · Al Viro
Quoted 6 lines · David Woodhouse
Quoted 1 line · Jan Kara

jffs2 didn't update the ctime of the file when its permission was changed.

Thanks. I have a couple more JFFS2 bug fixes that Al pointed out a day or two ago, which I want to submit for 2.6.35; I'll merge this through my tree with those if that's OK.

How much else is currently in your tree? I'm going to push to Linus in a bit and I'd simply pull your tree first if that's all there is...

Hmm... several mtd patches too... ;-/