diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index b49e434c094..568330eebbf 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -467,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, | |||
467 | int err, sent = 0; | 467 | int err, sent = 0; |
468 | 468 | ||
469 | if (unlikely(!sock)) | 469 | if (unlikely(!sock)) |
470 | return -ENOTCONN; | 470 | return -ENOTSOCK; |
471 | 471 | ||
472 | clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags); | 472 | clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags); |
473 | if (base != 0) { | 473 | if (base != 0) { |
@@ -577,6 +577,8 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
577 | req->rq_svec->iov_base, | 577 | req->rq_svec->iov_base, |
578 | req->rq_svec->iov_len); | 578 | req->rq_svec->iov_len); |
579 | 579 | ||
580 | if (!xprt_bound(xprt)) | ||
581 | return -ENOTCONN; | ||
580 | status = xs_sendpages(transport->sock, | 582 | status = xs_sendpages(transport->sock, |
581 | xs_addr(xprt), | 583 | xs_addr(xprt), |
582 | xprt->addrlen, xdr, | 584 | xprt->addrlen, xdr, |
@@ -594,6 +596,10 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
594 | } | 596 | } |
595 | 597 | ||
596 | switch (status) { | 598 | switch (status) { |
599 | case -ENOTSOCK: | ||
600 | status = -ENOTCONN; | ||
601 | /* Should we call xs_close() here? */ | ||
602 | break; | ||
597 | case -EAGAIN: | 603 | case -EAGAIN: |
598 | xs_nospace(task); | 604 | xs_nospace(task); |
599 | break; | 605 | break; |
@@ -693,6 +699,10 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
693 | } | 699 | } |
694 | 700 | ||
695 | switch (status) { | 701 | switch (status) { |
702 | case -ENOTSOCK: | ||
703 | status = -ENOTCONN; | ||
704 | /* Should we call xs_close() here? */ | ||
705 | break; | ||
696 | case -EAGAIN: | 706 | case -EAGAIN: |
697 | xs_nospace(task); | 707 | xs_nospace(task); |
698 | break; | 708 | break; |
@@ -1512,7 +1522,7 @@ static void xs_udp_connect_worker4(struct work_struct *work) | |||
1512 | struct socket *sock = transport->sock; | 1522 | struct socket *sock = transport->sock; |
1513 | int err, status = -EIO; | 1523 | int err, status = -EIO; |
1514 | 1524 | ||
1515 | if (xprt->shutdown || !xprt_bound(xprt)) | 1525 | if (xprt->shutdown) |
1516 | goto out; | 1526 | goto out; |
1517 | 1527 | ||
1518 | /* Start by resetting any existing state */ | 1528 | /* Start by resetting any existing state */ |
@@ -1553,7 +1563,7 @@ static void xs_udp_connect_worker6(struct work_struct *work) | |||
1553 | struct socket *sock = transport->sock; | 1563 | struct socket *sock = transport->sock; |
1554 | int err, status = -EIO; | 1564 | int err, status = -EIO; |
1555 | 1565 | ||
1556 | if (xprt->shutdown || !xprt_bound(xprt)) | 1566 | if (xprt->shutdown) |
1557 | goto out; | 1567 | goto out; |
1558 | 1568 | ||
1559 | /* Start by resetting any existing state */ | 1569 | /* Start by resetting any existing state */ |
@@ -1637,6 +1647,9 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
1637 | write_unlock_bh(&sk->sk_callback_lock); | 1647 | write_unlock_bh(&sk->sk_callback_lock); |
1638 | } | 1648 | } |
1639 | 1649 | ||
1650 | if (!xprt_bound(xprt)) | ||
1651 | return -ENOTCONN; | ||
1652 | |||
1640 | /* Tell the socket layer to start connecting... */ | 1653 | /* Tell the socket layer to start connecting... */ |
1641 | xprt->stat.connect_count++; | 1654 | xprt->stat.connect_count++; |
1642 | xprt->stat.connect_start = jiffies; | 1655 | xprt->stat.connect_start = jiffies; |
@@ -1657,7 +1670,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work) | |||
1657 | struct socket *sock = transport->sock; | 1670 | struct socket *sock = transport->sock; |
1658 | int err, status = -EIO; | 1671 | int err, status = -EIO; |
1659 | 1672 | ||
1660 | if (xprt->shutdown || !xprt_bound(xprt)) | 1673 | if (xprt->shutdown) |
1661 | goto out; | 1674 | goto out; |
1662 | 1675 | ||
1663 | if (!sock) { | 1676 | if (!sock) { |
@@ -1717,7 +1730,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work) | |||
1717 | struct socket *sock = transport->sock; | 1730 | struct socket *sock = transport->sock; |
1718 | int err, status = -EIO; | 1731 | int err, status = -EIO; |
1719 | 1732 | ||
1720 | if (xprt->shutdown || !xprt_bound(xprt)) | 1733 | if (xprt->shutdown) |
1721 | goto out; | 1734 | goto out; |
1722 | 1735 | ||
1723 | if (!sock) { | 1736 | if (!sock) { |