From patchwork Thu Feb 14 11:15:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 10812479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C5E013B5 for ; Thu, 14 Feb 2019 11:15:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFC012D790 for ; Thu, 14 Feb 2019 11:15:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3E5E2D794; Thu, 14 Feb 2019 11:15:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71D602D790 for ; Thu, 14 Feb 2019 11:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405053AbfBNLPs (ORCPT ); Thu, 14 Feb 2019 06:15:48 -0500 Received: from mx2.suse.de ([195.135.220.15]:45880 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731242AbfBNLPs (ORCPT ); Thu, 14 Feb 2019 06:15:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E91EAAAA9; Thu, 14 Feb 2019 11:15:46 +0000 (UTC) From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: piastryyy@gmail.com, Aurelien Aptel Subject: [cifs-utils PATCH v1] mount.cifs: be more verbose and helpful regarding mount errors Date: Thu, 14 Feb 2019 12:15:44 +0100 Message-Id: <20190214111544.24253-1-aaptel@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Aurelien Aptel --- mount.cifs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mount.cifs.c b/mount.cifs.c index ae7a899..9370f2e 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -2099,6 +2099,10 @@ mount_retry: switch (errno) { case ECONNREFUSED: case EHOSTUNREACH: + if (currentaddress) { + fprintf(stderr, "mount error(%d): could not connect to %s", + errno, currentaddress); + } currentaddress = nextaddress; if (currentaddress) { nextaddress = strchr(currentaddress, ','); @@ -2110,6 +2114,12 @@ mount_retry: fprintf(stderr, "mount error: %s filesystem not supported by the system\n", cifs_fstype); break; + case EHOSTDOWN: + fprintf(stderr, + "mount error: Server abruptly closed the connection.\n" + "This can happen if the server does not support the SMB version you are trying to use.\n" + "The default SMB version recently changed from SMB1 to SMB2.1 and above. Try mounting with vers=1.0.\n"); + break; case ENXIO: if (!already_uppercased && uppercase_string(parsed_info->host) && @@ -2126,7 +2136,7 @@ mount_retry: strerror(errno)); fprintf(stderr, "Refer to the %s(8) manual page (e.g. man " - "%s)\n", thisprogram, thisprogram); + "%s) and kernel log messages (dmesg)\n", thisprogram, thisprogram); rc = EX_FAIL; goto mount_exit; }