-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
extra zap_put_leaf in an unlikely code path #12366
Comments
@ahrens , when you have some time, could you please double-check my observations? |
The same kind of problem can also happen if the |
This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions. |
I believe that this is a valid bug, although quite hard to hit in practice. |
We have probably hit this just now?
|
ping @amotin - just in case it might click for you faster, do you see any possible relation here to your zap related optimizations, please? |
It seems unlikely that this is the same issue tho, if the |
dunno, I'll create a new issue so that I don't spam this one... |
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#12366
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #12366 Closes #16159
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#12366 Closes openzfs#16159
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#12366 Closes openzfs#16159
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#12366 Closes openzfs#16159
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #12366 Closes #16159
Depending on kind of error zap_expand_leaf() may return with or without valid leaf reference held. Make sure it returns NULL if due to error it has no leaf to return. Make its callers to check the returned leaf pointer, and release the leaf if it is not NULL. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes openzfs#12366 Closes openzfs#16159
The problem is found by a code review of the latest code, so no OS / version details.
But the code has been unchanged for many years.
fzap_add
andfzap_update
may need to callzap_expand_leaf
if there is not enough room for a new entry.zap_expand_leaf
may need to callzap_grow_ptrtbl
if the current pointer table is not large enough.In the very unlikely -- but not impossible -- event that the
zap_grow_ptrtbl
call fails,zap_expand_leaf
would return with the original leaf,l
, released by a call tozap_put_leaf
and with the output leaf pointer,lp
, keeping it original value.Both
fzap_add
andfzap_update
callzap_expand_leaf
like this:So, in the described scenario,
l
would still point to the original leaf, but the leaf would be released.In the epilogue parts of the functions there is a call to
zap_put_leaf_maybe_grow_ptrtbl
that wouldzap_put_leaf
the leaf again.One potential consequence, in non-debug builds, is that a dirty hold would get released for the leaf's underlying dbuf.
Thus, the dbuf would both be free for a re-use and still be referenced from its dirty record.
The text was updated successfully, but these errors were encountered: