diff options
author | Johan Rudholm <johan.rudholm@stericsson.com> | 2012-02-06 15:17:04 +0100 |
---|---|---|
committer | Christian Bejram <christian.bejram@stericsson.com> | 2012-03-25 21:05:38 +0200 |
commit | 82c18e022db437b22c0d76cca420bfe558bf2ebb (patch) | |
tree | 3bf1ef98cb8c207a12b5c7d8162dc98229e9125f | |
parent | 412d55c7ee5ce42dc52e0c03c3e0d1c5c2d9d870 (diff) | |
download | extras-82c18e022db437b22c0d76cca420bfe558bf2ebb.tar.gz |
ext4_utils: Fix long symbolic links
When the target of a symbolic link is over 60 characters, make_ext4fs
fails to create the link.
Instead of allocating n bytes, n blocks of 4096 bytes was reserved,
and the allocated data was never attached to the inode.
Change-Id: I63a2e76166a2afc30734265324d5c5265cfa59ff
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
-rw-r--r-- | ext4_utils/indirect.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext4_utils/indirect.c b/ext4_utils/indirect.c index 4e768a16..70f04d6e 100644 --- a/ext4_utils/indirect.c +++ b/ext4_utils/indirect.c @@ -484,9 +484,10 @@ u8 *inode_allocate_data_indirect(struct ext4_inode *inode, unsigned long len, unsigned long backing_len) { struct block_allocation *alloc; + u32 block_len = DIV_ROUND_UP(len, info.block_size); u8 *data = NULL; - alloc = do_inode_allocate_indirect(inode, len); + alloc = do_inode_allocate_indirect(inode, block_len); if (alloc == NULL) { error("failed to allocate extents for %lu bytes", len); return NULL; @@ -498,6 +499,10 @@ u8 *inode_allocate_data_indirect(struct ext4_inode *inode, unsigned long len, error("failed to create backing for %lu bytes", backing_len); } + rewind_alloc(alloc); + if (do_inode_attach_indirect(inode, alloc, block_len)) + error("failed to attach blocks to indirect inode"); + free_alloc(alloc); return data; |