diff options
| author | root <ngkaho1234@gmail.com> | 2015-10-09 17:13:07 +0000 |
|---|---|---|
| committer | root <ngkaho1234@gmail.com> | 2015-10-09 17:13:07 +0000 |
| commit | edcd44595bcb730d60d0e0cbd6c4ede76cd2f2c7 (patch) | |
| tree | e77762f2b65e4641f2f4f63e668e43b706e87e6a | |
| parent | d8bfd3ab2b5093f29f9a3dca61a219e339ba989a (diff) | |
FIX: ea_size accounting is not correct after resizing. (2)
| -rw-r--r-- | lwext4/ext4_xattr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lwext4/ext4_xattr.c b/lwext4/ext4_xattr.c index 33a192c..8801b46 100644 --- a/lwext4/ext4_xattr.c +++ b/lwext4/ext4_xattr.c @@ -423,7 +423,8 @@ static int ext4_xattr_resize_item(struct ext4_xattr_ref *xattr_ref, 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 @@ static int ext4_xattr_resize_item(struct ext4_xattr_ref *xattr_ref, } 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; |
