On Fri, Feb 24, 2023 at 9:19 AM David Howells <dhowells@xxxxxxxxxx> wrote: > > The skip thing, in my code, is only used in WB_SYNC_NONE mode. If we hit 5 > things in progress or rescheduling is required, we return to the caller on the > basis that conflicting flushes appear to be happening in other threads. Ahh. *That* is the difference, and I didn't realize. I made all the skip-write cases the same, and I really meant for that case to only trigger for WB_SYNC_NONE, but I stupidly didn't notice that the whole folio_test_dirty() re-test case was done without that WB_SYNC_NONE case that all the other cases had. Mea culpa, mea maxima culpa. That was just me being stupid. So that case isn't actually a "skip write" case at all, it's actually a "no write needed at all" case. Your original patch is the right fix, and I was just being silly for having not realized. I'll apply that minimal fix for now - I think the right thing to do is your bigger patch, but that needs more thinking (or at least splitting up). Sorry for the confusion, and thanks for setting me straight, Linus