On Sat, Jan 08, 2022 at 08:47:49AM -0800, Hugh Dickins wrote: > On Sat, 8 Jan 2022, Matthew Wilcox wrote: > > On Sun, Jan 02, 2022 at 04:19:41PM +0000, Matthew Wilcox wrote: > > > On Wed, Dec 08, 2021 at 04:22:08AM +0000, Matthew Wilcox (Oracle) wrote: > > > > This all passes xfstests with no new failures on both xfs and tmpfs. > > > > I intend to put all this into for-next tomorrow. > > > > > > As a result of Christoph's review, here's the diff. I don't > > > think it's worth re-posting the entire patch series. > > > > After further review and integrating Hugh's fixes, here's what > > I've just updated the for-next tree with. A little late, but that's > > this time of year ... > > I don't see any fix to shmem_add_to_page_cache() in this diff, my 3/3 > shmem: Fix "Unused swap" messages - I'm not sure whether you decided > my fix has to be adjusted or not, but some fix is needed there. I pushed that earlier because I had more confidence in my understanding of that patch. Here's what's currently in for-next: @@ -721,20 +720,18 @@ static int shmem_add_to_page_cache(struct page *page, cgroup_throttle_swaprate(page, gfp); do { - void *entry; xas_lock_irq(&xas); - entry = xas_find_conflict(&xas); - if (entry != expected) + if (expected != xas_find_conflict(&xas)) { + xas_set_err(&xas, -EEXIST); + goto unlock; + } + if (expected && xas_find_conflict(&xas)) { xas_set_err(&xas, -EEXIST); - xas_create_range(&xas); - if (xas_error(&xas)) goto unlock; -next: - xas_store(&xas, page); - if (++i < nr) { - xas_next(&xas); - goto next; } + xas_store(&xas, page); + if (xas_error(&xas)) + goto unlock; if (PageTransHuge(page)) { count_vm_event(THP_FILE_ALLOC); __mod_lruvec_page_state(page, NR_SHMEM_THPS, nr);