btrfs-progs: Avoid uninitialized data in output of btrfs-convert
cover btrfs-progs: Avoid uninitialized data in output of btrfs-convert
sequence, transid and reserved field of inode was write to disk with uninitizlized value, this patchset fixed it, also fixed some other typo.
Zhao Lei (3):
btrfs-progs: fix set_get typo of btrfs_inode_item->sequence
btrfs-progs: Avoid uninitialized data in output of btrfs-convert
btrfs-progs: add ext2fs_close_inode_scan to copy_inodes
btrfs-convert.c | 5 +++++ ctree.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.5.1
PATCH 1/3 btrfs-progs: fix set_get typo of btrfs_inode_item->sequence
s/generation/sequence
for BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence, ...)
--- ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ctree.h +1 -1
@@ -1423,7 +1423,7 @@ BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);BTRFS_SETGET_STACK_FUNCS (stack_inode_generation, struct btrfs_inode_item, generation, 64);BTRFS_SETGET_STACK_FUNCS (stack_inode_sequence, - struct btrfs_inode_item, generation, 64); + struct btrfs_inode_item, sequence, 64);BTRFS_SETGET_STACK_FUNCS (stack_inode_size, struct btrfs_inode_item, size, 64); BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
Signature · 1 line
1.8.5.1
PATCH 2/3 btrfs-progs: Avoid uninitialized data in output of btrfs-convert
In reply to Zhao Leisequence, transid and reserved field of inode was write to disk with uninitizlized value, this patch fixed it.
--- btrfs-convert.c | 4 ++++ ctree.h | 2 ++ 2 files changed, 6 insertions(+)
btrfs-convert.c +4 -0
@@ -1016,6 +1016,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst, struct ext2_inode *src, u32 blocksize) { btrfs_set_stack_inode_generation(dst, 1); +btrfs_set_stack_inode_sequence (dst,0 ); +btrfs_set_stack_inode_transid (dst,1 );btrfs_set_stack_inode_size (dst, src->i_size);btrfs_set_stack_inode_nbytes (dst,0 );btrfs_set_stack_inode_block_group (dst,0 );
@@ -1052,6 +1054,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst, new_decode_dev(src->i_block[1])); } } +memset (&dst->reserved,0 ,sizeof (dst->reserved)); +return 0 ; }
ctree.h +2 -0
@@ -1424,6 +1424,8 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_generation, struct btrfs_inode_item, generation, 64);BTRFS_SETGET_STACK_FUNCS (stack_inode_sequence , struct btrfs_inode_item, sequence, 64); +BTRFS_SETGET_STACK_FUNCS (stack_inode_transid, + struct btrfs_inode_item, transid, 64);BTRFS_SETGET_STACK_FUNCS (stack_inode_size, struct btrfs_inode_item, size, 64); BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
Signature · 1 line
1.8.5.1
PATCH 3/3 btrfs-progs: add ext2fs_close_inode_scan to copy_inodes
In reply to Zhao LeiWe need use ext2fs_close_inode_scan to release relative resource get from ext2fs_open_inode_scan() in copy_inodes()
--- btrfs-convert.c | 1 + 1 file changed, 1 insertion(+)
btrfs-convert.c +1 -0
@@ -1186,6 +1186,7 @@ static int copy_inodes(struct btrfs_root *root, ext2_filsys ext2_fs, } ret =btrfs_commit_transaction (trans, root);BUG_ON (ret); +ext2fs_close_inode_scan (ext2_scan);return ret; }
Signature · 1 line
1.8.5.1
David Sterba
AppliedQuoted 8 lines · Zhao Lei
sequence, transid and reserved field of inode was write to disk with uninitizlized value, this patchset fixed it, also fixed some other typo.
Zhao Lei (3):
btrfs-progs: fixset_gettypo ofbtrfs_inode_item->sequence
btrfs-progs: Avoid uninitialized data in output of btrfs-convert
btrfs-progs: addext2fs_close_inode_scantocopy_inodes
Applied, thanks.