dm verity: allow optional args to alter primary args handling
authorMike Snitzer <snitzer@kernel.org>
Tue, 26 Jul 2022 15:29:50 +0000 (11:29 -0400)
committerMike Snitzer <snitzer@kernel.org>
Thu, 4 Aug 2022 17:50:43 +0000 (13:50 -0400)
commitdf326e7a06990bab011afc8c17de1ab2774e4bb8
tree39a8a2568955686d9fd542ff9df873ab7400735f
parent5721d4e5a9cdb148f681a004ae5748890a0e2d90
dm verity: allow optional args to alter primary args handling

The previous commit ("dm verity: Add optional "try_verify_in_tasklet"
feature") imposed that CRYPTO_ALG_ASYNC mask be used even if the
optional "try_verify_in_tasklet" feature was not specified. This was
because verity_parse_opt_args() was called after handling the primary
args (due to it having data dependencies on having first parsed all
primary args).

Enhance verity_ctr() so that simple optional args, that don't have a
data dependency on primary args parsing, can alter how the primary
args are handled. In practice this means verity_parse_opt_args() gets
called twice. First with the new 'only_modifier_opts' arg set to true,
then again with it set to false _after_ parsing all primary args.

This allows the v->use_tasklet flag to be properly set and then used
when verity_ctr() parses the primary args and then calls
crypto_alloc_ahash() with CRYPTO_ALG_ASYNC conditionally set.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-verity-target.c