From: Darrick J. Wong Date: Sun, 10 Aug 2014 22:27:10 +0000 (-0400) Subject: libext2fs: strict inline data overwrite should not return ENOSPC X-Git-Tag: v1.43-WIP-2015-05-18~240 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=cffe0221eb53c2de739f483aeb368684206ad4a8;p=tools%2Fe2fsprogs.git libext2fs: strict inline data overwrite should not return ENOSPC If we're doing a strict overwrite (same data size) of data in an inline data file, we should be able to skip the size check. If the in-core EA representation is fine but the on-disk EA is slightly corrupt (this happens when fixing minor errors in an inline dir), the ext2fs_xattr_inode_max_size() call, which reads the disk EA, can lead us to think that there's no space when in reality there is no issue with doing a strict overwrite. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c index c188d75..b9bda50 100644 --- a/lib/ext2fs/inline_data.c +++ b/lib/ext2fs/inline_data.c @@ -574,7 +574,8 @@ errcode_t ext2fs_inline_data_set(ext2_filsys fs, ext2_ino_t ino, else free_inode_size = 0; - if (size > existing_size + free_ea_size + free_inode_size) + if (size != existing_size && + size > existing_size + free_ea_size + free_inode_size) return EXT2_ET_INLINE_DATA_NO_SPACE; memcpy((void *)inode->i_block, buf, EXT4_MIN_INLINE_DATA_SIZE);