ref: edcd44595bcb730d60d0e0cbd6c4ede76cd2f2c7
parent: d8bfd3ab2b5093f29f9a3dca61a219e339ba989a
author: root <[email protected]>
date: Fri Oct 9 13:13:07 EDT 2015
FIX: ea_size accounting is not correct after resizing. (2)
--- a/lwext4/ext4_xattr.c
+++ b/lwext4/ext4_xattr.c
@@ -423,7 +423,8 @@
size_t new_data_size)
{
int ret = EOK;
- if (xattr_ref->ea_size - EXT4_XATTR_SIZE(item->data_size) +
+ size_t old_data_size = item->data_size;
+ if (xattr_ref->ea_size - EXT4_XATTR_SIZE(old_data_size) +
EXT4_XATTR_SIZE(new_data_size) >
ext4_xattr_inode_space(xattr_ref) +
ext4_xattr_block_space(xattr_ref)) {
@@ -436,7 +437,7 @@
}
xattr_ref->ea_size =
xattr_ref->ea_size -
- EXT4_XATTR_SIZE(item->data_size) +
+ EXT4_XATTR_SIZE(old_data_size);
EXT4_XATTR_SIZE(new_data_size);
xattr_ref->dirty = true;
return ret;