From patchwork Sat May 14 14:08:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12849804 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 1DBF9C433F5 for ; Sat, 14 May 2022 14:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233003AbiENOO3 (ORCPT ); Sat, 14 May 2022 10:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232464AbiENOOY (ORCPT ); Sat, 14 May 2022 10:14:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE4215815 for ; Sat, 14 May 2022 07:14:24 -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 ams.source.kernel.org (Postfix) with ESMTPS id C5D5AB802BD for ; Sat, 14 May 2022 14:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25AB4C340EE; Sat, 14 May 2022 14:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652537661; bh=OlCPLbXrkK6bmzaCkwWaRsSFTZ0uG3nR6f6NwBQLJlQ=; h=From:To:Cc:Subject:Date:From; b=QaxVgG3XYPYw4n4M007M8QSRpdZrm/feJL2AfjvdjMZpW88zCAUsg2Qs9LzXLrsVI 4SDbZrNpH5vB/cfhpmGBZP7qQoSMuwx0aaw/Grgf9D8VZ9VqginOOjtJzFc5HQ5iHE TqestSLBdVfqVXuaeepsM3uUuyuAG6etkatVPXpnTAcn0oxDgeADbgLX2RjVT8lmro wF66DpDI0s6KMnrE8Z/7+YtrLtNg8R9Q3rTDtN8q/PnwnQewUGdhung5MvwDx9Qch7 Vk1iBBhfhFAAZV+zb+NFdb3kGZblKVDRWZHWXqiG7FaijveButbyB80PexdbBCbPz9 zFTFCBvfv6H+Q== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 1/5] NFS: Memory allocation failures are not server fatal errors Date: Sat, 14 May 2022 10:08:10 -0400 Message-Id: <20220514140814.3655-1-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust We need to filter out ENOMEM in nfs_error_is_fatal_on_server(), because running out of memory on our client is not a server error. Reported-by: Olga Kornievskaia Fixes: 2dc23afffbca ("NFS: ENOMEM should also be a fatal error.") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust --- fs/nfs/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 7eefa16ed381..8f8cd6e2d4db 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -841,6 +841,7 @@ static inline bool nfs_error_is_fatal_on_server(int err) case 0: case -ERESTARTSYS: case -EINTR: + case -ENOMEM: return false; } return nfs_error_is_fatal(err); From patchwork Sat May 14 14:08:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12849805 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 511FEC433EF for ; Sat, 14 May 2022 14:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232464AbiENOOa (ORCPT ); Sat, 14 May 2022 10:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbiENOOY (ORCPT ); Sat, 14 May 2022 10:14:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D34140F3 for ; Sat, 14 May 2022 07:14:23 -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 B16EA60F1F for ; Sat, 14 May 2022 14:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8439C34116; Sat, 14 May 2022 14:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652537662; bh=tD+jDDrzYnCZPzZUM9pTL5opqF2e8+LvWnkSz93e9k4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0Hq0m40RmBiRIdEN/TqKOZBxXOre5DsiqrKRwrj0iUJDnqFZHktvFqGszp/DF78e pkEG+f3ZSk3Qjn3hXCyXp58HxcsaWLU8qa/nKytvAYxIp7XHkS78xlkXbGdWxdDD3L XS6kkwZvOqNyenRSKfGtRcE0mjsJIUe63LFaLV/xjnQDSp6bUlw8XtCER/iyJ5laA4 +1elGfy4MM/vrPpOpqc2QBLkso9QfFe2tKyN9tiN6bEymBIz2eEI492T+jE+7+zUdZ dHcgEQLtu8HvtGM3xyxup0Fl/gq4IzTjP7Oh5uWmKyLLzie5X4MoU53F0bHliuEN55 rUYt/XuXS6YWw== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/5] NFSv4/pNFS: Do not fail I/O when we fail to allocate the pNFS layout Date: Sat, 14 May 2022 10:08:11 -0400 Message-Id: <20220514140814.3655-2-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514140814.3655-1-trondmy@kernel.org> References: <20220514140814.3655-1-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Commit 587f03deb69b caused pnfs_update_layout() to stop returning ENOMEM when the memory allocation fails, and hence causes it to fall back to trying to do I/O through the MDS. There is no guarantee that this will fare any better. If we're failing the pNFS layout allocation, then we should just redirty the page and retry later. Reported-by: Olga Kornievskaia Fixes: 587f03deb69b ("pnfs: refactor send_layoutget") Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 856c962273c7..68a87be3e6f9 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2000,6 +2000,7 @@ pnfs_update_layout(struct inode *ino, lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags); if (lo == NULL) { spin_unlock(&ino->i_lock); + lseg = ERR_PTR(-ENOMEM); trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg, PNFS_UPDATE_LAYOUT_NOMEM); goto out; @@ -2128,6 +2129,7 @@ pnfs_update_layout(struct inode *ino, lgp = pnfs_alloc_init_layoutget_args(ino, ctx, &stateid, &arg, gfp_flags); if (!lgp) { + lseg = ERR_PTR(-ENOMEM); trace_pnfs_update_layout(ino, pos, count, iomode, lo, NULL, PNFS_UPDATE_LAYOUT_NOMEM); nfs_layoutget_end(lo); From patchwork Sat May 14 14:08:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12849806 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 93CD2C433FE for ; Sat, 14 May 2022 14:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbiENOOa (ORCPT ); Sat, 14 May 2022 10:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232997AbiENOOY (ORCPT ); Sat, 14 May 2022 10:14:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54301580E for ; Sat, 14 May 2022 07:14:23 -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 4E78160F1A for ; Sat, 14 May 2022 14:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55DDAC34117; Sat, 14 May 2022 14:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652537662; bh=3/4qHphF9RAyki3MqwJ+YC7f2Va4FCTc7dWLqokT5II=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S1+wlxFS5xATwYOZ/vJTlHoydSSA9AFzrw8G3m6RZH7CTI4O+StKFa4abmH7L+skA 8geOytbufXhdBYFplJ1jv0qVz2/7hzHolvTcuUvStpj9GBzJ6wo7CzfFmoDlQgMxTS z+y+JhM3mywhVR3aMjk4bU0MCCTsH2SAH5SaouqaigK5qCKaicmA0+alnxYmkYgKHR NhfFKbzxFmiwIpjFBcCGePvR7kWUMhcqiNbD4a7/hCyGtBjsYyP4LuXQzkZqWSqnSQ eBId7o1o+PF2xrL2bCts5i9962F2DIPf/AQ3JDhmSYsuUL0BxKHOCYeoh6LGPW8l2/ TxIgKaeG3VwYA== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 3/5] NFS: Further fixes to the writeback error handling Date: Sat, 14 May 2022 10:08:12 -0400 Message-Id: <20220514140814.3655-3-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514140814.3655-2-trondmy@kernel.org> References: <20220514140814.3655-1-trondmy@kernel.org> <20220514140814.3655-2-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust When we handle an error by redirtying the page, we're not corrupting the mapping, so we don't want the error to be recorded in the mapping. If the caller has specified a sync_mode of WB_SYNC_NONE, we can just return AOP_WRITEPAGE_ACTIVATE. However if we're dealing with WB_SYNC_ALL, we need to ensure that retries happen when the errors are non-fatal. Reported-by: Olga Kornievskaia Fixes: 8fc75bed96bb ("NFS: Fix up return value on fatal errors in nfs_page_async_flush()") Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f00d45cf80ef..a8eb348947a6 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -603,8 +603,9 @@ static void nfs_write_error(struct nfs_page *req, int error) * Find an associated nfs write request, and prepare to flush it out * May return an error if the user signalled nfs_wait_on_request(). */ -static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, - struct page *page) +static int nfs_page_async_flush(struct page *page, + struct writeback_control *wbc, + struct nfs_pageio_descriptor *pgio) { struct nfs_page *req; int ret = 0; @@ -630,11 +631,11 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, /* * Remove the problematic req upon fatal errors on the server */ - if (nfs_error_is_fatal(ret)) { - if (nfs_error_is_fatal_on_server(ret)) - goto out_launder; - } else - ret = -EAGAIN; + if (nfs_error_is_fatal_on_server(ret)) + goto out_launder; + if (wbc->sync_mode == WB_SYNC_NONE) + ret = AOP_WRITEPAGE_ACTIVATE; + redirty_page_for_writepage(wbc, page); nfs_redirty_request(req); pgio->pg_error = 0; } else @@ -650,15 +651,8 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio) { - int ret; - nfs_pageio_cond_complete(pgio, page_index(page)); - ret = nfs_page_async_flush(pgio, page); - if (ret == -EAGAIN) { - redirty_page_for_writepage(wbc, page); - ret = AOP_WRITEPAGE_ACTIVATE; - } - return ret; + return nfs_page_async_flush(page, wbc, pgio); } /* @@ -737,12 +731,15 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) priority = wb_priority(wbc); } - nfs_pageio_init_write(&pgio, inode, priority, false, - &nfs_async_write_completion_ops); - pgio.pg_io_completion = ioc; - err = write_cache_pages(mapping, wbc, nfs_writepages_callback, &pgio); - pgio.pg_error = 0; - nfs_pageio_complete(&pgio); + do { + nfs_pageio_init_write(&pgio, inode, priority, false, + &nfs_async_write_completion_ops); + pgio.pg_io_completion = ioc; + err = write_cache_pages(mapping, wbc, nfs_writepages_callback, + &pgio); + pgio.pg_error = 0; + nfs_pageio_complete(&pgio); + } while (err < 0 && !nfs_error_is_fatal(err)); nfs_io_completion_put(ioc); if (err < 0) From patchwork Sat May 14 14:08:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12849808 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 E1D8FC4332F for ; Sat, 14 May 2022 14:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233002AbiENOOc (ORCPT ); Sat, 14 May 2022 10:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233001AbiENOOY (ORCPT ); Sat, 14 May 2022 10:14:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5581581B for ; Sat, 14 May 2022 07:14:24 -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 D444F60EDA for ; Sat, 14 May 2022 14:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED6E4C34116; Sat, 14 May 2022 14:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652537663; bh=ReQRCdjwjHc9eKaBs4b8uOavUQqFl0e0QuDHT3nVK7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6dR8RDjhjBlhWXwjzqwPA4oQ5w6jH+lDorphTejbriPYKlJCn1JPqK+yBbhK8TI1 MZk08MV3v6RklYN0Yu0f5VAbZKptwYtkKJMIUrQsnRYt5VjhRmcGZIOP+jIpLH7mwE zFF9x/aGD73yoglVsi3vlnQ3EEibsJafOBLW0csMfm2ai5uLMpvkCm4ERl9ytWAOhv DC4Nbo3vi41PoJy2w02ElYs1rezjby0rsrHIV6k36vJHrK9ghtsrRXPPxzCVKFIukl bu2qXebqXQVQ5am26SdLv6j/zmoEYpB/8ruYMony1oc1a7wmFhB+5hhHC0AZeEeiQ3 0oFe3o+FnNFSw== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 4/5] pNFS/files: Fall back to I/O through the MDS on non-fatal layout errors Date: Sat, 14 May 2022 10:08:13 -0400 Message-Id: <20220514140814.3655-4-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514140814.3655-3-trondmy@kernel.org> References: <20220514140814.3655-1-trondmy@kernel.org> <20220514140814.3655-2-trondmy@kernel.org> <20220514140814.3655-3-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Only report the error when the server is returning a fatal error, such as ESTALE, EIO, etc... Signed-off-by: Trond Myklebust --- fs/nfs/filelayout/filelayout.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 76deddab0a8f..2b2661582bbe 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c @@ -839,7 +839,12 @@ fl_pnfs_update_layout(struct inode *ino, lseg = pnfs_update_layout(ino, ctx, pos, count, iomode, strict_iomode, gfp_flags); - if (IS_ERR_OR_NULL(lseg)) + if (IS_ERR(lseg)) { + /* Fall back to MDS on recoverable errors */ + if (!nfs_error_is_fatal_on_server(PTR_ERR(lseg))) + lseg = NULL; + goto out; + } else if (!lseg) goto out; lo = NFS_I(ino)->layout; From patchwork Sat May 14 14:08:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12849807 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 1B616C433F5 for ; Sat, 14 May 2022 14:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232997AbiENOOb (ORCPT ); Sat, 14 May 2022 10:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233002AbiENOOZ (ORCPT ); Sat, 14 May 2022 10:14:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1CC61581D for ; Sat, 14 May 2022 07:14:24 -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 6E24760F16 for ; Sat, 14 May 2022 14:14:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89371C340EE; Sat, 14 May 2022 14:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652537663; bh=vYfJPBYCAjqilbHHrueSFEhX47JBAgIfuXTUg7hMCmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ky0A1cbsxwvCgAWVa4AHUFz2iJY1s64HwzB3EMuGQr5zpFXZ4MbAdcCwcv1Emlce9 ZE5SH7Q93qHE5xo1mcpp4dqXxO2rfo9Sl/FSo7/RWcZc0h7DINJyj0gkFx1MfjuJHZ Fzb05TyTyt0AUzrcEPElJK2DCxj28EhzxpA+c8KiaM00uEF5cxO0oqrOzUKMjG/oPx Lj8PIzKh22Pku2TT161W/x2s4rkgF8SKl7T4+BQH3uy8qL9VGgx4OapRILVWyJqaXB 3JtZCQd/P+M2ZHm7/fAUHlkknP9vbL1xKAcXO47vvYoalD+4V/7yIdgBz0u733IUJD yaP2SgHqkKp1Q== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 5/5] NFSv4: Don't hold the layoutget locks across multiple RPC calls Date: Sat, 14 May 2022 10:08:14 -0400 Message-Id: <20220514140814.3655-5-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514140814.3655-4-trondmy@kernel.org> References: <20220514140814.3655-1-trondmy@kernel.org> <20220514140814.3655-2-trondmy@kernel.org> <20220514140814.3655-3-trondmy@kernel.org> <20220514140814.3655-4-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust When doing layoutget as part of the open() compound, we have to be careful to release the layout locks before we can call any further RPC calls, such as setattr(). The reason is that those calls could trigger a recall, which could deadlock. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a79f66432bd3..bf3ba541b9fb 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3098,6 +3098,10 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, } out: + if (opendata->lgp) { + nfs4_lgopen_release(opendata->lgp); + opendata->lgp = NULL; + } if (!opendata->cancelled) nfs4_sequence_free_slot(&opendata->o_res.seq_res); return ret;