lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Andrew Perepechko <andrew.perepechko@hpe.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage"
Date: Sun,  2 Feb 2025 15:46:02 -0500	[thread overview]
Message-ID: <20250202204633.1148872-3-jsimmons@infradead.org> (raw)
In-Reply-To: <20250202204633.1148872-1-jsimmons@infradead.org>

From: Patrick Farrell <pfarrell@whamcloud.com>

This reverts commit 9c78efe1a483968c6f84092cb6e59a3f64bc13d6,
because it breaks releasepage for Lustre and does not
completely fix the data consistency issue in LU-14541.

Breaking releasepage matters because it prevents direct I/O
from working if there is page cache data present, and
because it causes similar issues with GDS, which must be
able to flush page cache pages before doing I/O.

With patches:
commit e02cfe39f908 ("lustre: llite: SIGBUS is possible on a race with page reclaim")
and
commit 6af2199c4868 ("lustre: llite: Check for page deletion after fault")
LU-14541 is fully resolved, so we can revert this patch.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14541
Lustre-commit: e3cfb688ed7116a57 ("Revert "lustre: llite: Check vmpage in releasepage")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49654
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/cl_object.h |  9 ---------
 fs/lustre/llite/rw26.c        | 19 ++++++-------------
 fs/lustre/osc/osc_page.c      |  9 ++-------
 3 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index 77f00d7fc220..94e7f8060d4a 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -91,7 +91,6 @@
 #include <linux/uio.h>
 #include <lu_object.h>
 #include <linux/atomic.h>
-#include <linux/mm.h>
 #include <linux/mutex.h>
 #include <linux/radix-tree.h>
 #include <linux/spinlock.h>
@@ -989,14 +988,6 @@ static inline bool __page_in_use(const struct cl_page *page, int refc)
  */
 #define cl_page_in_use_noref(pg) __page_in_use(pg, 0)
 
-/* references: cl_page, page cache, optional + refcount for caller reference
- * (always 0 or 1 currently)
- */
-static inline int vmpage_in_use(struct page *vmpage, int refcount)
-{
-	return (page_count(vmpage) - page_mapcount(vmpage) > 2 + refcount);
-}
-
 /** @} cl_page */
 
 /** \addtogroup cl_lock cl_lock
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index 6b338b20e7d5..2065e14e8469 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -109,7 +109,7 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 {
 	struct lu_env *env;
 	struct cl_object *obj;
-	struct cl_page *clpage;
+	struct cl_page *page;
 	struct address_space *mapping;
 	int result = 0;
 
@@ -125,23 +125,16 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 	if (!obj)
 		return 1;
 
-	clpage = cl_vmpage_page(vmpage, obj);
-	if (!clpage)
+	page = cl_vmpage_page(vmpage, obj);
+	if (!page)
 		return 1;
 
 	env = cl_env_percpu_get();
 	LASSERT(!IS_ERR(env));
 
-	/* we must not delete the cl_page if the vmpage is in use, otherwise we
-	 * disconnect the vmpage from Lustre while it's still alive(!), which
-	 * means we won't find it to discard on lock cancellation.
-	 *
-	 * References here are: caller + cl_page + page cache.
-	 * Any other references are potentially transient and must be ignored.
-	 */
-	if (!cl_page_in_use(clpage) && !vmpage_in_use(vmpage, 1)) {
+	if (!cl_page_in_use(page)) {
 		result = 1;
-		cl_page_delete(env, clpage);
+		cl_page_delete(env, page);
 	}
 
 	/* To use percpu env array, the call path can not be rescheduled;
@@ -158,7 +151,7 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 	 * that we won't get into object delete path.
 	 */
 	LASSERT(cl_object_refc(obj) > 1);
-	cl_page_put(env, clpage);
+	cl_page_put(env, page);
 
 	cl_env_percpu_put(env);
 	return result;
diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c
index feec99fe0ca2..f700b5af7de0 100644
--- a/fs/lustre/osc/osc_page.c
+++ b/fs/lustre/osc/osc_page.c
@@ -520,13 +520,8 @@ static inline bool lru_page_busy(struct client_obd *cli, struct cl_page *page)
 	if (cli->cl_cache->ccc_unstable_check) {
 		struct page *vmpage = cl_page_vmpage(page);
 
-		/* this check is racy because the vmpage is not locked, but
-		 * that's OK - the code which does the actual page release
-		 * checks this again before releasing
-		 *
-		 * vmpage have two known users: cl_page and VM page cache
-		 */
-		if (vmpage_in_use(vmpage, 0))
+		/* vmpage have two known users: cl_page and VM page cache */
+		if (page_count(vmpage) - page_mapcount(vmpage) > 2)
 			return true;
 	}
 	return false;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2025-02-02 20:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
2025-02-02 20:46 ` James Simmons [this message]
2025-02-02 20:46 ` [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul() James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 15/33] lustre: obd: " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 29/33] lustre: mdc: remove " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree 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=20250202204633.1148872-3-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=andrew.perepechko@hpe.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).