From patchwork Fri Oct 5 13:34:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew W Elble X-Patchwork-Id: 10628193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E225A112B for ; Fri, 5 Oct 2018 13:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1BDC292F4 for ; Fri, 5 Oct 2018 13:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0408292DE; Fri, 5 Oct 2018 13:41:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6E71292F4 for ; Fri, 5 Oct 2018 13:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727701AbeJEUkF (ORCPT ); Fri, 5 Oct 2018 16:40:05 -0400 Received: from discipline.rit.edu ([129.21.6.207]:58050 "HELO discipline.rit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728341AbeJEUkF (ORCPT ); Fri, 5 Oct 2018 16:40:05 -0400 Received: (qmail 81285 invoked by uid 501); 5 Oct 2018 13:34:37 -0000 From: Andrew Elble To: linux-nfs@vger.kernel.org Cc: Andrew Elble Subject: [PATCH RFC] nfs: make DELEGRETURN try harder to determine if a delegation has been revoked Date: Fri, 5 Oct 2018 09:34:29 -0400 Message-Id: <20181005133429.79332-1-aweits@rit.edu> X-Mailer: git-send-email 2.10.1 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's possible for DELEGRETURN to run into corner cases where a delegation has been revoked by the server, but that fact is being hidden by an error on the PUTFH/DELEGRETURN. So, in all error cases where revoked status isn't immediately obvious, do a TEST_STATEID to see if it is indeed revoked. Signed-off-by: Andrew Elble --- fs/nfs/nfs4proc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8220a168282e..3f38d281a814 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -386,6 +386,16 @@ static void nfs4_free_revoked_stateid(struct nfs_server *server, __nfs4_free_revoked_stateid(server, &tmp, cred); } +static void nfs4_free_possibly_revoked_stateid(struct nfs_server *server, + const nfs4_stateid *stateid, + struct rpc_cred *cred) +{ + nfs4_stateid tmp; + + nfs4_stateid_copy(&tmp, stateid); + nfs4_test_and_free_stateid(server, &tmp, cred); +} + static long nfs4_update_delay(long *timeout) { long ret; @@ -6035,9 +6045,13 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) nfs4_free_revoked_stateid(data->res.server, data->args.stateid, task->tk_msg.rpc_cred); - /* Fallthrough */ + task->tk_status = 0; + break; case -NFS4ERR_BAD_STATEID: case -NFS4ERR_STALE_STATEID: + nfs4_free_possibly_revoked_stateid(data->res.server, + data->args.stateid, + task->tk_msg.rpc_cred); task->tk_status = 0; break; case -NFS4ERR_OLD_STATEID: @@ -6058,6 +6072,10 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) &exception); if (exception.retry) goto out_restart; + + nfs4_free_possibly_revoked_stateid(data->res.server, + data->args.stateid, + task->tk_msg.rpc_cred); } data->rpc_status = task->tk_status; return;