The patch titled Sibject: xarray-add-xas_split-fix-2 has been added to the -mm tree. Its filename is xarray-add-xas_split-fix-2.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/xarray-add-xas_split-fix-2.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/xarray-add-xas_split-fix-2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Sibject: xarray-add-xas_split-fix-2 fix xarray split Link: https://lkml.kernel.org/r/20200910175450.GV6583@xxxxxxxxxxxxxxxxxxxx Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/test_xarray.c | 3 +++ lib/xarray.c | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) --- a/lib/test_xarray.c~xarray-add-xas_split-fix-2 +++ a/lib/test_xarray.c @@ -1524,6 +1524,9 @@ static void check_split_1(struct xarray } XA_BUG_ON(xa, i != 1 << order); + xa_set_mark(xa, index, XA_MARK_0); + XA_BUG_ON(xa, !xa_get_mark(xa, index, XA_MARK_0)); + xa_destroy(xa); } --- a/lib/xarray.c~xarray-add-xas_split-fix-2 +++ a/lib/xarray.c @@ -973,10 +973,11 @@ static void node_set_marks(struct xa_nod xa_mark_t mark = XA_MARK_0; for (;;) { - if (marks & (1 << (__force unsigned int)mark)) + if (marks & (1 << (__force unsigned int)mark)) { node_set_mark(node, offset, mark); - if (child) - node_mark_all(child, mark); + if (child) + node_mark_all(child, mark); + } if (mark == XA_MARK_MAX) break; mark_inc(mark); @@ -984,8 +985,18 @@ static void node_set_marks(struct xa_nod } /** - * Allocate memory for splitting an entry of @order size into the order - * stored in the @xas. + * xas_split_alloc() - Allocate memory for splitting an entry. + * @xas: XArray operation state. + * @entry: New entry which will be stored in the array. + * @order: New entry order. + * @gfp: Memory allocation flags. + * + * This function should be called before calling xas_split(). + * If necessary, it will allocate new nodes (and fill them with @entry) + * to prepare for the upcoming split of an entry of @order size into + * entries of the order stored in the @xas. + * + * Context: May sleep if @gfp flags permit. */ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order, gfp_t gfp) _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are mm-debug-do-not-dereference-i_ino-blindly.patch mm-account-pmd-tables-like-pte-tables.patch mm-move-pagedoublemap-bit.patch mm-simplify-pagedoublemap-with-pf_second-policy.patch xarray-add-xa_get_order.patch xarray-add-xas_split.patch xarray-add-xas_split-fix-2.patch mm-filemap-fix-storing-to-a-thp-shadow-entry.patch mm-filemap-fix-page-cache-removal-for-arbitrary-sized-thps.patch mm-memory-remove-page-fault-assumption-of-compound-page-size.patch mm-page_owner-change-split_page_owner-to-take-a-count.patch mm-huge_memory-fix-page_trans_huge_mapcount-assumption-of-thp-size.patch mm-huge_memory-fix-can_split_huge_page-assumption-of-thp-size.patch mm-rmap-fix-assumptions-of-thp-size.patch mm-truncate-fix-truncation-for-pages-of-arbitrary-size.patch mm-page-writeback-support-tail-pages-in-wait_for_stable_page.patch mm-vmscan-allow-arbitrary-sized-pages-to-be-paged-out.patch mm-readahead-add-define_readahead.patch mm-readahead-make-page_cache_ra_unbounded-take-a-readahead_control.patch mm-readahead-make-do_page_cache_ra-take-a-readahead_control.patch mm-readahead-add-page_cache_sync_ra-and-page_cache_async_ra.patch harden-autofs-ioctl-table.patch