Skip to contentSkip to conversation

proc: remove mark_inode_dirty() in proc_notify_change()

PATCH Superseded Chao Yu 2 participants 3 messages Jan 12, 2023 – Jan 29, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 proc: remove mark_inode_dirty() in proc_notify_change()

proc_notify_change() has updated i_uid, i_gid and i_mode into proc dirent, we don't need to call mark_inode_dirty() for later writeback, remove it.

---
 fs/proc/generic.c | 1 -
 1 file changed, 1 deletion(-)
fs/proc/generic.c +0 -1
index 5f52f20d5ed1..f547e9593a77 100644
@@ -127,7 +127,6 @@ static int proc_notify_change(struct user_namespace *mnt_userns,
 		return error;
 
 	setattr_copy(&init_user_ns, inode, iattr);
-	mark_inode_dirty(inode);
 
 	proc_set_user(de, inode->i_uid, inode->i_gid);
 	de->mode = inode->i_mode;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 7 lines · On Thu, 12 Jan 2023 11:27:20 +0800 Chao Yu <[email protected]> wrote:

proc_notify_change() has updated i_uid, i_gid and i_mode into proc dirent, we don't need to call mark_inode_dirty() for later writeback, remove it.

fs/proc/generic.c static int proc_notify_change(struct user_namespace *mnt_userns, · line 132

Quoted 7 lines
fs/proc/generic.c +0 -1
@@ -127,7 +127,6 @@ static int proc_notify_change(struct user_namespace *mnt_userns,
 		return error;
 
 	setattr_copy(&init_user_ns, inode, iattr);
-	mark_inode_dirty(inode);
 
 	proc_set_user(de, inode->i_uid, inode->i_gid);
 	de->mode = inode->i_mode;

procfs call mark_inode_dirty() in three places.

Does mark_inode_dirty() of a procfs file actually serve any purpose?

author
#2 lore raw

Hi Andrew,

Sorry for the long delay. :(

Quoted 11 lines · Andrew Morton
Quoted 9 lines · On Thu, 12 Jan 2023 11:27:20 +0800 Chao Yu <[email protected]> wrote:

proc_notify_change() has updated i_uid, i_gid and i_mode into proc dirent, we don't need to call mark_inode_dirty() for later writeback, remove it.

fs/proc/generic.c +0 -0
@@ -127,7 +127,6 @@ static int proc_notify_change(struct user_namespace *mnt_userns,
  		return error;
 
Quoted 7 lines

fs/proc/generic.c static int proc_notify_change(struct user_namespace *mnt_userns, · line 132

Quoted 5 lines
fs/proc/generic.c +0 -1
  	setattr_copy(&init_user_ns, inode, iattr);
-	mark_inode_dirty(inode);
 
  	proc_set_user(de, inode->i_uid, inode->i_gid);
  	de->mode = inode->i_mode;

procfs call mark_inode_dirty() in three places.

Correct.

Quoted 2 lines

Does mark_inode_dirty() of a procfs file actually serve any purpose?

I don't see any particular reason that procfs inode needs to be set dirty, as an in-memory filesystem, there is no backing device, so all attributes should have been updated into procfs dirent directly in .setattr().

In fact, also procfs doesn't implement .dirty_inode, .write_inode or .writepage{,s} interfaces which serves delayed inode update, pages writeback after inode is set as dirty.

Thanks,