From patchwork Mon Feb 17 23:43:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 3666361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C5FBFBF13A for ; Mon, 17 Feb 2014 23:43:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34FC520211 for ; Mon, 17 Feb 2014 23:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73738201FE for ; Mon, 17 Feb 2014 23:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753948AbaBQXnS (ORCPT ); Mon, 17 Feb 2014 18:43:18 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52152 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbaBQXnR (ORCPT ); Mon, 17 Feb 2014 18:43:17 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8ED3AAC9B; Mon, 17 Feb 2014 23:43:16 +0000 (UTC) Date: Tue, 18 Feb 2014 10:43:07 +1100 From: NeilBrown To: Steve Dickson Cc: Chuck Lever , NFS , Carsten Ziepke Subject: [PATCH - nfs-utils] Fix fallback from tcp to udp Message-ID: <20140218104307.34205fc8@notabene.brown> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Protocol negotiation in mount.nfs does not correctly negotiate with a server which only support NFSv3 and UDP. When mount.nfs attempts an NFSv4 mount and fails with ECONNREFUSED it does not fall back to NFSv3, as this is not recognised as a "does not support NFSv4" error. However ECONNREFUSED is a clear indication that the server doesn't support TCP, and ipso facto does not support NFSv4. So ECONNREFUSED should trigger a fallback from v4 to v2/3. Once we allow that error, NFSv3 is attempted and mount.nfs talks to rpcbind and discovers that UDP should be used for v3 and the mount succeeds. Signed-off-by: NeilBrown Reported-by: Carsten Ziepke diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index a642394d2f5a..6d4fd70b7b9e 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -807,6 +807,9 @@ static int nfs_autonegotiate(struct nfsmount_info *mi) /* Linux servers prior to 2.6.25 may return * EPERM when NFS version 4 is not supported. */ goto fall_back; + case ECONNREFUSED: + /* UDP-Only servers won't support v4 */ + goto fall_back; default: return result; }