public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6] backport: fix 6.6 backport of changes to fork
@ 2024-06-03 23:25 Leah Rumancik
  2024-06-12  0:31 ` Leah Rumancik
  0 siblings, 1 reply; 7+ messages in thread
From: Leah Rumancik @ 2024-06-03 23:25 UTC (permalink / raw)
  To: stable; +Cc: Leah Rumancik

The original backport didn't move the code to link the vma into the MT
and also the code to increment the map_count causing ~15 xfstests
(including ext4/303 generic/051 generic/054 generic/069) to hard fail
on some platforms. This patch resolves test failures.

Fixes: cec11fa2eb51 ("fork: defer linking file vma until vma is fully initialized")
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
---
 kernel/fork.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 2eab916b504b..3bf0203c2195 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -733,6 +733,12 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 		if (is_vm_hugetlb_page(tmp))
 			hugetlb_dup_vma_private(tmp);
 
+		/* Link the vma into the MT */
+		if (vma_iter_bulk_store(&vmi, tmp))
+			goto fail_nomem_vmi_store;
+
+		mm->map_count++;
+
 		if (tmp->vm_ops && tmp->vm_ops->open)
 			tmp->vm_ops->open(tmp);
 
@@ -752,11 +758,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 			i_mmap_unlock_write(mapping);
 		}
 
-		/* Link the vma into the MT */
-		if (vma_iter_bulk_store(&vmi, tmp))
-			goto fail_nomem_vmi_store;
-
-		mm->map_count++;
 		if (!(tmp->vm_flags & VM_WIPEONFORK))
 			retval = copy_page_range(tmp, mpnt);
 
-- 
2.45.1.288.g0e0cd299f1-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-14 17:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-03 23:25 [PATCH 6.6] backport: fix 6.6 backport of changes to fork Leah Rumancik
2024-06-12  0:31 ` Leah Rumancik
2024-06-14  4:55   ` Sam James
2024-06-14  6:41     ` Greg KH
2024-06-14  8:52       ` Sam James
2024-06-14  9:08         ` Greg KH
2024-06-14 17:45           ` Leah Rumancik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox