From patchwork Mon Mar 4 22:37:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 2215111 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6527CDF2F2 for ; Mon, 4 Mar 2013 22:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758788Ab3CDWhS (ORCPT ); Mon, 4 Mar 2013 17:37:18 -0500 Received: from mx12.netapp.com ([216.240.18.77]:53985 "EHLO mx12.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758783Ab3CDWhR (ORCPT ); Mon, 4 Mar 2013 17:37:17 -0500 X-IronPort-AV: E=Sophos;i="4.84,783,1355126400"; d="scan'208,223";a="27873121" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx12-out.netapp.com with ESMTP; 04 Mar 2013 14:37:16 -0800 Received: from vmwexceht02-prd.hq.netapp.com (vmwexceht02-prd.hq.netapp.com [10.106.76.240]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id r24MbGG7027601; Mon, 4 Mar 2013 14:37:16 -0800 (PST) Received: from SACEXCMBX05-PRD.hq.netapp.com ([169.254.9.231]) by vmwexceht02-prd.hq.netapp.com ([10.106.76.240]) with mapi id 14.02.0328.009; Mon, 4 Mar 2013 14:37:15 -0800 From: "Myklebust, Trond" To: Jan Engelhardt CC: Chuck Lever , "J. Bruce Fields" , "linux-nfs@vger.kernel.org" Subject: Re: Inconsistent error codes between NFSv4 and v3 on network issues Thread-Topic: Inconsistent error codes between NFSv4 and v3 on network issues Thread-Index: AQHOFnIWaN9s9O2SA06Jm0S61BYtk5iWWdWAgAAXPICAABn5AIAAH9IA Date: Mon, 4 Mar 2013 22:37:15 +0000 Message-ID: <4FA345DA4F4AE44899BD2B03EEEC2FA9286AF064@sacexcmbx05-prd.hq.netapp.com> References: <6AADB1AD-6FB9-42AD-8BF2-6B0B706927E5@oracle.com> <4FA345DA4F4AE44899BD2B03EEEC2FA9286ADBED@sacexcmbx05-prd.hq.netapp.com> In-Reply-To: <4FA345DA4F4AE44899BD2B03EEEC2FA9286ADBED@sacexcmbx05-prd.hq.netapp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.104.60.117] MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, 2013-03-04 at 20:43 +0000, Myklebust, Trond wrote: > On Mon, 2013-03-04 at 20:10 +0100, Jan Engelhardt wrote: > > Just nuke your default route, and it should be easily reproducible. > > > > The problem is that call_connect_status() is converting that ENETUNREACH > into a EIO. We shouldn't be doing that, but should leave it up to the > caller (i.e. the NFS layer) to perform that kind of mapping. Could you please check if the attached patch helps. From 724bf7a71b44145811a1fec3b20a26bd1edae51b Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 4 Mar 2013 17:29:33 -0500 Subject: [PATCH] SUNRPC: Report network/connection errors correctly for SOFTCONN rpc tasks In the case of a SOFTCONN rpc task, we really want to ensure that it reports errors like ENETUNREACH back to the caller. Currently, only some of these errors are being reported back (connect errors are not), and they are being converted by the RPC layer into EIO. Reported-by: Jan Engelhardt Signed-off-by: Trond Myklebust --- net/sunrpc/clnt.c | 24 ++++++++++++++---------- net/sunrpc/xprtsock.c | 8 ++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index dcc446e..b95a0a2 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1644,22 +1644,26 @@ call_connect_status(struct rpc_task *task) dprint_status(task); - task->tk_status = 0; - if (status >= 0 || status == -EAGAIN) { - clnt->cl_stats->netreconn++; - task->tk_action = call_transmit; - return; - } - trace_rpc_connect_status(task, status); switch (status) { /* if soft mounted, test if we've timed out */ case -ETIMEDOUT: task->tk_action = call_timeout; - break; - default: - rpc_exit(task, -EIO); + return; + case -ECONNREFUSED: + case -ECONNRESET: + case -ENETUNREACH: + if (RPC_IS_SOFTCONN(task)) + break; + /* retry with existing socket, after a delay */ + case 0: + case -EAGAIN: + task->tk_status = 0; + clnt->cl_stats->netreconn++; + task->tk_action = call_transmit; + return; } + rpc_exit(task, status); } /* diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c1d8476..3081620 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2202,10 +2202,6 @@ static void xs_tcp_setup_socket(struct work_struct *work) */ xs_tcp_force_close(xprt); break; - case -ECONNREFUSED: - case -ECONNRESET: - case -ENETUNREACH: - /* retry with existing socket, after a delay */ case 0: case -EINPROGRESS: case -EALREADY: @@ -2216,6 +2212,10 @@ static void xs_tcp_setup_socket(struct work_struct *work) /* Happens, for instance, if the user specified a link * local IPv6 address without a scope-id. */ + case -ECONNREFUSED: + case -ECONNRESET: + case -ENETUNREACH: + /* retry with existing socket, after a delay */ goto out; } out_eagain: -- 1.8.1.4