On Thu, Dec 31, 2015 at 1:41 AM, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx> wrote: > On Wed, Dec 30, 2015 at 11:50:46PM +0800, Xin Long wrote: > ... >> +void sctp_hash_transport(struct sctp_transport *t) >> +{ >> + struct sctp_sockaddr_entry *addr; >> + struct sctp_hash_cmp_arg arg; >> + >> + addr = list_entry(t->asoc->base.bind_addr.address_list.next, >> + struct sctp_sockaddr_entry, list); >> + arg.laddr = &addr->a; >> + arg.paddr = &t->ipaddr; >> + arg.net = sock_net(t->asoc->base.sk); >> + >> +reinsert: >> + if (rhashtable_lookup_insert_key(&sctp_transport_hashtable, &arg, >> + &t->node, sctp_hash_params) == -EBUSY) >> + goto reinsert; >> +} > > This is the nasty situation I mentioned in previous email. It seems that > a stress test can trigger a double rehash and cause an entry to not be > added. > > This is in fact very near some bugs you caught on rhashtable in the past > few days/couple of weeks tops. > > I'm actually against this loop as is. I may have not been clear with Xin > about not adding my signature to the patchset due to this. > > Please take a look at Xin's emails on thread 'rhashtable: Prevent > spurious EBUSY errors on insertion' about this particular situation. > Cc'ing Herbert as he wanted to see the patches for that issue. > > Marcelo > without this 'reinsert'. we can reproduce this issue like this: 1. download the attachment 2. cp sctperf.tar.gz to server and client hosts 3. in each hosts. #make 4. in server: #sh saddr.sh $ethx #./ss 5. in client: #sh caddr.sh $ethx #ulimit -n 20000 #./cc when the number of connections reach about 1600, this issue will be triggered.
Attachment:
sctperf.tar.gz
Description: GNU Zip compressed data