From: David Miller <davem@davemloft.net>
To: tung.q.nguyen@dektech.com.au
Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net
Subject: Re: [tipc-discussion][net 1/1] tipc: fix race condition causing hung sendto
Date: Tue, 19 Feb 2019 13:21:32 -0800 (PST) [thread overview]
Message-ID: <20190219.132132.1441357188232859482.davem@davemloft.net> (raw)
In-Reply-To: <20190219070310.23888-2-tung.q.nguyen@dektech.com.au>
From: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Date: Tue, 19 Feb 2019 14:03:10 +0700
> When sending multicast messages via blocking socket,
> if sending link is congested (tsk->cong_link_cnt is set to 1),
> the sending thread will be put into sleeping state. However,
> tipc_sk_filter_rcv() is called under socket spin lock but
> tipc_wait_for_cond() is not. So, there is no guarantee that
> the setting of tsk->cong_link_cnt to 0 in tipc_sk_proto_rcv() in
> CPU-1 will be perceived by CPU-0. If that is the case, the sending
> thread in CPU-0 after being waken up, will continue to see
> tsk->cong_link_cnt as 1 and put the sending thread into sleeping
> state again. The sending thread will sleep forever.
...
> This commit fixes it by adding memory barrier to tipc_sk_proto_rcv()
> and tipc_wait_for_cond().
>
> Acked-by: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
You really need to build test this stuff properly:
net/tipc/socket.c: In function ‘__tipc_shutdown’:
./include/linux/wait.h:1119:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct wait_queue_entry name = { \
^~~~~~
You can't put the smp_rmb(); before the DEFINE_WAIT_FUNC() in that
basic block.
next prev parent reply other threads:[~2019-02-19 21:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 7:03 [tipc-discussion][net 0/1] tipc: fix race condition between sleep/wakeup Tung Nguyen
2019-02-19 7:03 ` [tipc-discussion][net 1/1] tipc: fix race condition causing hung sendto Tung Nguyen
2019-02-19 21:21 ` David Miller [this message]
2019-02-21 3:31 ` [tipc-discussion][net v2 " Tung Nguyen
2019-02-21 3:51 ` David Miller
2019-02-21 4:04 ` tung quang nguyen
2019-02-22 23:24 ` David Miller
2019-02-25 3:57 ` [net v3 " Tung Nguyen
2019-02-26 22:52 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190219.132132.1441357188232859482.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.q.nguyen@dektech.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).