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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 31072C3A5A8 for ; Wed, 4 Sep 2019 16:04:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F14D722CF5 for ; Wed, 4 Sep 2019 16:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567613091; bh=ZnDZXhBIRGN6OWMGxYRviA8kQtnsHMHEhPRM7nl7h60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wOJU9Dx4rFkrSQvrpW7HCdsqP/D5BBhGbo/H4Zp0hkU81dmOmGuAXUQLi0xMmdIEh lbKLBe5nCaNvRAPBbBWAaKZUDDdNn8P120QnsuTs6mPt4h2kBNKW7G/WKK2h9Jj62w jca16tqYTz1dld5v61XcZkG//3eCDhsonf+T3jc0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387757AbfIDQEu (ORCPT ); Wed, 4 Sep 2019 12:04:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:39538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387599AbfIDQDJ (ORCPT ); Wed, 4 Sep 2019 12:03:09 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0FDCB22CF5; Wed, 4 Sep 2019 16:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612988; bh=ZnDZXhBIRGN6OWMGxYRviA8kQtnsHMHEhPRM7nl7h60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGs45oLXNt+hphd3Dm7Cag83MODN0ctrhSLnWtz7t2/3yEm+PIGzAa4ROgDIN9bto Vk5MAp4YtYl9DGCrPRmkUIX6XVe2OF00TYz7EgNgC/zaZ+J38r9ldI4LKSH5JFnaHH KScz81tUNg9rjJj0s4uiIEzBjaOUvIW83H3DxQe0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Trond Myklebust , Sasha Levin , linux-nfs@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 04/20] NFSv4: Fix return values for nfs4_file_open() Date: Wed, 4 Sep 2019 12:02:47 -0400 Message-Id: <20190904160303.5062-4-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904160303.5062-1-sashal@kernel.org> References: <20190904160303.5062-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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