Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3749321rwl; Mon, 27 Mar 2023 19:53:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtTiov+AOuYRxI1cA5DoxJS9O968pN9oQzoAsau9fZBSPNk19gjPlEmUVh4ldZiakj+rCf X-Received: by 2002:a17:907:724b:b0:93f:2256:fc05 with SMTP id ds11-20020a170907724b00b0093f2256fc05mr10507741ejc.55.1679972034425; Mon, 27 Mar 2023 19:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679972034; cv=none; d=google.com; s=arc-20160816; b=VXvd2mKcq+m01fb0k41vi4cMkOtr++sA802LglS/3+SP1H2SIqdlFflnXSzzrmTXdw 5QBupv3/X5LFTuqtdDajuy5NNOCNdgm5/UQyg0SXjqglIaX5nTOtep/yptCj5Z1G0KQJ d7NoXHR2H9O+BGQgwHoKO84XWspHGcyauIfiIl4HnK0btV3AnCMJ4eepUUKjRecDlXFj F5xQjE97wVxItjyAzbkzjOUZZfNEw/W70lrUAfqWveNPMPFkKjuc4LeU2guZ1NsByZwk /XuJt9UMMlCMYfJTnYxhEXuBqnvLjTg+ByYava5HtWSqJ8s51y1rmYJdTlBjQoFjmITJ bCxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=1eNZOzjtx2l9dFrbZ6TzlJEzuvxBpdSKMOkg8I/uaqE=; b=bNUAQAbtK387tQ/lDW/5565XdpOHCAa8/TbtPgG462nTErj5uwakJGFq55vW8S96Tr Kj368edSxkhOSTmGahnybx3ppfPhKT958Iy3SeLnUiZ8CVdKaUBfdJsHx6iPXAy4Tpq7 Xk9zR2GFxKLiWIgQ27fOcHo/+jFbAINHwlKzu5oUsiQaSgimuACMh5JwxtVhWmyI64TX wu8tuafrQrPM6y1kvblsJTppveEa2OOQqPExPiGdAoihX9HSvwYxXoJ0LSlbhNbtJnid nG7Fu8gWonHDcJmuMQPzPe4Ds2/CnhbNuKrTBPRZOXPjIdSsLhK1oUeKyIXUY7gPyD4M 5jsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=VhFiiUi3; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a1709064ad100b0093d79dde8d1si10390690ejt.231.2023.03.27.19.53.20; Mon, 27 Mar 2023 19:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=VhFiiUi3; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbjC1CxI (ORCPT + 99 others); Mon, 27 Mar 2023 22:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbjC1CxH (ORCPT ); Mon, 27 Mar 2023 22:53:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE7D51FF0 for ; Mon, 27 Mar 2023 19:53:06 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1721C1FD6A; Tue, 28 Mar 2023 02:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679971985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1eNZOzjtx2l9dFrbZ6TzlJEzuvxBpdSKMOkg8I/uaqE=; b=VhFiiUi3LJJ7Ep7ZZvQYQCTMCBip0yXlRxtcNggTP1+LhqlDnyBALlXRqMrM7SLsaryaGp hXeMXYXBWbym1b/A2ad/zOXtZJlc5RajP79ipzpJS/5DfbTBDmmB2RrsA8u2sTMuYJxSKy MKa2kPxU9doK2L9UZAA0oyY8ZuM7YT8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679971985; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1eNZOzjtx2l9dFrbZ6TzlJEzuvxBpdSKMOkg8I/uaqE=; b=tCvMbdV3ytE9wdp4Ng5pCQe3MSNtZla5E/malr584wEywRg2nHfHkr2VO6WCR9kmfN1Bfw Jor0sB2Q7mlOvNCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DFF22133B6; Tue, 28 Mar 2023 02:53:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nF9lJY9WImSHJgAAMHmgww (envelope-from ); Tue, 28 Mar 2023 02:53:03 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: Steve Dickson Cc: Linux NFS Mailing List Subject: [PATCH nfs-utils] mount.nfs: always include mountpoint or spec if error messages. Date: Tue, 28 Mar 2023 13:53:00 +1100 Message-id: <167997198028.8106.1574926503489095936@noble.neil.brown.name> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If you try to mount from a server that is inaccessible you might get an error like: mount.nfs: No route to host This is OK when running "mount" interactively, but hardly useful when found in system logs. This patch changes mount_error() to always included at least one of mount_point and spec in any error message. Signed-off-by: NeilBrown --- utils/mount/error.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/utils/mount/error.c b/utils/mount/error.c index 73295bf0567c..9ddbcc096f72 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -207,16 +207,17 @@ void mount_error(const char *spec, const char *mount_po= int, int error) progname, spec); break; case EINVAL: - nfs_error(_("%s: an incorrect mount option was specified"), progname); + nfs_error(_("%s: an incorrect mount option was specified for %s"), + progname, mount_point); break; case EOPNOTSUPP: - nfs_error(_("%s: requested NFS version or transport protocol is not suppor= ted"), - progname); + nfs_error(_("%s: requested NFS version or transport protocol is not suppor= ted for %s"), + progname, mount_point); break; case ENOTDIR: if (spec) - nfs_error(_("%s: mount spec %s or point %s is not a " - "directory"), progname, spec, mount_point); + nfs_error(_("%s: mount spec %s or point %s is not a directory"), + progname, spec, mount_point); else nfs_error(_("%s: mount point %s is not a directory"), progname, mount_point); @@ -227,31 +228,31 @@ void mount_error(const char *spec, const char *mount_po= int, int error) break; case ENOENT: if (spec) - nfs_error(_("%s: mounting %s failed, " - "reason given by server: %s"), - progname, spec, strerror(error)); + nfs_error(_("%s: mounting %s failed, reason given by server: %s"), + progname, spec, strerror(error)); else nfs_error(_("%s: mount point %s does not exist"), - progname, mount_point); + progname, mount_point); break; case ESPIPE: rpc_mount_errors((char *)spec, 0, 0); break; case EIO: - nfs_error(_("%s: mount system call failed"), progname); + nfs_error(_("%s: mount system call failed for %s"), + progname, mount_point); break; case EFAULT: - nfs_error(_("%s: encountered unexpected error condition."), - progname); + nfs_error(_("%s: encountered unexpected error condition for %s."), + progname, mount_point); nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT), - progname); + progname); break; case EALREADY: /* Error message has already been provided */ break; default: - nfs_error(_("%s: %s"), - progname, strerror(error)); + nfs_error(_("%s: %s for %s on %s"), + progname, strerror(error), spec, mount_point); } } =20 --=20 2.40.0