if (block_start >= to)
                        break;
  
 -              if (!buffer_delay(bh))
 +              /*
 +               * Process delalloc and unwritten buffers beyond EOF. We can
 +               * encounter unwritten buffers in the event that a file has
 +               * post-EOF unwritten extents and an extending write happens to
 +               * fail (e.g., an unaligned write that also involves a delalloc
 +               * to the same page).
 +               */
 +              if (!buffer_delay(bh) && !buffer_unwritten(bh))
                        continue;
  
-               if (!buffer_new(bh) && block_offset < i_size_read(inode))
+               if (!xfs_mp_fail_writes(mp) && !buffer_new(bh) &&
+                   block_offset < i_size_read(inode))
                        continue;
  
 -              xfs_vm_kill_delalloc_range(inode, block_offset,
 -                                         block_offset + bh->b_size);
 +              if (buffer_delay(bh))
 +                      xfs_vm_kill_delalloc_range(inode, block_offset,
 +                                                 block_offset + bh->b_size);
  
                /*
                 * This buffer does not contain data anymore. make sure anyone