Received: by 10.192.165.156 with SMTP id m28csp1073629imm; Wed, 11 Apr 2018 11:56:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+XqBUSBst7entRDyGPEgqbmD5fGDFylOGdlNaNNotB06vSNvU56IgL+0APgt+d0LPDY4pc X-Received: by 10.99.177.9 with SMTP id r9mr2812532pgf.60.1523473005159; Wed, 11 Apr 2018 11:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473005; cv=none; d=google.com; s=arc-20160816; b=xNy0sTvIItx6O3gZzo3hIN6W9/9xtjbvDGouDWSD3JXZoZ/E5w/ovl2t2xIDUSx5py FpBdF55pR1gRFGPqLVjcKrwQrcG+/MB/ZFnVFQ0F7vNJkjO7ZS3b6OI4pZ6TvnUTj5E0 1ELlJjaYw8V/t2xsUMgQTJ4dAISijfFqa2xns97t4mYekckQSkOBj0Gdjsp3WY6sPxdO YL65NImtGk9LNSPkpqAqxykfAbPu/C3LpvHR3pZXNqwkoVvBeprKKGM+TnqprcgldgMP yjAGRAouDey6geSdQ3Mq+wGoxESZnNw/eKhAMozgAdx7Tyz+pwPFM1lfDDEdPVM2sf0x ePFA== 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=9tJuar9MI15L/HIROLz1N2Mu1H7pyTcWgMueTLhhnvc=; b=z6DP8pxEKvQEgie+6O0el8HloxeAJy0Lu5FChtz4OBMH9t8lU9zjYpMq1JGu5bB4ip qLraj8xQvwF3beHIBVn3dj+0wJSQlFRHA7rjXSIQMw1W4FdLYqeK8eVATG/wW2O1Aw2j UjvCVaLc2mX0hwoTs0jpTIj7mEXO0OZ2iHSXaja3wy16xllY47wVnVZg3tModUob8Fxv hfWs+weUW8xU118Vgs0lGy9m4XfGZEsiV7LEnb0h/Odq5eMq2QK/VdIcvygl13OLjFJE zZTYwyhR9mpEZO/gobHoXVJ5emvpfC5jOfCPKVHk7ZgqX+y8bjH2azp4rrX+DobGOQJL Wyyg== 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 3-v6si1672416plq.136.2018.04.11.11.56.08; Wed, 11 Apr 2018 11:56:45 -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 S932581AbeDKStt (ORCPT + 99 others); Wed, 11 Apr 2018 14:49:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60520 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932451AbeDKStp (ORCPT ); Wed, 11 Apr 2018 14:49:45 -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 CD28D94F; Wed, 11 Apr 2018 18:49:44 +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.4 104/190] SUNRPC: ensure correct error is reported by xs_tcp_setup_socket() Date: Wed, 11 Apr 2018 20:35:50 +0200 Message-Id: <20180411183556.672161741@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@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.4-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 @@ -2363,7 +2363,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; }