proc: don't do dummy rcu_read_lock/rcu_read_unlock on error path
rcu_read_lock()/rcu_read_unlock() is nop for TINY_RCU, but is not a nop for, say, PREEMPT_RCU. proc_fill_cache() is called without RCU lock, there is no need to lock/unlock on error path, simply jump out of the loop. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2344bec788
commit
f05ed3f1ab
@ -1928,21 +1928,22 @@ static int proc_readfd_common(struct file * filp, void * dirent,
|
|||||||
fd++, filp->f_pos++) {
|
fd++, filp->f_pos++) {
|
||||||
char name[PROC_NUMBUF];
|
char name[PROC_NUMBUF];
|
||||||
int len;
|
int len;
|
||||||
|
int rv;
|
||||||
|
|
||||||
if (!fcheck_files(files, fd))
|
if (!fcheck_files(files, fd))
|
||||||
continue;
|
continue;
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
len = snprintf(name, sizeof(name), "%d", fd);
|
len = snprintf(name, sizeof(name), "%d", fd);
|
||||||
if (proc_fill_cache(filp, dirent, filldir,
|
rv = proc_fill_cache(filp, dirent, filldir,
|
||||||
name, len, instantiate,
|
name, len, instantiate, p,
|
||||||
p, &fd) < 0) {
|
&fd);
|
||||||
rcu_read_lock();
|
if (rv < 0)
|
||||||
break;
|
goto out_fd_loop;
|
||||||
}
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
out_fd_loop:
|
||||||
put_files_struct(files);
|
put_files_struct(files);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user