File tree Expand file tree Collapse file tree 3 files changed +40
-34
lines changed Expand file tree Collapse file tree 3 files changed +40
-34
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,44 @@ void __init proc_init_kmemcache(void)
103
103
BUILD_BUG_ON (sizeof (struct proc_dir_entry ) >= SIZEOF_PDE );
104
104
}
105
105
106
+ void proc_prune_siblings_dcache (struct hlist_head * inodes , spinlock_t * lock )
107
+ {
108
+ struct inode * inode ;
109
+ struct proc_inode * ei ;
110
+ struct hlist_node * node ;
111
+ struct super_block * sb ;
112
+
113
+ rcu_read_lock ();
114
+ for (;;) {
115
+ node = hlist_first_rcu (inodes );
116
+ if (!node )
117
+ break ;
118
+ ei = hlist_entry (node , struct proc_inode , sibling_inodes );
119
+ spin_lock (lock );
120
+ hlist_del_init_rcu (& ei -> sibling_inodes );
121
+ spin_unlock (lock );
122
+
123
+ inode = & ei -> vfs_inode ;
124
+ sb = inode -> i_sb ;
125
+ if (!atomic_inc_not_zero (& sb -> s_active ))
126
+ continue ;
127
+ inode = igrab (inode );
128
+ rcu_read_unlock ();
129
+ if (unlikely (!inode )) {
130
+ deactivate_super (sb );
131
+ rcu_read_lock ();
132
+ continue ;
133
+ }
134
+
135
+ d_prune_aliases (inode );
136
+ iput (inode );
137
+ deactivate_super (sb );
138
+
139
+ rcu_read_lock ();
140
+ }
141
+ rcu_read_unlock ();
142
+ }
143
+
106
144
static int proc_show_options (struct seq_file * seq , struct dentry * root )
107
145
{
108
146
struct super_block * sb = root -> d_sb ;
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ extern const struct inode_operations proc_pid_link_inode_operations;
210
210
extern const struct super_operations proc_sops ;
211
211
212
212
void proc_init_kmemcache (void );
213
+ void proc_prune_siblings_dcache (struct hlist_head * inodes , spinlock_t * lock );
213
214
void set_proc_pid_nlink (void );
214
215
extern struct inode * proc_get_inode (struct super_block * , struct proc_dir_entry * );
215
216
extern void proc_entry_rundown (struct proc_dir_entry * );
Original file line number Diff line number Diff line change @@ -269,40 +269,7 @@ static void unuse_table(struct ctl_table_header *p)
269
269
270
270
static void proc_sys_prune_dcache (struct ctl_table_header * head )
271
271
{
272
- struct inode * inode ;
273
- struct proc_inode * ei ;
274
- struct hlist_node * node ;
275
- struct super_block * sb ;
276
-
277
- rcu_read_lock ();
278
- for (;;) {
279
- node = hlist_first_rcu (& head -> inodes );
280
- if (!node )
281
- break ;
282
- ei = hlist_entry (node , struct proc_inode , sibling_inodes );
283
- spin_lock (& sysctl_lock );
284
- hlist_del_init_rcu (& ei -> sibling_inodes );
285
- spin_unlock (& sysctl_lock );
286
-
287
- inode = & ei -> vfs_inode ;
288
- sb = inode -> i_sb ;
289
- if (!atomic_inc_not_zero (& sb -> s_active ))
290
- continue ;
291
- inode = igrab (inode );
292
- rcu_read_unlock ();
293
- if (unlikely (!inode )) {
294
- deactivate_super (sb );
295
- rcu_read_lock ();
296
- continue ;
297
- }
298
-
299
- d_prune_aliases (inode );
300
- iput (inode );
301
- deactivate_super (sb );
302
-
303
- rcu_read_lock ();
304
- }
305
- rcu_read_unlock ();
272
+ proc_prune_siblings_dcache (& head -> inodes , & sysctl_lock );
306
273
}
307
274
308
275
/* called under sysctl_lock, will reacquire if has to wait */
You can’t perform that action at this time.
0 commit comments