diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index fcc89856ab95..60ff8b3068d1 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -859,23 +859,37 @@ static int ocfs2_wipe_inode(struct inode *inode, } } - /* we do this while holding the orphan dir lock because we - * don't want recovery being run from another node to try an - * inode delete underneath us -- this will result in two nodes - * truncating the same file! */ - status = ocfs2_truncate_for_delete(osb, inode, di_bh); - if (status < 0) { - mlog_errno(status); - goto bail_unlock_dir; - } - - /* Remove any dir index tree */ - if (S_ISDIR(inode->i_mode)) { - status = ocfs2_dx_dir_truncate(inode, di_bh); + if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { + /* Short circuit for an inode with inline data, + * do this just like in ocfs2_truncate_file(). + */ + unmap_mapping_range(inode->i_mapping, PAGE_SIZE - 1, 0, 1); + truncate_inode_pages(inode->i_mapping, 0); + status = ocfs2_truncate_inline(inode, di_bh, 0, + i_size_read(inode), 1); if (status) { + mlog_errno(status); + goto bail; + } + } else { + /* we do this while holding the orphan dir lock because we + * don't want recovery being run from another node to try an + * inode delete underneath us -- this will result in two nodes + * truncating the same file! */ + status = ocfs2_truncate_for_delete(osb, inode, di_bh); + if (status < 0) { mlog_errno(status); goto bail_unlock_dir; } + + /* Remove any dir index tree */ + if (S_ISDIR(inode->i_mode)) { + status = ocfs2_dx_dir_truncate(inode, di_bh); + if (status) { + mlog_errno(status); + goto bail_unlock_dir; + } + } } /*Free extended attribute resources associated with this inode.*/