On Mon, Jan 29, 2024 at 12:15 PM David Howells <dhowells@xxxxxxxxxx> wrote: > > Dave Wysochanski <dwysocha@xxxxxxxxxx> wrote: > > > - xas_lock(&xas); > > + xas_lock_irqsave(&xas, flags); > > xas_for_each(&xas, page, last) { > > You probably want to use RCU, not xas_lock(). The pages are locked and so > cannot be evicted from the xarray. > I tried RCU originally and ran into a problem because NFS can schedule (see comment on line 328 below) 326 xas_lock_irqsave(&xas, flags); 327 xas_for_each(&xas, page, last) { 328 /* nfs_read_add_folio() may schedule() due to pNFS layout and other RPCs */ 329 xas_pause(&xas); 330 xas_unlock_irqrestore(&xas, flags); 331 err = nfs_read_add_folio(&pgio, ctx, page_folio(page)); 332 if (err < 0) { 333 netfs->error = err; 334 goto out; 335 } 336 xas_lock_irqsave(&xas, flags); 337 } 338 xas_unlock_irqrestore(&xas, flags);