From patchwork Tue Mar 21 04:17:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 13182222 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA8FC6FD1D for ; Tue, 21 Mar 2023 04:24:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbjCUEYJ (ORCPT ); Tue, 21 Mar 2023 00:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbjCUEYH (ORCPT ); Tue, 21 Mar 2023 00:24:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DD41E1DB for ; Mon, 20 Mar 2023 21:24:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69D096195C for ; Tue, 21 Mar 2023 04:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95DA4C433EF for ; Tue, 21 Mar 2023 04:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679372642; bh=RZHxzMFk3EtMnXpRGT1NVWDjq3WF3r290yTVx5kX+Ck=; h=From:To:Subject:Date:From; b=EHPliABQexT+EyoA4Ui1tU+EmYYj2c7lLxNndPASx0J0eBlZqa3Duonb8lZJwfkiM wxV57FndQTkBumSoE63H3VoffpV9hu96sVndhvfxywfxW5Yp06KCx10n4BF5+CpiyL tPJhwZjq3rrMZoIhUSTzmviVz1KL8f0qA5aQmxnIN3c8E2S0TW6LXz33eL1kEZn9JR ht0gySUhRKz2wZLWRigpciN1ECI4PRxUwKlk+wwgREXzUpTBhTLgv01GgwnNwPXGwR +0k1xPDh91R0L0oiE2XSE1wlRSdDxVQg0qo+xZkmMflkFhydNqQOM2cyBxS6fTTjUT QgXphf74RmLHQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 1/2] NFSv4.1: Always send a RECLAIM_COMPLETE after establishing lease Date: Tue, 21 Mar 2023 00:17:35 -0400 Message-Id: <20230321041736.664907-1-trondmy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust The spec requires that we always at least send a RECLAIM_COMPLETE when we're done establishing the lease and recovering any state. Fixes: fce5c838e133 ("nfs41: RECLAIM_COMPLETE functionality") Signed-off-by: Trond Myklebust --- fs/nfs/nfs4state.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 2a0ca5c7f082..660ccfaf463e 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -67,6 +67,8 @@ #define OPENOWNER_POOL_SIZE 8 +static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp); + const nfs4_stateid zero_stateid = { { .data = { 0 } }, .type = NFS4_SPECIAL_STATEID_TYPE, @@ -330,6 +332,8 @@ int nfs41_init_clientid(struct nfs_client *clp, const struct cred *cred) status = nfs4_proc_create_session(clp, cred); if (status != 0) goto out; + if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R)) + nfs4_state_start_reclaim_reboot(clp); nfs41_finish_session_reset(clp); nfs_mark_client_ready(clp, NFS_CS_READY); out: From patchwork Tue Mar 21 04:17:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 13182223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1845C74A5B for ; Tue, 21 Mar 2023 04:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbjCUEYM (ORCPT ); Tue, 21 Mar 2023 00:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjCUEYH (ORCPT ); Tue, 21 Mar 2023 00:24:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A83422DC4 for ; Mon, 20 Mar 2023 21:24:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CB5F261950 for ; Tue, 21 Mar 2023 04:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07874C433D2 for ; Tue, 21 Mar 2023 04:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679372643; bh=pRV7AebUAEwZbkAWCqwVb+hw31Gu0Dyj/Y4KWr1GG48=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r6Q3vCX1n3Hfvol2ag7crdHpOKiLmk1lzTF4E4vIBXK+vNtIMrxIrQUfEVz3qPRCg OkOTsC8Of2KuhSQSqCHF4QQR8Pvki2dqU957Q0ZPCUSCbfd12YVqIejcnWtMQwT1Dp 6SVccn++Ed1JlYHLgcHcJAioU/NqPXkxAVFg8GaQagGx5CroIN/lehfEul7HvsoRMy K3/21TtWGqyWGpAk+DdfNRifyKThWX2XEqCDlOe+fiLbchHy1MSRskxcx8XZ9hyn8R 0yUQrIYgTesxZmftVIE5fqkmTsVvUQuA01xlcuudHoYBXCP/tXR+Ru24zEKwerhMgW cO6sFRhckJi3Q== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] NFSv4: Fix hangs when recovering open state after a server reboot Date: Tue, 21 Mar 2023 00:17:36 -0400 Message-Id: <20230321041736.664907-2-trondmy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321041736.664907-1-trondmy@kernel.org> References: <20230321041736.664907-1-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust When we're using a cached open stateid or a delegation in order to avoid sending a CLAIM_PREVIOUS open RPC call to the server, we don't have a new open stateid to present to update_open_stateid(). Instead rely on nfs4_try_open_cached(), just as if we were doing a normal open. Fixes: d2bfda2e7aa0 ("NFSv4: don't reprocess cached open CLAIM_PREVIOUS") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 22a93ae46cd7..5607b1e2b821 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1980,8 +1980,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) if (!data->rpc_done) { if (data->rpc_status) return ERR_PTR(data->rpc_status); - /* cached opens have already been processed */ - goto update; + return nfs4_try_open_cached(data); } ret = nfs_refresh_inode(inode, &data->f_attr); @@ -1990,7 +1989,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) if (data->o_res.delegation_type != 0) nfs4_opendata_check_deleg(data, state); -update: + if (!update_open_stateid(state, &data->o_res.stateid, NULL, data->o_arg.fmode)) return ERR_PTR(-EAGAIN);