Revert "netlink: hold nlk->cb_mutex longer in __netlink_dump_start()"
This reverts commit 6fb6379d7d
.
This commit is contained in:
parent
f240e34e03
commit
4803ddf965
1 changed files with 7 additions and 6 deletions
|
@ -126,7 +126,7 @@ static const char *const nlk_cb_mutex_key_strings[MAX_LINKS + 1] = {
|
|||
"nlk_cb_mutex-MAX_LINKS"
|
||||
};
|
||||
|
||||
static int netlink_dump(struct sock *sk, bool lock_taken);
|
||||
static int netlink_dump(struct sock *sk);
|
||||
|
||||
/* nl_table locking explained:
|
||||
* Lookup and traversal are protected with an RCU read-side lock. Insertion
|
||||
|
@ -1996,7 +1996,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
|||
|
||||
if (READ_ONCE(nlk->cb_running) &&
|
||||
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
|
||||
ret = netlink_dump(sk, false);
|
||||
ret = netlink_dump(sk);
|
||||
if (ret) {
|
||||
sk->sk_err = -ret;
|
||||
sk->sk_error_report(sk);
|
||||
|
@ -2206,7 +2206,7 @@ static int netlink_dump_done(struct netlink_sock *nlk, struct sk_buff *skb,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int netlink_dump(struct sock *sk, bool lock_taken)
|
||||
static int netlink_dump(struct sock *sk)
|
||||
{
|
||||
struct netlink_sock *nlk = nlk_sk(sk);
|
||||
struct netlink_ext_ack extack = {};
|
||||
|
@ -2218,8 +2218,7 @@ static int netlink_dump(struct sock *sk, bool lock_taken)
|
|||
int alloc_min_size;
|
||||
int alloc_size;
|
||||
|
||||
if (!lock_taken)
|
||||
mutex_lock(nlk->cb_mutex);
|
||||
mutex_lock(nlk->cb_mutex);
|
||||
if (!nlk->cb_running) {
|
||||
err = -EINVAL;
|
||||
goto errout_skb;
|
||||
|
@ -2375,7 +2374,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
|||
WRITE_ONCE(nlk->cb_running, true);
|
||||
nlk->dump_done_errno = INT_MAX;
|
||||
|
||||
ret = netlink_dump(sk, true);
|
||||
mutex_unlock(nlk->cb_mutex);
|
||||
|
||||
ret = netlink_dump(sk);
|
||||
|
||||
sock_put(sk);
|
||||
|
||||
|
|
Loading…
Reference in a new issue