Skip to content

Commit 080f627

Browse files
committed
proc: In proc_prune_siblings_dcache cache an aquired super block
Because there are likely to be several sysctls in a row on the same superblock cache the super_block after the count has been raised and don't deactivate it until we are processing another super_block. Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 26dbc60 commit 080f627

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

fs/proc/inode.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ void proc_prune_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock)
108108
struct inode *inode;
109109
struct proc_inode *ei;
110110
struct hlist_node *node;
111-
struct super_block *sb;
111+
struct super_block *old_sb = NULL;
112112

113113
rcu_read_lock();
114114
for (;;) {
115+
struct super_block *sb;
115116
node = hlist_first_rcu(inodes);
116117
if (!node)
117118
break;
@@ -122,23 +123,28 @@ void proc_prune_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock)
122123

123124
inode = &ei->vfs_inode;
124125
sb = inode->i_sb;
125-
if (!atomic_inc_not_zero(&sb->s_active))
126+
if ((sb != old_sb) && !atomic_inc_not_zero(&sb->s_active))
126127
continue;
127128
inode = igrab(inode);
128129
rcu_read_unlock();
130+
if (sb != old_sb) {
131+
if (old_sb)
132+
deactivate_super(old_sb);
133+
old_sb = sb;
134+
}
129135
if (unlikely(!inode)) {
130-
deactivate_super(sb);
131136
rcu_read_lock();
132137
continue;
133138
}
134139

135140
d_prune_aliases(inode);
136141
iput(inode);
137-
deactivate_super(sb);
138142

139143
rcu_read_lock();
140144
}
141145
rcu_read_unlock();
146+
if (old_sb)
147+
deactivate_super(old_sb);
142148
}
143149

144150
static int proc_show_options(struct seq_file *seq, struct dentry *root)

0 commit comments

Comments
 (0)