An xfs inode can be destroyed before log I/O involving that inode is complete. We need to wait for the inode to be unpinned before tearing it down. The patch looks big but the only real change is adding a call to xfs_iunpin_wait() to the start of xfs_idestroy(). The rest of the patch is moving xfs_idestroy() after the pinning routines. Lachlan