From de1fe260d8c88112b46857d69cf5fe9e5d06cfbd Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Sat, 31 Jul 2021 15:45:56 +0800 Subject: [PATCH] LU-14907 pcc: VM_WRITE should not trigger layout write VM area marked with VM_WRITE means that pages may be written, but mmap page wirte may never happen. It should delay layout write until the actual modification on the file happen in ->page_mkwrite(). Otherwise, it will trigger panic for PCC-RO sanity-pcc test_21f(). Fixes: f2d1c4ee4 ("LU-14647 flr: mmap write/punch does not stale other mirrors") Signed-off-by: Qian Yingjin Change-Id: I1cbfef8a4ed7e2c718324fd8a21bafd6157b5f0c --- lustre/include/cl_object.h | 5 ----- lustre/llite/llite_mmap.c | 3 --- lustre/llite/vvp_io.c | 3 +-- lustre/lov/lov_io.c | 6 ++---- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index e180f68..dfd7282 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2464,11 +2464,6 @@ static inline int cl_io_is_mkwrite(const struct cl_io *io) return io->ci_type == CIT_FAULT && io->u.ci_fault.ft_mkwrite; } -static inline int cl_io_is_fault_writable(const struct cl_io *io) -{ - return io->ci_type == CIT_FAULT && io->u.ci_fault.ft_writable; -} - /** * True, iff \a io is a truncate(2). */ diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 8873f70..2ad1a59 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -111,9 +111,6 @@ restart: else if (vma->vm_flags & VM_RAND_READ) io->ci_rand_read = 1; - if (vma->vm_flags & VM_WRITE) - fio->ft_writable = 1; - rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj); if (rc == 0) { struct vvp_io *vio = vvp_env_io(env); diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index b7b953d..7530254 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -368,8 +368,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) io->ci_need_write_intent = 0; LASSERT(io->ci_type == CIT_WRITE || cl_io_is_fallocate(io) || - cl_io_is_trunc(io) || cl_io_is_mkwrite(io) || - cl_io_is_fault_writable(io)); + cl_io_is_trunc(io) || cl_io_is_mkwrite(io)); CDEBUG(D_VFSTRACE, DFID" write layout, type %u "DEXT"\n", PFID(lu_object_fid(&obj->co_lu)), io->ci_type, diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index ae0964b..f754f6a 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -227,8 +227,7 @@ static int lov_io_mirror_write_intent(struct lov_io *lio, io->ci_need_write_intent = 0; if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) || - cl_io_is_fallocate(io) || cl_io_is_trunc(io) || - cl_io_is_fault_writable(io))) + cl_io_is_fallocate(io) || cl_io_is_trunc(io))) RETURN(0); /* @@ -582,8 +581,7 @@ static int lov_io_slice_init(struct lov_io *lio, /* check if it needs to instantiate layout */ if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) || cl_io_is_fallocate(io) || - (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0)) || - cl_io_is_fault_writable(io)) + (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0))) GOTO(out, result = 0); /* -- 1.8.3.1