[lustre-devel] [PATCH 03/27] lustre: llite: protect cp_state with vmpage lock
James Simmons <[email protected]> Mon, 17 Apr 2023 09:46:59 -0400
| Newsgroups | org.lustre.lists.lustre-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Bobi Jam <[email protected]> cl_page_make_ready() calls cl_page_io_start() without vmpage lock protection, and that could mess up cl_page's cp_state/cp_owner. WC-bug-id: https://jira.whamcloud.com/browse/LU-16612 Lustre-commit: d03b038d0dd8360dc ("LU-16612 llite: protect cp_state with vmpage lock") Signed-off-by: Bobi Jam <[email protected]> Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50180 Reviewed-by: Patrick Farrell <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: James Simmons <[email protected]> --- fs/lustre/obdclass/cl_page.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/lustre/obdclass/cl_page.c b/fs/lustre/obdclass/cl_page.c index 8320293..80423b7 100644 --- a/fs/lustre/obdclass/cl_page.c +++ b/fs/lustre/obdclass/cl_page.c @@ -871,6 +871,7 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp, enum cl_req_type crt) { struct page *vmpage = cp->cp_vmpage; + bool unlock = false; int rc = 0; PASSERT(env, cp, crt == CRT_WRITE); @@ -879,6 +880,7 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp, goto out; lock_page(vmpage); + unlock = true; if (clear_page_dirty_for_io(vmpage)) { LASSERT(cp->cp_state == CPS_CACHED); @@ -899,13 +901,15 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp, LBUG(); } - unlock_page(vmpage); out: if (rc == 0) { PASSERT(env, cp, cp->cp_state == CPS_CACHED); cl_page_io_start(env, cp, crt); } + if (unlock) + unlock_page(vmpage); + CL_PAGE_HEADER(D_TRACE, env, cp, "%d %d\n", crt, rc); return rc; -- 1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org