From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 06/19] lustre: llite: tighten condition for fault not drop mmap_sem
Date: Sun, 28 Nov 2021 18:27:41 -0500 [thread overview]
Message-ID: <1638142074-5945-7-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1638142074-5945-1-git-send-email-jsimmons@infradead.org>
From: Bobi Jam <bobijam@whamcloud.com>
As __lock_page_or_retry() indicates, filemap_fault() will return
VM_FAULT_RETRY without releasing mmap_sem iff flags contains
FAULT_FLAG_ALLOW_RETRY and FAULT_FLAG_RETRY_NOWAIT.
So ll_fault0() should pass in FAULT_FLAG_ALLOW_RETRY |
FAULT_FLAG_RETRY_NOWAIT in ll_filemap_fault() so that when it
returns VM_FAULT_RETRY, we can pass on trying normal fault
under DLM lock as mmap_sem is still being held.
While in Linux 5.1 (6b4c9f4469819) FAULT_FLAG_RETRY_NOWAIT is enough
to not drop mmap_sem when failed to lock the page.
Fixes: 22cceab961 ("lustre: llite: Avoid eternel retry loops with MAP_POPULATE")
WC-bug-id: https://jira.whamcloud.com/browse/LU-14713
Lustre-commit: 81aec05103558f57a ("LU-14713 llite: tighten condition for fault not drop mmap_sem")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44715
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/llite/llite_mmap.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/lustre/llite/llite_mmap.c b/fs/lustre/llite/llite_mmap.c
index 8047786..0009c5f 100644
--- a/fs/lustre/llite/llite_mmap.c
+++ b/fs/lustre/llite/llite_mmap.c
@@ -285,18 +285,25 @@ static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
if (ll_sbi_has_fast_read(ll_i2sbi(inode))) {
/* do fast fault */
+ bool allow_retry = vmf->flags & FAULT_FLAG_ALLOW_RETRY;
bool has_retry = vmf->flags & FAULT_FLAG_RETRY_NOWAIT;
/* To avoid loops, instruct downstream to not drop mmap_sem */
- vmf->flags |= FAULT_FLAG_RETRY_NOWAIT;
+ /**
+ * only need FAULT_FLAG_ALLOW_RETRY prior to Linux 5.1
+ * (6b4c9f4469819), where FAULT_FLAG_RETRY_NOWAIT is enough
+ * to not drop mmap_sem when failed to lock the page.
+ */
+ vmf->flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT;
ll_cl_add(inode, env, NULL, LCC_MMAP);
fault_ret = filemap_fault(vmf);
ll_cl_remove(inode, env);
if (has_retry)
vmf->flags &= ~FAULT_FLAG_RETRY_NOWAIT;
+ if (!allow_retry)
+ vmf->flags &= ~FAULT_FLAG_ALLOW_RETRY;
- /*
- * - If there is no error, then the page was found in cache and
+ /* - If there is no error, then the page was found in cache and
* uptodate;
* - If VM_FAULT_RETRY is set, the page existed but failed to
* lock. We will try slow path to avoid loops.
--
1.8.3.1
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev parent reply other threads:[~2021-11-28 23:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-28 23:27 [lustre-devel] [PATCH 00/19] lustre: update to OpenSFS tree Nov 28, 2021 James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 01/19] lnet: fix delay rule crash James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 02/19] lnet: change tp_nid to 16byte in lnet_test_peer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 03/19] lnet: extend preferred nids in struct lnet_peer_ni James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 04/19] lnet: switch to large lnet_processid for matching James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 05/19] lnet: libcfs: add timeout to cfs_race() to fix race James Simmons
2021-11-28 23:27 ` James Simmons [this message]
2021-11-28 23:27 ` [lustre-devel] [PATCH 07/19] lnet: o2iblnd: map_on_demand not needed for frag interop James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 08/19] lnet: o2iblnd: Fix logic for unaligned transfer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 09/19] lnet: Reset ni_ping_count only on receive James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 10/19] lustre: ptlrpc: fix timeout after spurious wakeup James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 11/19] lnet: Fail peer add for existing gw peer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 12/19] lustre: ptlrpc: remove bogus LASSERT James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 13/19] lustre: quota: optimize capability check for root squash James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 14/19] lustre: llite: skip request slot for lmv_revalidate_slaves() James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 15/19] lnet: set eth routes needed for multi rail James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 16/19] lustre: llite: Do not count tiny write twice James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 17/19] lustre: llite: mend the trunc_sem_up_write() James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 18/19] lnet: Netlink improvements James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 19/19] lnet: libcfs: separate daemon_list from cfs_trace_data James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1638142074-5945-7-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=adilger@whamcloud.com \
--cc=green@whamcloud.com \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).