mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	SUNRPC: xprt_connect() don't abort the task if the transport isn't bound
If the transport isn't bound, then we should just return ENOTCONN, letting call_connect_status() and/or call_status() deal with retrying. Currently, we appear to abort all pending tasks with an EIO error. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
		
							parent
							
								
									fba91afbec
								
							
						
					
					
						commit
						01d37c428a
					
				
					 2 changed files with 10 additions and 5 deletions
				
			
		| 
						 | 
					@ -663,7 +663,7 @@ void xprt_connect(struct rpc_task *task)
 | 
				
			||||||
			xprt, (xprt_connected(xprt) ? "is" : "is not"));
 | 
								xprt, (xprt_connected(xprt) ? "is" : "is not"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!xprt_bound(xprt)) {
 | 
						if (!xprt_bound(xprt)) {
 | 
				
			||||||
		task->tk_status = -EIO;
 | 
							task->tk_status = -EAGAIN;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!xprt_lock_write(xprt, task))
 | 
						if (!xprt_lock_write(xprt, task))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -577,6 +577,8 @@ static int xs_udp_send_request(struct rpc_task *task)
 | 
				
			||||||
				req->rq_svec->iov_base,
 | 
									req->rq_svec->iov_base,
 | 
				
			||||||
				req->rq_svec->iov_len);
 | 
									req->rq_svec->iov_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!xprt_bound(xprt))
 | 
				
			||||||
 | 
							return -ENOTCONN;
 | 
				
			||||||
	status = xs_sendpages(transport->sock,
 | 
						status = xs_sendpages(transport->sock,
 | 
				
			||||||
			      xs_addr(xprt),
 | 
								      xs_addr(xprt),
 | 
				
			||||||
			      xprt->addrlen, xdr,
 | 
								      xprt->addrlen, xdr,
 | 
				
			||||||
| 
						 | 
					@ -1531,7 +1533,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
 | 
				
			||||||
	struct socket *sock = transport->sock;
 | 
						struct socket *sock = transport->sock;
 | 
				
			||||||
	int err, status = -EIO;
 | 
						int err, status = -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (xprt->shutdown || !xprt_bound(xprt))
 | 
						if (xprt->shutdown)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Start by resetting any existing state */
 | 
						/* Start by resetting any existing state */
 | 
				
			||||||
| 
						 | 
					@ -1572,7 +1574,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
 | 
				
			||||||
	struct socket *sock = transport->sock;
 | 
						struct socket *sock = transport->sock;
 | 
				
			||||||
	int err, status = -EIO;
 | 
						int err, status = -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (xprt->shutdown || !xprt_bound(xprt))
 | 
						if (xprt->shutdown)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Start by resetting any existing state */
 | 
						/* Start by resetting any existing state */
 | 
				
			||||||
| 
						 | 
					@ -1656,6 +1658,9 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
 | 
				
			||||||
		write_unlock_bh(&sk->sk_callback_lock);
 | 
							write_unlock_bh(&sk->sk_callback_lock);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!xprt_bound(xprt))
 | 
				
			||||||
 | 
							return -ENOTCONN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Tell the socket layer to start connecting... */
 | 
						/* Tell the socket layer to start connecting... */
 | 
				
			||||||
	xprt->stat.connect_count++;
 | 
						xprt->stat.connect_count++;
 | 
				
			||||||
	xprt->stat.connect_start = jiffies;
 | 
						xprt->stat.connect_start = jiffies;
 | 
				
			||||||
| 
						 | 
					@ -1676,7 +1681,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
 | 
				
			||||||
	struct socket *sock = transport->sock;
 | 
						struct socket *sock = transport->sock;
 | 
				
			||||||
	int err, status = -EIO;
 | 
						int err, status = -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (xprt->shutdown || !xprt_bound(xprt))
 | 
						if (xprt->shutdown)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!sock) {
 | 
						if (!sock) {
 | 
				
			||||||
| 
						 | 
					@ -1736,7 +1741,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
 | 
				
			||||||
	struct socket *sock = transport->sock;
 | 
						struct socket *sock = transport->sock;
 | 
				
			||||||
	int err, status = -EIO;
 | 
						int err, status = -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (xprt->shutdown || !xprt_bound(xprt))
 | 
						if (xprt->shutdown)
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!sock) {
 | 
						if (!sock) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue