Re: [PATCH v1 2/5] s390/uv: convert gmap_make_secure() to work on folios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]

+	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?

Yes, and in contrast to documentation, that can actually happen! The documentation is even wrong: we return -EAGAIN if there are unexpected folio references (e.g., pinned), thanks for raising that.


maybe just change it to  } else if (...   ?


I think I'll make it all clearer by handling split_folio() return values separately.

--
Cheers,

David / dhildenb





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux