SUNRPC: Prevent immediate close+reconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

commit 3be232f11a3cc9b0ef0795e39fa11bdb8e422a06 upstream.

If we have already set up the socket and are waiting for it to connect,
then don't immediately close and retry.

Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 net/sunrpc/xprt.c     |    3 ++-
 net/sunrpc/xprtsock.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done);
  */
 static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt)
 {
-	set_bit(XPRT_CLOSE_WAIT, &xprt->state);
+	if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state))
+		return;
 	if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
 		queue_work(xprtiod_workqueue, &xprt->task_cleanup);
 	else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2365,7 +2365,7 @@ static void xs_connect(struct rpc_xprt *
 
 	WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
 
-	if (transport->sock != NULL) {
+	if (transport->sock != NULL && !xprt_connecting(xprt)) {
 		dprintk("RPC:       xs_connect delayed xprt %p for %lu "
 				"seconds\n",
 				xprt, xprt->reestablish_timeout / HZ);


Patches currently in stable-queue which might be from trond.myklebust@xxxxxxxxxxxxxxx are

queue-5.15/sunrpc-handle-low-memory-situations-in-call_status.patch
queue-5.15/sunrpc-svc_tcp_sendmsg-should-handle-errors-from-xdr.patch
queue-5.15/sunrpc-fix-socket-waits-for-write-buffer-space.patch
queue-5.15/nfs-avoid-writeback-threads-getting-stuck-in-mempool.patch
queue-5.15/nfs-swap-out-must-always-use-stable-writes.patch
queue-5.15/sunrpc-prevent-immediate-close-reconnect.patch
queue-5.15/nfs-nfsiod-should-not-block-forever-in-mempool_alloc.patch
queue-5.15/nfsv4-protect-the-state-recovery-thread-against-dire.patch
queue-5.15/nfsv4-fix-open-failure-with-o_accmode-flag.patch
queue-5.15/nfsv4.2-fix-reference-count-leaks-in-_nfs42_proc_cop.patch
queue-5.15/revert-nfsv4-handle-the-special-linux-file-open-acce.patch
queue-5.15/nfs-swap-io-handling-is-slightly-different-for-o_dir.patch
queue-5.15/sunrpc-handle-enomem-in-call_transmit_status.patch
queue-5.15/sunrpc-call_alloc-async-tasks-mustn-t-block-waiting-.patch
queue-5.15/sunrpc-remove-scheduling-boost-for-swapper-tasks.patch
queue-5.15/sunrpc-xprt-async-tasks-mustn-t-block-waiting-for-me.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux