@@ -315,6 +315,9 @@ errcode_t ext2fs_free_ext_attr(ext2_filsys fs, ext2_ino_t ino,
ext2fs_file_acl_block_set(fs, (struct ext2_inode *)inode, 0);
if (header->h_refcount == 0)
ext2fs_block_alloc_stats2(fs, blk, -1);
+ err = ext2fs_iblk_sub_blocks(fs, (struct ext2_inode *)inode, 1);
+ if (err)
+ goto out2;
/* Write inode? */
if (inode == &i) {
@@ -549,13 +552,9 @@ skip_ea_block:
blk = ext2fs_file_acl_block(handle->fs, (struct ext2_inode *)inode);
if (!block_buf && blk) {
/* xattrs shrunk, free the block */
- ext2fs_file_acl_block_set(handle->fs,
- (struct ext2_inode *)inode, 0);
- err = ext2fs_iblk_sub_blocks(handle->fs,
- (struct ext2_inode *)inode, 1);
+ err = ext2fs_free_ext_attr(handle->fs, handle->ino, inode);
if (err)
goto out;
- ext2fs_block_alloc_stats2(handle->fs, blk, -1);
}
/* Write the inode */