From patchwork Thu Sep 15 16:45:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9334273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 984546089F for ; Thu, 15 Sep 2016 16:46:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D46A29A79 for ; Thu, 15 Sep 2016 16:46:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81EBA29A83; Thu, 15 Sep 2016 16:46:17 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 2D98E29A79 for ; Thu, 15 Sep 2016 16:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbcIOQqP (ORCPT ); Thu, 15 Sep 2016 12:46:15 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:33822 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752938AbcIOQqO (ORCPT ); Thu, 15 Sep 2016 12:46:14 -0400 Received: by mail-it0-f68.google.com with SMTP id 186so5035159itf.1 for ; Thu, 15 Sep 2016 09:46:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=OkNrZM0/ee3TuxCMDBkZC7VJSY7lD+NJ8YR5Ppka9RA=; b=lptiPhyIfghuyaOr400iLgN+E0FvCbeHLhwvYbkgW/CbDgGWGxytYCWuPMc+c1K/55 3/heiPxfA7w+jiUIvvjy9jUVVLfoVeUr2DBhCq3eKLVugQGR/oHBcgbPundXu8PCEeb2 vQq4rEpsrM/XlBTSAt5/M2R8TnP5jpVC0Fnuu1HGdb6ohI0iyIql4vEhC9Dv5kAcqsKP UPE//jh7YoxltCjs1IPst1GHLXtksoIMNFErxiFKQ6sqmkZdu3mYs4Dl9wnHMCpcpNsU /wExIkqdCz8LBuI1fNfGUXPRNj4VfDpfO6U2Sy86ChwzFeadO5Vq/efjh8Y1MrpUGa0f +rpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=OkNrZM0/ee3TuxCMDBkZC7VJSY7lD+NJ8YR5Ppka9RA=; b=e3i/9HqWTrMdxlS4NRaEMmJZ3k6eTV22ecmSmEqZW2wESD4EnaG6hxuDi4LvpsB77D +mj5op77jFPAW7y1OUQjK/VB/39RHqO2WrR5hR8+yAZLq5S7zxNZ5rx4nRSWBdo+rPQ+ YGrGyPPsjT6eWTjR3+miA/5PIOdVRYy7tABA1acDsyEY7tvyDzMue7++56rqBlI/kGmw Gx/1Z4DqolSH95ADUC30Jil8bBvhsbWop+DlyBzfj3gpQIcHxWmOBDl8UxKTft724ryw LgFKfCMcsWafco2Kp1JKE0PpSWE88T75W4AuucPIxtSM4quOL+mGzj3/mxaMGcJi/pgF 6JRw== X-Gm-Message-State: AE9vXwMQNs6a5AyRa/ZLmKfHBEWz2er5MYkFR1PvVPIeig4lLZimfS7cXwnX2d27dKccTA== X-Received: by 10.107.176.144 with SMTP id z138mr19819161ioe.133.1473957973326; Thu, 15 Sep 2016 09:46:13 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id y132sm1248687itc.20.2016.09.15.09.46.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 09:46:12 -0700 (PDT) From: Trond Myklebust To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org, Oleg Drokin Subject: [PATCH v4 07/20] NFSv4.1: Deal with server reboots during delegation expiration recovery Date: Thu, 15 Sep 2016 12:45:47 -0400 Message-Id: <1473957960-10001-8-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473957960-10001-7-git-send-email-trond.myklebust@primarydata.com> References: <1473957960-10001-1-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-2-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-3-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-4-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-5-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-6-git-send-email-trond.myklebust@primarydata.com> <1473957960-10001-7-git-send-email-trond.myklebust@primarydata.com> 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 Ensure that if the server reboots while we're testing and recovering from revoked delegations, we exit to allow the state manager to handle matters. Signed-off-by: Trond Myklebust --- fs/nfs/delegation.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index ff0c1a0feb9d..b873271c613a 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -874,6 +874,13 @@ restart: rcu_read_unlock(); } +static inline bool nfs4_server_rebooted(const struct nfs_client *clp) +{ + return (clp->cl_state & (BIT(NFS4CLNT_CHECK_LEASE) | + BIT(NFS4CLNT_LEASE_EXPIRED) | + BIT(NFS4CLNT_SESSION_RESET))) != 0; +} + static void nfs_mark_test_expired_delegation(struct nfs_server *server, struct nfs_delegation *delegation) { @@ -882,6 +889,19 @@ static void nfs_mark_test_expired_delegation(struct nfs_server *server, set_bit(NFS4CLNT_DELEGATION_EXPIRED, &server->nfs_client->cl_state); } +static void nfs_inode_mark_test_expired_delegation(struct nfs_server *server, + struct inode *inode) +{ + struct nfs_delegation *delegation; + + rcu_read_lock(); + delegation = rcu_dereference(NFS_I(inode)->delegation); + if (delegation) + nfs_mark_test_expired_delegation(server, delegation); + rcu_read_unlock(); + +} + static void nfs_delegation_mark_test_expired_server(struct nfs_server *server) { struct nfs_delegation *delegation; @@ -954,6 +974,12 @@ restart: nfs_inode_find_state_and_recover(inode, &stateid); } put_rpccred(cred); + if (nfs4_server_rebooted(clp)) { + nfs_inode_mark_test_expired_delegation(server,inode); + iput(inode); + nfs_sb_deactive(server->super); + return; + } iput(inode); nfs_sb_deactive(server->super); goto restart;