Fix stack frame size: dmu_redact_snap()

Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
Closes #10879
This commit is contained in:
Pavel Snajdr 2020-09-07 17:12:17 +02:00 committed by Brian Behlendorf
parent c95625769d
commit 8c0b16e6e9

View File

@ -1006,10 +1006,14 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
objset_t *os; objset_t *os;
struct redact_thread_arg *args = NULL; struct redact_thread_arg *args = NULL;
redaction_list_t *new_rl = NULL; redaction_list_t *new_rl = NULL;
char *newredactbook;
if ((err = dsl_pool_hold(snapname, FTAG, &dp)) != 0) if ((err = dsl_pool_hold(snapname, FTAG, &dp)) != 0)
return (err); return (err);
newredactbook = kmem_zalloc(sizeof (char) * ZFS_MAX_DATASET_NAME_LEN,
KM_SLEEP);
if ((err = dsl_dataset_hold_flags(dp, snapname, DS_HOLD_FLAG_DECRYPT, if ((err = dsl_dataset_hold_flags(dp, snapname, DS_HOLD_FLAG_DECRYPT,
FTAG, &ds)) != 0) { FTAG, &ds)) != 0) {
goto out; goto out;
@ -1063,7 +1067,6 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
goto out; goto out;
boolean_t resuming = B_FALSE; boolean_t resuming = B_FALSE;
char newredactbook[ZFS_MAX_DATASET_NAME_LEN];
zfs_bookmark_phys_t bookmark; zfs_bookmark_phys_t bookmark;
(void) strlcpy(newredactbook, snapname, ZFS_MAX_DATASET_NAME_LEN); (void) strlcpy(newredactbook, snapname, ZFS_MAX_DATASET_NAME_LEN);
@ -1073,6 +1076,8 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
"#%s", redactbook); "#%s", redactbook);
if (n >= ZFS_MAX_DATASET_NAME_LEN - (c - newredactbook)) { if (n >= ZFS_MAX_DATASET_NAME_LEN - (c - newredactbook)) {
dsl_pool_rele(dp, FTAG); dsl_pool_rele(dp, FTAG);
kmem_free(newredactbook,
sizeof (char) * ZFS_MAX_DATASET_NAME_LEN);
return (SET_ERROR(ENAMETOOLONG)); return (SET_ERROR(ENAMETOOLONG));
} }
err = dsl_bookmark_lookup(dp, newredactbook, NULL, &bookmark); err = dsl_bookmark_lookup(dp, newredactbook, NULL, &bookmark);
@ -1145,16 +1150,23 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
(void) thread_create(NULL, 0, redact_traverse_thread, rta, (void) thread_create(NULL, 0, redact_traverse_thread, rta,
0, curproc, TS_RUN, minclsyspri); 0, curproc, TS_RUN, minclsyspri);
} }
struct redact_merge_thread_arg rmta = { { {0} } };
(void) bqueue_init(&rmta.q, zfs_redact_queue_ff, struct redact_merge_thread_arg *rmta;
rmta = kmem_zalloc(sizeof (struct redact_merge_thread_arg), KM_SLEEP);
(void) bqueue_init(&rmta->q, zfs_redact_queue_ff,
zfs_redact_queue_length, offsetof(struct redact_record, ln)); zfs_redact_queue_length, offsetof(struct redact_record, ln));
rmta.numsnaps = numsnaps; rmta->numsnaps = numsnaps;
rmta.spa = os->os_spa; rmta->spa = os->os_spa;
rmta.thr_args = args; rmta->thr_args = args;
(void) thread_create(NULL, 0, redact_merge_thread, &rmta, 0, curproc, (void) thread_create(NULL, 0, redact_merge_thread, rmta, 0, curproc,
TS_RUN, minclsyspri); TS_RUN, minclsyspri);
err = perform_redaction(os, new_rl, &rmta); err = perform_redaction(os, new_rl, rmta);
kmem_free(rmta, sizeof (struct redact_merge_thread_arg));
out: out:
kmem_free(newredactbook, sizeof (char) * ZFS_MAX_DATASET_NAME_LEN);
if (new_rl != NULL) { if (new_rl != NULL) {
dsl_redaction_list_long_rele(new_rl, FTAG); dsl_redaction_list_long_rele(new_rl, FTAG);
dsl_redaction_list_rele(new_rl, FTAG); dsl_redaction_list_rele(new_rl, FTAG);