diff mbox series

[10/25] lustre: lov: refresh LOVEA with LL granted

Message ID 20250130141115.950749-11-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS branch April 30, 2023 | expand

Commit Message

James Simmons Jan. 30, 2025, 2:11 p.m. UTC
From: Alex Zhuravlev <bzzz@whamcloud.com>

This change tries to fix:

lov_layout_change() should not apply old layouts which
can get through when MDS doesn't take layout lock

This patch misses an optimization and can result in a number of
useless calls to OSD to fetch LOVEA. To be fixed in a followup
patch.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15300
Lustre-commit: 13557aa86904376e4 ("LU-15300 mdt: refresh LOVEA with LL granted")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46413
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd_support.h |  1 +
 fs/lustre/llite/vvp_page.c      |  4 ++++
 fs/lustre/lov/lov_object.c      | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/fs/lustre/include/obd_support.h b/fs/lustre/include/obd_support.h
index ab7899cd1384..43b4684f418a 100644
--- a/fs/lustre/include/obd_support.h
+++ b/fs/lustre/include/obd_support.h
@@ -492,6 +492,7 @@  extern char obd_jobid_var[];
 #define OBD_FAIL_LLITE_XATTR_PAUSE			0x1420
 #define OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE		0x1421
 #define OBD_FAIL_LLITE_READPAGE_PAUSE			0x1422
+#define OBD_FAIL_LLITE_PANIC_ON_ESTALE			0x1423
 
 #define OBD_FAIL_FID_INDIR				0x1501
 #define OBD_FAIL_FID_INLMA				0x1502
diff --git a/fs/lustre/llite/vvp_page.c b/fs/lustre/llite/vvp_page.c
index 30524fda692e..9994c3d292a9 100644
--- a/fs/lustre/llite/vvp_page.c
+++ b/fs/lustre/llite/vvp_page.c
@@ -115,6 +115,10 @@  static void vvp_vmpage_error(struct inode *inode, struct page *vmpage,
 		obj->vob_discard_page_warned = 0;
 	} else {
 		SetPageError(vmpage);
+		if (ioret != -ENOSPC &&
+		    OBD_FAIL_CHECK(OBD_FAIL_LLITE_PANIC_ON_ESTALE))
+			LBUG();
+
 		mapping_set_error(inode->i_mapping, ioret);
 
 		if ((ioret == -ESHUTDOWN || ioret == -EINTR ||
diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c
index 5d65aabe7645..7c20f6eae03b 100644
--- a/fs/lustre/lov/lov_object.c
+++ b/fs/lustre/lov/lov_object.c
@@ -1370,6 +1370,24 @@  static int lov_conf_set(const struct lu_env *env, struct cl_object *obj,
 
 	LASSERT(conf->coc_opc == OBJECT_CONF_SET);
 
+	/*
+	 * don't apply old layouts which can be brought
+	 * if returned w/o ldlm lock.
+	 * XXX: can we rollback in case of recovery?
+	 */
+	if (lsm && lov->lo_lsm) {
+		u32 oldgen = lov->lo_lsm->lsm_layout_gen &= ~LU_LAYOUT_RESYNC;
+		u32 newgen = lsm->lsm_layout_gen & ~LU_LAYOUT_RESYNC;
+
+		if (newgen < oldgen) {
+			CDEBUG(D_HA, "skip old for "DFID": %d < %d\n",
+			       PFID(lu_object_fid(lov2lu(lov))),
+			       (int)newgen, (int)oldgen);
+			result = 0;
+			goto out;
+		}
+	}
+
 	if ((!lsm && !lov->lo_lsm) ||
 	    ((lsm && lov->lo_lsm) &&
 	     (lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) &&