+ if (rc == -E2BIG) {
+ /*
+ * Splitting might fail with -EBUSY due to unexpected folio
+ * references, just like make_folio_secure(). So handle it
+ * ahead of time without the PTL being held.
+ */
+ folio_lock(folio);
+ rc = split_folio(folio);
if split_folio returns -EAGAIN...
+ folio_unlock(folio);
+ folio_put(folio);
+ }
+
if (rc == -EAGAIN) {
... we will not skip this ...
/*
* If we are here because the UVC returned busy or partial
* completion, this is just a useless check, but it is safe.
*/
- wait_on_page_writeback(page);
- put_page(page);
+ folio_wait_writeback(folio);
+ folio_put(folio);
... and we will do one folio_put() too many
} else if (rc == -EBUSY) {
/*
* If we have tried a local drain and the page refcount
are we sure that split_folio() can never return -EAGAIN now and in the
future too?
maybe just change it to } else if (... ?