-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes two bugs for rafs v5 #1275
Conversation
@jiangliu , a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/72439 |
Codecov Report
@@ Coverage Diff @@
## master #1275 +/- ##
=======================================
Coverage 45.06% 45.07%
=======================================
Files 126 126
Lines 37395 37403 +8
Branches 37395 37403 +8
=======================================
+ Hits 16852 16858 +6
- Misses 19655 19656 +1
- Partials 888 889 +1
|
@jiangliu , The CI test is completed, please check result:
Congratulations, your test job passed! |
rafs/src/builder/core/v5.rs
Outdated
@@ -187,7 +187,7 @@ impl Bootstrap { | |||
|
|||
// Set super block | |||
let mut super_block = RafsV5SuperBlock::new(); | |||
let inodes_count = bootstrap_ctx.inode_map.len() as u64; | |||
let inodes_count = bootstrap_ctx.inode_map.len() as u64 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have this plus one before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I found the inodes count is incorrect for v5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain more about what this is trying to fix? Why must the inode count be one more than the actual recorded inode number on the map? Or is it because we forgot to insert the root inode in the inode_map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the root inode is missing here:
root@903f8fcca5c8:/nydus# target/debug/nydus-image inspect images/0de6bc4212c22aa2bcc8026697cbb93db330421c7a3a09f3ae2cfa9b90c4332c
[2023-05-15 09:35:34.626189 +00:00] INFO RAFS v5 super block features: HASH_BLAKE3 | EXPLICIT_UID_GID | COMPRESSION_ZSTD
Inspecting RAFS :> stats
Version: 5
Inodes Count: 1
Chunk Size: 1024KB
Root Inode: 1
Flags: HASH_BLAKE3 | EXPLICIT_UID_GID | COMPRESSION_ZSTD
Blob table offset: 0x2008
Blob table size: 0x0
Prefetch table offset: 0x2008
Prefetch table entries: 0x0
Chunk table offset: 0x0
Chunk table size: 0x0
Inspecting RAFS :> ls
- 2 "text.txt"
Inspecting RAFS :>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earlier on, we had
tree.node.index = RAFS_ROOT_INODE;
tree.node.inode.set_ino(RAFS_ROOT_INODE);
// Filesystem walking skips root inode within subsequent while loop, however, we allow
// user to pass the source root as prefetch hint. Check it here.
ctx.prefetch.insert_if_need(&tree.node);
bootstrap_ctx.inode_map.insert(
(tree.node.layer_idx, tree.node.src_ino, tree.node.src_dev),
vec![tree.node.index],
);
Should we add it back instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inode_map is used to detect hardlinks for regular files, so it doesn't make sense to add directories inode (including /
) into the inode_map. How about adding a comments for the `+`` instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we have all the other directory inodes (except for the root inode) in the inode_map
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough:)
rafs/src/builder/core/v5.rs
Outdated
@@ -187,7 +187,7 @@ impl Bootstrap { | |||
|
|||
// Set super block | |||
let mut super_block = RafsV5SuperBlock::new(); | |||
let inodes_count = bootstrap_ctx.inode_map.len() as u64; | |||
let inodes_count = bootstrap_ctx.inode_map.len() as u64 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain more about what this is trying to fix? Why must the inode count be one more than the actual recorded inode number on the map? Or is it because we forgot to insert the root inode in the inode_map?
let next_size = if next_size < window_size { | ||
let next_size = if next_size == 0 { | ||
continue; | ||
} else if next_size < window_size { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which debug_assert
is triggered by this? Could you paste the error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refined the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot find it. Did you forget to push the new code? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@jiangliu , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/72770 |
In function RafsSuper::amplify_io(), is the next inode `ni` is zero-sized, the debug assertion in function calculate_bio_chunk_index() (rafs/src/metadata/layout/v5.rs) will get triggered. So zero-sized file should be skipped by amplify_io(). Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
@jiangliu , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/72771 |
@jiangliu , The CI test is completed, please check result:
Congratulations, your test job passed! |
@jiangliu , The CI test is completed, please check result:
Sorry, your test job failed. Please get the details in the link. |
Add root inode into inode map when building RAFS filesystem, so RAFS v5 gets correct inode number counts. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
@jiangliu , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/72973 |
@jiangliu , The CI test is completed, please check result:
Congratulations, your test job passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Thanks!
Fixes two bugs for rafs v5: