A single open O_TRUNC on a file dirty pages would
-> truncate
-> put_wrbuffer_refs
-> check_caps
-> invalidate ... and deadlock
So, do not invalidate here if we have a pending truncate (which
remains elevated until after the truncate finishes).
ci->i_wrbuffer_ref == 0 && /* no dirty pages... */
ci->i_rdcache_gen && /* may have cached pages */
file_wanted == 0 && /* no open files */
+ !ci->i_truncate_pending &&
!tried_invalidate) {
u32 invalidating_gen = ci->i_rdcache_gen;
int ret;