Skip to content
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

leaf node deletion in range tree #11044

Closed
Finix1979 opened this issue Oct 10, 2020 · 2 comments
Closed

leaf node deletion in range tree #11044

Finix1979 opened this issue Oct 10, 2020 · 2 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@Finix1979
Copy link
Contributor

Ask your question!

After removing a range section, the parameter rs structure may contain an invalid value. Therefore, could not reference it later.

in range_tree_add_impl function, call rs = zfs_btree_find(&rt->rt_root, &rsearch, &where) to get rs, if rs not empth, and gap is true, it may call zfs_btree_remove to delete this rs first. if this causes whole leaf deletion, the rs may point to invalid value. Further using rs will cause error such as range_tree_stat_decr(rt, rs);

Which portion of the codebase does your question involve?

Additional context

@Finix1979 Finix1979 added the Type: Question Issue for discussion label Oct 10, 2020
@ahrens
Copy link
Member

ahrens commented Oct 10, 2020

@pcd1193182, could you take a look at this?

@pcd1193182
Copy link
Contributor

This is a bug; filing a PR to fix it now.

@pcd1193182 pcd1193182 added Type: Defect Incorrect behavior (e.g. crash, hang) and removed Type: Question Issue for discussion labels Oct 13, 2020
behlendorf pushed a commit that referenced this issue Oct 14, 2020
After a side-effectful call like add or remove, references to range 
segs stored in btrees can no longer be used safely.  We move the 
remove call to just before the reinsertion call so that the seg 
remains valid for as long as we need it.

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #11044 
Closes #11056
behlendorf pushed a commit that referenced this issue Oct 16, 2020
After a side-effectful call like add or remove, references to range
segs stored in btrees can no longer be used safely.  We move the
remove call to just before the reinsertion call so that the seg
remains valid for as long as we need it.

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #11044
Closes #11056
jsai20 pushed a commit to jsai20/zfs that referenced this issue Mar 30, 2021
After a side-effectful call like add or remove, references to range 
segs stored in btrees can no longer be used safely.  We move the 
remove call to just before the reinsertion call so that the seg 
remains valid for as long as we need it.

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes openzfs#11044 
Closes openzfs#11056
sempervictus pushed a commit to sempervictus/zfs that referenced this issue May 31, 2021
After a side-effectful call like add or remove, references to range 
segs stored in btrees can no longer be used safely.  We move the 
remove call to just before the reinsertion call so that the seg 
remains valid for as long as we need it.

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes openzfs#11044 
Closes openzfs#11056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

3 participants