From patchwork Wed Aug 31 02:11:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9306251 X-Patchwork-Delegate: Trond.Myklebust@netapp.com 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 6F99160865 for ; Wed, 31 Aug 2016 02:12:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F21F28DE7 for ; Wed, 31 Aug 2016 02:12:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5437028E08; Wed, 31 Aug 2016 02:12:22 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 CBC1E28E06 for ; Wed, 31 Aug 2016 02:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757562AbcHaCMT (ORCPT ); Tue, 30 Aug 2016 22:12:19 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:33732 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758233AbcHaCMS (ORCPT ); Tue, 30 Aug 2016 22:12:18 -0400 Received: by mail-it0-f65.google.com with SMTP id n75so4101554ith.0 for ; Tue, 30 Aug 2016 19:12:17 -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=Ke5CtTJ7AGbFRcXg243PO22IiB/MP3ZoIctbu5F5kKNaKDkd454Jh8MWVIL6vn9bzC nBul2/kncx2805VdUe/XeTjqzEwo+KiZyfh5p+jvlZfK+EQwLv+8yhfSJeeIeTkcRUj2 cZ3XrwTkiCZw0R/SoIGhDbDQ03AVfb4/qx4W5Dnj8jvJWSZLpgMliJx9bOzs8Rd98anx vtYCYvnrsAx8Ntc8rSqNb+HNPiwPjh3i5DF5SlVuK7ZO6fJWnRmW43hjs/vq+RsVEykC cQYgzjWDd89monFX3VCQL8P7bwD4m7P87RJwJm1fta+yTPOLRSX6q+2YT0fXuJjDHi8g kZGA== 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=eisRpXZOunPNaSW2YLzBCPdHiGjTTspwtov7CKVvUAvuXVa3vTdnUW7A+wp4u14ukY xGaq6dW7D4OVRlZ30Ic4M+WTD4RhT4A78DQseqEMvv4RgW8K2TKmbwUpjOt9CXBM+Y7g lkPU1U+Xur2Bn+OyVqvHprLTWmkelamFwj6q4dyZMN77ELUVvipQ/eVputi5ZY72YMMf XL/jD3zYke+lRGoQracbqeQPqrGYl7qD42LYZK+eF7SZ1KH5ruqD8aKPjxJmS8QCCPvQ MQUSUJGdkQG4smdgjPCgbq93M6v0qPWVi/U8ZJBjMu97Av5PRUpKEabP3fo2J2fDXMV1 8Zpw== X-Gm-Message-State: AE9vXwM78LGheCEFUT1ICEmf5OJCQp+efm95H4vWAJ2Xw0FZAmvOzuzCm+35uxj4nIt6nA== X-Received: by 10.36.101.72 with SMTP id u69mr29371082itb.33.1472609537264; Tue, 30 Aug 2016 19:12:17 -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 x77sm895268ioi.3.2016.08.30.19.12.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2016 19:12:16 -0700 (PDT) From: Trond Myklebust To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 6/7] NFSv4.1: Deal with server reboots during delegation expiration recovery Date: Tue, 30 Aug 2016 22:11:43 -0400 Message-Id: <1472609504-69094-7-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472609504-69094-6-git-send-email-trond.myklebust@primarydata.com> References: <1472609504-69094-1-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-2-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-3-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-4-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-5-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-6-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;