Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3572294pxb; Fri, 4 Feb 2022 11:22:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJztojKUHnLJ7XPH0mX+J5cLX2AKJ8kB+AYuoHaevdi/JjyGsYVIm6BPbGn86lfapO8IQrbP X-Received: by 2002:a17:902:e812:: with SMTP id u18mr4613122plg.159.1644002560522; Fri, 04 Feb 2022 11:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644002560; cv=none; d=google.com; s=arc-20160816; b=ZUsBCDXLGT4+y8SJTulpPFrnT5e9CGwDTZSImUpjV4gdY+9FLTZKClTmxlnVLojPf1 duZ3Dgrd1kco7RTmFk2KjQYr8y3ALdbIbyWcyK5dGptDBH3+bJZaSsiJ3cEbBVXtzU9A 9CfoxIBPfrbZxQtls+DQZ7BDN88WoTN5z7BL2eN1eidNF02XziifRx0ThlasBTH3m9VX ePpr6KVZyyA5J51cIp2qcTd9k8B/l5Aeb7qyNx1Z1FvvTvNepQxfFMj7dcW9E6mAaEqE AqjOxfQ/cCTpuO7U8EefWlKquZExaNotlX+IbUAYjCQXIeMUBj3r/DCZYh0I4SBXxAJy 1AJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=f4GGEtkTxFJY6Ux5Y3qrC8+gtxkH0FL9hwI1wkXvKPk=; b=lUvN3x3q+mSF3TfrEjKx/X/ikdRYIFEnfBQH74L7Kx2fJWrkfP7wLG+NDkqze7SKFG jSAhZSbxN93Q+m13KlEICB+Rn09U95JeeCmMGM7tC/Cu52GXUuRDOntE9XLoFJGCtPr5 yQIGnH8wQGufLVCsXrhJw7jIlYs+eJAnt1DIOn2tmEoLa0hBbgCR/jthqt0dU37UDVd7 Y2ggY752NsMs+cosOQIOBgJBE5jsPLPpkYI8X+hJdaRC+2qGMxMYiU/hTWK82Qjp77G5 iN1Svl9oaNgqEO1aH7Tlk65kXUyPImGkyBENWcJggegB+YR5VVcM8UU9YmFGc+PIVGZt JMIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qrm4KizC; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ms18si10562963pjb.29.2022.02.04.11.22.07; Fri, 04 Feb 2022 11:22:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qrm4KizC; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231194AbiBCNRh (ORCPT + 99 others); Thu, 3 Feb 2022 08:17:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25713 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbiBCNRh (ORCPT ); Thu, 3 Feb 2022 08:17:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643894256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=f4GGEtkTxFJY6Ux5Y3qrC8+gtxkH0FL9hwI1wkXvKPk=; b=Qrm4KizCfeB/Qhm64f5zOmm1gwpbdNLs22B9h2JcnDb/zLuE0OKflKfGjQ4Z2fHGGA+e98 X91d15pel9N/ByRonQSi8dMIqMk5TEzrzOVffe+E3H50/hvSM8ARcpKFiaimgrXaLI0Fqe Uo4qb6m6z8EoB5fFEhzo//U+9WoZ9cs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-478-sXcNROsrNbqPiSwnvIR9Tw-1; Thu, 03 Feb 2022 08:17:33 -0500 X-MC-Unique: sXcNROsrNbqPiSwnvIR9Tw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EACDA1054F90; Thu, 3 Feb 2022 13:17:32 +0000 (UTC) Received: from fedora.rsable.com (unknown [10.74.17.153]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7A368049C; Thu, 3 Feb 2022 13:17:31 +0000 (UTC) Date: Thu, 3 Feb 2022 18:47:28 +0530 From: Rohan Sable To: linux-nfs@vger.kernel.org Cc: rohanjsable@gmail.com Subject: [PATCH] Fix error reporting for already mounted shares. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org When mount is triggered for an already mounted share (using auto negotiation), it displays "mount.nfs: Protocol not supported" or "mount.nfs: access denied by server while mounting" instead of EBUSY. This easily causes confusion if the mount was not tried verbose : [root@rsable ~]# mount 127.0.0.1:/export /mnt mount.nfs: Protocol not supported [root@rsable ~]# mount -v 127.0.0.1:/export /mnt mount.nfs: timeout set for Mon Apr 5 16:03:53 2021 mount.nfs: trying text-based options 'vers=4.2,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'vers=4,addr=127.0.0.1,clientaddr=127.0.0.1' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'addr=127.0.0.1' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 127.0.0.1 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 127.0.0.1 prog 100005 vers 3 prot UDP port 20048 mount.nfs: mount(2): Device or resource busy << actual error mount.nfs: Protocol not supported [root@rsable ~]# mount rsable76server:/testshare /mnt mount.nfs: access denied by server while mounting rsable76server:/testshare [root@rsable ~]# mount rsable76server:/testshare /mnt -v mount.nfs: timeout set for Mon Jan 17 13:36:16 2022 mount.nfs: trying text-based options 'vers=4.1,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied mount.nfs: trying text-based options 'vers=4.0,addr=192.168.122.58,clientaddr=192.168.122.82' mount.nfs: mount(2): Permission denied mount.nfs: trying text-based options 'addr=192.168.122.58' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.122.58 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.122.58 prog 100005 vers 3 prot UDP port 20048 mount.nfs: mount(2): Device or resource busy << actual error mount.nfs: access denied by server while mounting rsable76server:/testshare Signed-off-by: Rohan Sable Signed-off-by: Yongcheng Yang --- utils/mount/stropts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 3c4e218a..573df6ee 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -973,7 +973,9 @@ fall_back: if ((result = nfs_try_mount_v3v2(mi, FALSE))) return result; - errno = olderrno; + if (errno != EBUSY || errno != EACCES) + errno = olderrno; + return result; } -- 2.34.1