Skip to content

dmu_redact.c does not call bqueue_destroy #11684

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions module/zfs/dmu_redact.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,12 @@ perform_thread_merge(bqueue_t *q, uint32_t num_threads,
kmem_free(redact_nodes, num_threads * sizeof (*redact_nodes));
if (current_record != NULL)
bqueue_enqueue(q, current_record, sizeof (current_record));

for (int i = 0; i < num_threads; i++) {
struct redact_thread_arg *targ = &thread_args[i];
bqueue_destroy(&targ->q);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me like we don't need this chunk. In dmu_redact_snap()->perform_redaction() we should wait until the redact_merge_thread completes at which point we'll exit perform_redaction() and destroy the bqueue with you other addition. Though I could be mistaken, @pcd1193182 can you confirm this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work, though I would move it up into the previous for loop where we call avl_remove for each worker thread.

This is destroying the worker threads' bqueues, which are different from the queue from the merge thread to the main thread, so we do need to have a separate destroy call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcd1193182 thanks for taking a look at this. @lundman if you can refresh the patch to incorporate Paul's feedback and rebase it on master we can get this merged.


return (err);
}

Expand Down Expand Up @@ -1164,6 +1170,7 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
(void) thread_create(NULL, 0, redact_merge_thread, rmta, 0, curproc,
TS_RUN, minclsyspri);
err = perform_redaction(os, new_rl, rmta);
bqueue_destroy(&rmta->q);
kmem_free(rmta, sizeof (struct redact_merge_thread_arg));

out:
Expand Down