Commit 71448011 authored by Eric W. Biederman's avatar Eric W. Biederman

proc: Clear the pieces of proc_inode that proc_evict_inode cares about

This just keeps everything tidier, and allows for using flags like
SLAB_TYPESAFE_BY_RCU where slabs are not always cleared before reuse.
I don't see reuse without reinitializing happening with the proc_inode
but I had a false alarm while reworking flushing of proc dentries and
indoes when a process dies that caused me to tidy this up.

The code is a little easier to follow and reason about this
way so I figured the changes might as well be kept.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent f90f3caf
...@@ -33,21 +33,27 @@ static void proc_evict_inode(struct inode *inode) ...@@ -33,21 +33,27 @@ static void proc_evict_inode(struct inode *inode)
{ {
struct proc_dir_entry *de; struct proc_dir_entry *de;
struct ctl_table_header *head; struct ctl_table_header *head;
struct proc_inode *ei = PROC_I(inode);
truncate_inode_pages_final(&inode->i_data); truncate_inode_pages_final(&inode->i_data);
clear_inode(inode); clear_inode(inode);
/* Stop tracking associated processes */ /* Stop tracking associated processes */
put_pid(PROC_I(inode)->pid); if (ei->pid) {
put_pid(ei->pid);
ei->pid = NULL;
}
/* Let go of any associated proc directory entry */ /* Let go of any associated proc directory entry */
de = PDE(inode); de = ei->pde;
if (de) if (de) {
pde_put(de); pde_put(de);
ei->pde = NULL;
}
head = PROC_I(inode)->sysctl; head = ei->sysctl;
if (head) { if (head) {
RCU_INIT_POINTER(PROC_I(inode)->sysctl, NULL); RCU_INIT_POINTER(ei->sysctl, NULL);
proc_sys_evict_inode(inode, head); proc_sys_evict_inode(inode, head);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment