-
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
ARC refcount fixes #8000
ARC refcount fixes #8000
Conversation
When debugging is enabled and a zfs_refcount_t contains multiple holders using the same key, but different ref_counts, the wrong reference_t may be transferred. Add a zfs_refcount_transfer_ownership_many() function, like the existing zfs_refcount_*_many() functions, to match and transfer the correct refcount_t; This issue may occur when using encryption with refcount debugging enabled. An arc_buf_hdr_t can have references for both the hdr->b_l1hdr.b_pabd and hdr->b_crypt_hdr.b_rabd which both use the hdr as the reference holder. When unsharing the buffer the p_abd should be transferred. This issue does not impact production builds because refcount holders are not tracked. Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue openzfs#7219
Update arc_release to use arc_buf_size(). This hunk was accidentally dropped when porting compressed send/recv, 2aa3438. Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> TEST_ZTEST_TIMEOUT=3600 Issue openzfs#7219
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. Maybe add a comment somewhere that notes that refcounts adds / removes must be matched.
Codecov Report
@@ Coverage Diff @@
## master #8000 +/- ##
==========================================
- Coverage 78.68% 78.41% -0.27%
==========================================
Files 377 377
Lines 114213 114215 +2
==========================================
- Hits 89871 89566 -305
- Misses 24342 24649 +307
Continue to review full report at Codecov.
|
We should cherry-pick 5e8ff25 for 0.7.12. |
Update arc_release to use arc_buf_size(). This hunk was accidentally dropped when porting compressed send/recv, 2aa3438. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#8000
Update arc_release to use arc_buf_size(). This hunk was accidentally dropped when porting compressed send/recv, 2aa3438. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#8000
Update arc_release to use arc_buf_size(). This hunk was accidentally dropped when porting compressed send/recv, 2aa3438. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#8000
When debugging is enabled and a zfs_refcount_t contains multiple holders using the same key, but different ref_counts, the wrong reference_t may be transferred. Add a zfs_refcount_transfer_ownership_many() function, like the existing zfs_refcount_*_many() functions, to match and transfer the correct refcount_t; This issue may occur when using encryption with refcount debugging enabled. An arc_buf_hdr_t can have references for both the hdr->b_l1hdr.b_pabd and hdr->b_crypt_hdr.b_rabd both of which use the hdr as the reference holder. When unsharing the buffer the p_abd should be transferred. This issue does not impact production builds because refcount holders are not tracked. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#7219 Closes openzfs#8000
Update arc_release to use arc_buf_size(). This hunk was accidentally dropped when porting compressed send/recv, 2aa3438. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes openzfs#8000
Motivation and Context
Resolve #7219 which is occasionally encountered by
ztest
and was introduced by the encryption changes.Additionally, resolve an unrelated reference count discrepancy accidentally introduced when porting compressed send/recv. This may potentially explain #7820 though I was unable to reproduce the symptoms locally.
Description
Fix arc_relase() refcount
Update arc_release to use arc_buf_size(). This hunk was accidentally
dropped when porting compressed send/recv, 2aa3438.
Add zfs_refcount_transfer_ownership_many()
When debugging is enabled and a zfs_refcount_t contains multiple holders
using the same key, but different ref_counts, the wrong reference_t may
be transferred. Add a zfs_refcount_transfer_ownership_many() function,
like the existing zfs_refcount_*_many() functions, to match and transfer
the correct refcount_t;
This issue may occur when using encryption with refcount debugging
enabled. An arc_buf_hdr_t can have references for both the
hdr->b_l1hdr.b_pabd and hdr->b_crypt_hdr.b_rabd which both use the
hdr as the reference holder. When unsharing the buffer the p_abd
should be transferred.
This issue does not impact production builds because refcount holders
are not tracked.
How Has This Been Tested?
Local
ztes
t runs. Prior to this change I was able to reproduce the #7219 approximately once an hour usingztest
. With the fix applied I've thus far been unable to reproduce the issue. I'm pushing this change to the CI for additionalztest
coverage and will let my localztest
run overnight.Types of changes
Checklist:
Signed-off-by
.