Received: by 10.192.165.156 with SMTP id m28csp1119232imm; Wed, 11 Apr 2018 12:48:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Pv+HPddw05Ms43jWAIWCz//JOVm9ODnUeUAAZm5gnimCmm/yA2jRCS1ym5AJmwpBW5vqp X-Received: by 10.101.85.11 with SMTP id f11mr101145pgr.252.1523476106362; Wed, 11 Apr 2018 12:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523476106; cv=none; d=google.com; s=arc-20160816; b=FJWTWIKDz6vW6s7eqs6tJQ5U62kRE/T9NX+xZ6nmYTUogPyyFaY72TCb8Bxs0ZgLPQ mFwKVz8iVFYw3rjG+Fi7u/VyxKzjOcKwGtQ+iutbXmsxvFBacJ6fqIX8fsDMQgmX5Yhu mRmnZ/pQ70UEfZWIrEB7xwsxrLGX7d6QoHwklg8mnAu9mJ9GxMNVN/rt1z7ryAOf/cOo MH8Cp9yVQDOcPI7LV57cK7CEzhIYpaTyCSrvTB0pN32y+YkzNKIwaTCRe9+Rd9EkIOs+ x1wUZ+fPaN37XZwNBLB+m6z1XUSdZXvA/xEmFviaQNSZ1J8BJeUaaQmlgQjJxMhBjtDU bVlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iEPHOmyY+ggQczFbaFcngtyqKNsNPccZ9jqFSXFk+Lk=; b=hgRuAiJkbjGf2OyWxc8uE7ZZ/2GB5PQAAviL57u9xeargeUXVRdSILhIjEjtyr2l4L jEw+d5vjBlpxDU4xXXXUG1kAJgezyBls5c2XmQC6B/U2teu2bDVyoBhLCh90AzRCPcv0 l1GC87DuR4T7kOxElJGGEVP5Q0m6NpvfItZOj8cHorteWMAzL22ptdgbj5xklRCZix58 DNbSkHWV1wPCXXbtf0F5i2FVKnLyYueQDXb97GyjjgMqRPmsfiKqXQ0uscHZs2aM5HwH z6Ro1Dq5TLPXiNOXYuTszxL60cvR8JGwkk9CWUB/m1jXYR1B6/XoGnH2H4SFgV4dc4vl Njug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7-v6si86770pll.476.2018.04.11.12.47.49; Wed, 11 Apr 2018 12:48:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756656AbeDKTAL (ORCPT + 99 others); Wed, 11 Apr 2018 15:00:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37632 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752973AbeDKTAJ (ORCPT ); Wed, 11 Apr 2018 15:00:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 145FA9C1; Wed, 11 Apr 2018 19:00:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , Trond Myklebust , Sasha Levin Subject: [PATCH 4.9 164/310] SUNRPC: ensure correct error is reported by xs_tcp_setup_socket() Date: Wed, 11 Apr 2018 20:35:03 +0200 Message-Id: <20180411183629.437813707@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: NeilBrown [ Upstream commit 6ea44adce91526700535b3150f77f8639ae8c82d ] If you attempt a TCP mount from an host that is unreachable in a way that triggers an immediate error from kernel_connect(), that error does not propagate up, instead EAGAIN is reported. This results in call_connect_status receiving the wrong error. A case that it easy to demonstrate is to attempt to mount from an address that results in ENETUNREACH, but first deleting any default route. Without this patch, the mount.nfs process is persistently runnable and is hard to kill. With this patch it exits as it should. The problem is caused by the fact that xs_tcp_force_close() eventually calls xprt_wake_pending_tasks(xprt, -EAGAIN); which causes an error return of -EAGAIN. so when xs_tcp_setup_sock() calls xprt_wake_pending_tasks(xprt, status); the status is ignored. Fixes: 4efdd92c9211 ("SUNRPC: Remove TCP client connection reset hack") Signed-off-by: NeilBrown Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtsock.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2384,7 +2384,12 @@ static void xs_tcp_setup_socket(struct w case -EHOSTUNREACH: case -EADDRINUSE: case -ENOBUFS: - /* retry with existing socket, after a delay */ + /* + * xs_tcp_force_close() wakes tasks with -EIO. + * We need to wake them first to ensure the + * correct error code. + */ + xprt_wake_pending_tasks(xprt, status); xs_tcp_force_close(xprt); goto out; }