diff options
| author | Greg Kroah-Hartman <[email protected]> | 2018-07-30 10:08:09 +0200 | 
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2018-07-30 10:08:09 +0200 | 
| commit | d2fc88a61b4ea99f574bde16e92718e22f312136 (patch) | |
| tree | f256841ebcbc3b90fc29d7fa751610ba9aac5a2b /net/tipc | |
| parent | e16f4f3e0b7daecd48d4f944ab4147c1a6cb16a8 (diff) | |
| parent | acb1872577b346bd15ab3a3f8dff780d6cca4b70 (diff) | |
Merge 4.18-rc7 into driver-core-next
We need the driver core changes in here as well for testing.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/discover.c | 18 | ||||
| -rw-r--r-- | net/tipc/net.c | 17 | ||||
| -rw-r--r-- | net/tipc/node.c | 7 | ||||
| -rw-r--r-- | net/tipc/socket.c | 14 | 
4 files changed, 36 insertions, 20 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 9f666e0650e2..2830709957bd 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -133,6 +133,8 @@ static void disc_dupl_alert(struct tipc_bearer *b, u32 node_addr,  }  /* tipc_disc_addr_trial(): - handle an address uniqueness trial from peer + * Returns true if message should be dropped by caller, i.e., if it is a + * trial message or we are inside trial period. Otherwise false.   */  static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,  				     struct tipc_media_addr *maddr, @@ -168,8 +170,9 @@ static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,  		msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);  	} +	/* Accept regular link requests/responses only after trial period */  	if (mtyp != DSC_TRIAL_MSG) -		return false; +		return trial;  	sugg_addr = tipc_node_try_addr(net, peer_id, src);  	if (sugg_addr) @@ -284,7 +287,6 @@ static void tipc_disc_timeout(struct timer_list *t)  {  	struct tipc_discoverer *d = from_timer(d, t, timer);  	struct tipc_net *tn = tipc_net(d->net); -	u32 self = tipc_own_addr(d->net);  	struct tipc_media_addr maddr;  	struct sk_buff *skb = NULL;  	struct net *net = d->net; @@ -298,12 +300,14 @@ static void tipc_disc_timeout(struct timer_list *t)  		goto exit;  	} -	/* Did we just leave the address trial period ? */ -	if (!self && !time_before(jiffies, tn->addr_trial_end)) { -		self = tn->trial_addr; -		tipc_net_finalize(net, self); -		msg_set_prevnode(buf_msg(d->skb), self); +	/* Trial period over ? */ +	if (!time_before(jiffies, tn->addr_trial_end)) { +		/* Did we just leave it ? */ +		if (!tipc_own_addr(net)) +			tipc_net_finalize(net, tn->trial_addr); +  		msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); +		msg_set_prevnode(buf_msg(d->skb), tipc_own_addr(net));  	}  	/* Adjust timeout interval according to discovery phase */ diff --git a/net/tipc/net.c b/net/tipc/net.c index 4fbaa0464405..a7f6964c3a4b 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c @@ -121,12 +121,17 @@ int tipc_net_init(struct net *net, u8 *node_id, u32 addr)  void tipc_net_finalize(struct net *net, u32 addr)  { -	tipc_set_node_addr(net, addr); -	smp_mb(); -	tipc_named_reinit(net); -	tipc_sk_reinit(net); -	tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, -			     TIPC_CLUSTER_SCOPE, 0, addr); +	struct tipc_net *tn = tipc_net(net); + +	spin_lock_bh(&tn->node_list_lock); +	if (!tipc_own_addr(net)) { +		tipc_set_node_addr(net, addr); +		tipc_named_reinit(net); +		tipc_sk_reinit(net); +		tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, +				     TIPC_CLUSTER_SCOPE, 0, addr); +	} +	spin_unlock_bh(&tn->node_list_lock);  }  void tipc_net_stop(struct net *net) diff --git a/net/tipc/node.c b/net/tipc/node.c index 6a44eb812baf..0453bd451ce8 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -797,6 +797,7 @@ static u32 tipc_node_suggest_addr(struct net *net, u32 addr)  }  /* tipc_node_try_addr(): Check if addr can be used by peer, suggest other if not + * Returns suggested address if any, otherwise 0   */  u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)  { @@ -819,12 +820,14 @@ u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)  	if (n) {  		addr = n->addr;  		tipc_node_put(n); +		return addr;  	} -	/* Even this node may be in trial phase */ + +	/* Even this node may be in conflict */  	if (tn->trial_addr == addr)  		return tipc_node_suggest_addr(net, addr); -	return addr; +	return 0;  }  void tipc_node_check_dest(struct net *net, u32 addr, diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 14a5d055717d..930852c54d7a 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -692,9 +692,10 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr,  }  /** - * tipc_poll - read pollmask + * tipc_poll - read and possibly block on pollmask   * @file: file structure associated with the socket   * @sock: socket for which to calculate the poll bits + * @wait: ???   *   * Returns pollmask value   * @@ -708,12 +709,15 @@ static int tipc_getname(struct socket *sock, struct sockaddr *uaddr,   * imply that the operation will succeed, merely that it should be performed   * and will not block.   */ -static __poll_t tipc_poll_mask(struct socket *sock, __poll_t events) +static __poll_t tipc_poll(struct file *file, struct socket *sock, +			      poll_table *wait)  {  	struct sock *sk = sock->sk;  	struct tipc_sock *tsk = tipc_sk(sk);  	__poll_t revents = 0; +	sock_poll_wait(file, sk_sleep(sk), wait); +  	if (sk->sk_shutdown & RCV_SHUTDOWN)  		revents |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;  	if (sk->sk_shutdown == SHUTDOWN_MASK) @@ -3033,7 +3037,7 @@ static const struct proto_ops msg_ops = {  	.socketpair	= tipc_socketpair,  	.accept		= sock_no_accept,  	.getname	= tipc_getname, -	.poll_mask	= tipc_poll_mask, +	.poll		= tipc_poll,  	.ioctl		= tipc_ioctl,  	.listen		= sock_no_listen,  	.shutdown	= tipc_shutdown, @@ -3054,7 +3058,7 @@ static const struct proto_ops packet_ops = {  	.socketpair	= tipc_socketpair,  	.accept		= tipc_accept,  	.getname	= tipc_getname, -	.poll_mask	= tipc_poll_mask, +	.poll		= tipc_poll,  	.ioctl		= tipc_ioctl,  	.listen		= tipc_listen,  	.shutdown	= tipc_shutdown, @@ -3075,7 +3079,7 @@ static const struct proto_ops stream_ops = {  	.socketpair	= tipc_socketpair,  	.accept		= tipc_accept,  	.getname	= tipc_getname, -	.poll_mask	= tipc_poll_mask, +	.poll		= tipc_poll,  	.ioctl		= tipc_ioctl,  	.listen		= tipc_listen,  	.shutdown	= tipc_shutdown,  |