> The fix that I've done here means all buffers going through this
> path will take an extra reference, but that reference is only
> dropped on async buffers. Because all the buffers are markd stale,
> they are removed from the LRU, and so xfs_buftarg_wait() during
> unmount does not find them and hence the remaining reference is
> never removed. Hence the perag reference still remains, and we
> assert fail there.
> Solution seems simple - set the XBF_ASYNC flag on all buffers so
> that the last reference is taken away correctly. Testing that now.
I don't like this. ioend processing is very different for synchrous
writes, with the most important difference being that synchronous
writes need to wake the submitter at I/O completion. From all I can
see your v2 patch breaks that beahviour. For 3.7-rc I'd suggest
taking the additional reference conditionally.
For 3.8 I'm going to look into simply acquiring an additional reference
for synchronous writes during I/O submission to kill these special cases
all over the buffer code.