From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2846C3A5A6 for ; Thu, 19 Sep 2019 22:24:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5F2C2196E for ; Thu, 19 Sep 2019 22:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931856; bh=ZnDZXhBIRGN6OWMGxYRviA8kQtnsHMHEhPRM7nl7h60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lBuk1/zQJBD0mUWYIzVnUtbt9AfmJRSapyeAp8LRle/vmxOY0yeqCE8xWXygZOIVF IfTWLNGu0RUz4QbMQDqKDhZVPx4EXTC5UE/pkkrJlIeHT8IERM+jmEHr7B5LuDxk8d q4A+t6t4ZIcEarNzsMU1KV3gGo98Rz0DqCuDh6lw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407142AbfISWYP (ORCPT ); Thu, 19 Sep 2019 18:24:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:40232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407126AbfISWYK (ORCPT ); Thu, 19 Sep 2019 18:24:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9462321929; Thu, 19 Sep 2019 22:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931850; bh=ZnDZXhBIRGN6OWMGxYRviA8kQtnsHMHEhPRM7nl7h60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yte8qhvcRP9MDSpBEcddV9UMGqJ7KRn1A5bl3dRZ+lOVAusy7Ucl4F5nKtww9ffZa W530S/aMgb34nBDtNs4lovmYSpZdVtoo9aiiPefpTtn2JAcDU4/AbtjOannQOqcjXi SMbl6/vQukUp2BMUyuPSrBW0re3FlbA0lzLlZCN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 4.4 38/56] NFSv4: Fix return values for nfs4_file_open() Date: Fri, 20 Sep 2019 00:04:19 +0200 Message-Id: <20190919214758.710383344@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214742.483643642@linuxfoundation.org> References: <20190919214742.483643642@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit 90cf500e338ab3f3c0f126ba37e36fb6a9058441 ] Currently, we are translating RPC level errors such as timeouts, as well as interrupts etc into EOPENSTALE, which forces a single replay of the open attempt. What we actually want to do is force the replay only in the cases where the returned error indicates that the file may have changed on the server. So the fix is to spell out the exact set of errors where we want to return EOPENSTALE. Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs4file.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index d3e3761eacfa2..c5e884585c23a 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -73,13 +73,13 @@ nfs4_file_open(struct inode *inode, struct file *filp) if (IS_ERR(inode)) { err = PTR_ERR(inode); switch (err) { - case -EPERM: - case -EACCES: - case -EDQUOT: - case -ENOSPC: - case -EROFS: - goto out_put_ctx; default: + goto out_put_ctx; + case -ENOENT: + case -ESTALE: + case -EISDIR: + case -ENOTDIR: + case -ELOOP: goto out_drop; } } -- 2.20.1