You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tree::get is supposed to return by value, not by reference. But InlineExtent (and ExtAttr::Inline) values contain an embedded Arc<DivBufShared>. So if calling code, for example in Fs::do_truncate, gets such a value via Tree::get, it can mutate the Arc-protected buffer that is still owned by the Tree. The result is a mutation of an unlocked Tree, which is not good.
Rust's type system should be used to prevent this unlocked mutation, perhaps by returning something more like an Arc<[u8]>. Or, perhaps Tree::get should refuse to return such a value, and there should be a method like Tree::with that can access the Value while still holding the Tree's leaf node locked.
The text was updated successfully, but these errors were encountered:
Tree::get
is supposed to return by value, not by reference. ButInlineExtent
(andExtAttr::Inline
) values contain an embeddedArc<DivBufShared>
. So if calling code, for example inFs::do_truncate
, gets such a value viaTree::get
, it can mutate the Arc-protected buffer that is still owned by the Tree. The result is a mutation of an unlocked Tree, which is not good.Rust's type system should be used to prevent this unlocked mutation, perhaps by returning something more like an
Arc<[u8]>
. Or, perhapsTree::get
should refuse to return such a value, and there should be a method likeTree::with
that can access the Value while still holding the Tree's leaf node locked.The text was updated successfully, but these errors were encountered: