From patchwork Mon Mar 23 05:44:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 6070631 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91902BF90F for ; Mon, 23 Mar 2015 05:44:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF933201BB for ; Mon, 23 Mar 2015 05:44:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01F42201B9 for ; Mon, 23 Mar 2015 05:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbbCWFoE (ORCPT ); Mon, 23 Mar 2015 01:44:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40476 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbbCWFoD (ORCPT ); Mon, 23 Mar 2015 01:44:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 21337AAC8; Mon, 23 Mar 2015 05:44:02 +0000 (UTC) Date: Mon, 23 Mar 2015 16:44:14 +1100 From: NeilBrown To: Steve Dickson , NFS Subject: [PATCH - nfs-utils] mount: improve error message when statd cannot be started. Message-ID: <20150323164414.7eca921f@notabene.brown> X-Mailer: Claws Mail 3.10.1-162-g4d0ed6 (GTK+ 2.24.25; 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 If you try to mount and NFSv3 filesystem, and statd is not running and cannot be started (maybe rpcbind isn't running either), the error message is: mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd. mount.nfs: an incorrect mount option was specified That last line is incorrect and misleading: no incorret mount option was specified. This line comes from mount_error() in error.c. In this case that function doesn't really need to provide any more information. So introduce a concention that EALREADY means an error message has already been printed, and use it to suppress that message. Signed-off-by: NeilBrown diff --git a/utils/mount/error.c b/utils/mount/error.c index e06f598e96e3..c9797fc380c4 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -247,6 +247,9 @@ void mount_error(const char *spec, const char *mount_point, int error) nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT), progname); break; + case EALREADY: + /* Error message has already been provided */ + break; default: nfs_error(_("%s: %s"), progname, strerror(error)); diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 76ecb3292860..df67facdd9d1 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -298,6 +298,7 @@ static int nfs_verify_lock_option(struct mount_options *options) "required for remote locking."), progname); nfs_error(_("%s: Either use '-o nolock' to keep " "locks local, or start statd."), progname); + errno = EALREADY; /* Don't print further error message */ return 0; }