From mboxrd@z Thu Jan 1 00:00:00 1970 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 9FC8AC35295 for ; Thu, 7 Apr 2022 01:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242206AbiDGBcQ (ORCPT ); Wed, 6 Apr 2022 21:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239511AbiDGBTT (ORCPT ); Wed, 6 Apr 2022 21:19:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3271A8FCD; Wed, 6 Apr 2022 18:14:37 -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 DA8E4B8268C; Thu, 7 Apr 2022 01:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2618C385A8; Thu, 7 Apr 2022 01:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294074; bh=i1rmuZh5hZEvDCOlszuy6i5fQ1cllSFKwzYfLfTBv0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJdQuA8g0wmvWTESIsTE3rDuA8uN3dc1xZMZwVQJqFoSMEzUZzJSa0z08f9TGojSc 2fAxUHroSwCpzbvEhzNp7S7gnKJ7Prx6JvVHncaOEzKqW3mvNbfhgpb3AFAFT1E7bK 1eHEArkLpa1X4cVdVOkHb7G+rhdnH1X1+N8dm9OOluvL7wyrcVQVuZCRAqoKC0IkFu +xxjvpZjJuVndh02OkwU3hsrpX0S3mjgdipLmsZKyAelggsplK43Zqarv4iv7EniN7 VxKk9o6MZoOI93M9anTkmatlian/bp2dN5giKNhEVpgu68/qiJK1me2M1yDU2pHaMN YZh+khQelGxuw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andreas Gruenbacher , Sasha Levin , rpeterso@redhat.com, cluster-devel@redhat.com Subject: [PATCH AUTOSEL 5.10 09/25] gfs2: Disable page faults during lockless buffered reads Date: Wed, 6 Apr 2022 21:13:57 -0400 Message-Id: <20220407011413.114662-9-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011413.114662-1-sashal@kernel.org> References: <20220407011413.114662-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Gruenbacher [ Upstream commit 52f3f033a5dbd023307520af1ff551cadfd7f037 ] During lockless buffered reads, filemap_read() holds page cache page references while trying to copy data to the user-space buffer. The calling process isn't holding the inode glock, but the page references it holds prevent those pages from being removed from the page cache, and that prevents the underlying inode glock from being moved to another node. Thus, we can end up in the same kinds of distributed deadlock situations as with normal (non-lockless) buffered reads. Fix that by disabling page faults during lockless reads as well. Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin --- fs/gfs2/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index cfd9d03f604f..d56a1ab4a186 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -857,14 +857,16 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to) return ret; iocb->ki_flags &= ~IOCB_DIRECT; } + pagefault_disable(); iocb->ki_flags |= IOCB_NOIO; ret = generic_file_read_iter(iocb, to); iocb->ki_flags &= ~IOCB_NOIO; + pagefault_enable(); if (ret >= 0) { if (!iov_iter_count(to)) return ret; written = ret; - } else { + } else if (ret != -EFAULT) { if (ret != -EAGAIN) return ret; if (iocb->ki_flags & IOCB_NOWAIT) -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Date: Wed, 6 Apr 2022 21:13:57 -0400 Subject: [Cluster-devel] [PATCH AUTOSEL 5.10 09/25] gfs2: Disable page faults during lockless buffered reads In-Reply-To: <20220407011413.114662-1-sashal@kernel.org> References: <20220407011413.114662-1-sashal@kernel.org> Message-ID: <20220407011413.114662-9-sashal@kernel.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit A non-text attachment was scrubbed... Name: not available Type: application/octet-stream Size: 1476 bytes Desc: not available URL: