The problem is that on delayed writeback, vm calls write_inode and
THEN writepages. Which means we still have WRBUFFER caps used,
so sending a cap release then is somewhat counter productive. If
we don't release wanted, we'll have to again later. And if we do,
the mds will explicitly revoke our WRBUFFER caps so that it can
journal the max_size to 0. Yuck.
So. If wait, then do the cap flush immediately, as before. If
!wait, queue up the caps at the front of the delay queue so that
it goes the next time we check_delayed_caps. This catches the
sync() and umount cases (basically the same, really).
On fsync, queue the caps for write, but don't wait, since the mds
can recover the size/mtime anyway.