From patchwork Thu Feb 18 02:59:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 8345181 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 44093C0553 for ; Thu, 18 Feb 2016 02:59:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5EF7202EB for ; Thu, 18 Feb 2016 02:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECF1320221 for ; Thu, 18 Feb 2016 02:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424483AbcBRC7Y (ORCPT ); Wed, 17 Feb 2016 21:59:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:55595 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424050AbcBRC7Y (ORCPT ); Wed, 17 Feb 2016 21:59:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BF6D2ABB1; Thu, 18 Feb 2016 02:59:22 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Thu, 18 Feb 2016 13:59:17 +1100 Subject: [PATCH] mount.nfs - hide EBUSY errors. User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-suse-linux-gnu) cc: Linux NFS Mailing List Message-ID: <877fi2raey.fsf@notabene.neil.brown.name> 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, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham 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 Linux only returns EBUSY for a non-remount mount if the exact requested filesystem is already mounted. Arguably this is not an error. "mount -a" tries to see if each requested filesystem is already mounted. Sometimes it gets it wrong - e.g. hostname aliases can confuse it. So "mount -a" will report a failure "already mounted", which is wrong because it should filter those out. An easy fix it just to be silent about EBUSY. As the requested result (a given filesystem being mounted at a given location) is in effect after the EBUSY return, we can just treat it as success. This removes the confusing "already mounted" errors. Signed-off-by: NeilBrown --- utils/mount/stropts.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 86829a902bfd..320dde2fab92 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -960,6 +960,15 @@ static int nfsmount_fg(struct nfsmount_info *mi) if (nfs_try_mount(mi)) return EX_SUCCESS; + if (errno == EBUSY) + /* The only cause of EBUSY is if exactly the desired + * filesystem is already mounted. That can arguably + * be seen as success. "mount -a" tries to optimise + * out this case but sometimes fails. Help it out + * by pretending everything is rosy + */ + return EX_SUCCESS; + if (nfs_is_permanent_error(errno)) break;