Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1385120pxj; Fri, 4 Jun 2021 13:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxb1lnhM9eaIpkCVxEyfRSeTV1utAGuXW0gx8QFqewHt/c+JykhT+egWMIA+9JNxwZ4V5q X-Received: by 2002:a05:6402:4414:: with SMTP id y20mr6607216eda.130.1622836916532; Fri, 04 Jun 2021 13:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622836916; cv=none; d=google.com; s=arc-20160816; b=vZA2fhDubXRS0BfqPcfvd0S7VvFkeGwRvZpQDrq2pK2M3pYOu8P6XgTlMBH564Yvi0 vm5yfVw9gCfifwnOIrmJ6g/OeRQRKysI3V4LmU11v4beTCw9YkOE3Rw17UuV235gilOU l+jbwUZ0QWYwIkP9kzEbdSOWz60F+o1XIQPpT/zPHu/ug/p20vCcUgXDpcT5uOtcsgyJ OxHJdHKzLOUlT/BZAZmmVmRLxSlA1OYbYqpEQESwGX6JpG6X4fFzr29zUkUXaZqE/Plu PteuhEZ0DmU2sajz83vzSlnRg8A4+fNKjZSOT9DTSRnoAx5bFcSDFLxYuoLCLECTMcOY ih+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=jBlEUGbY3b8g6dIjXWcbrWjBefIWreF/HXMBvYwoDp0=; b=xmWoMPYZAEg4tH+7qRWRj1YZD2/gfoz37KhSwARg2lzMkgUnWhJg6DMWxF9YAwMIHV hFHIAgED9IAEWXhHTDSNcyJzssaDw8TH7F8DJavfUU1QvO5sJdwsM7EmxMMe/AFgD9Po uYC2A0xnEecC/PpoYpd82AYOcbwS19lvS0sxW7X2pQ0duglqsXWYPcLi/AvEe1Srqfpm HDJuisiqntdXN1inDOKAQD7F8uk/kWfP1t2tprKwqwZZcOfkTuJn05gEbt7zW7H0Ks/s 8br/82F4xPJh7sRibEuXziZRiaPVOIEvmudJjHCjU3Zk53bSwqYX4DNidDHnwgAvstjC MrPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jm8my7TF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si5242740ejb.624.2021.06.04.13.01.29; Fri, 04 Jun 2021 13:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jm8my7TF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbhFDUBk (ORCPT + 99 others); Fri, 4 Jun 2021 16:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbhFDUBj (ORCPT ); Fri, 4 Jun 2021 16:01:39 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0141DC061766 for ; Fri, 4 Jun 2021 12:59:37 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id j206-20020a6280d70000b02902e9e02e1654so5921963pfd.6 for ; Fri, 04 Jun 2021 12:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=jBlEUGbY3b8g6dIjXWcbrWjBefIWreF/HXMBvYwoDp0=; b=jm8my7TF16J35qoVRbezLA3WooLXFZjasFcGwe7I9POWEyg8Ps/qcqZ2Yo/kVEVBsL p0eD8bDMQyqeOLCDxgv+pxoDtS3tSNses9uWQt+gM7oDVKmYBB86WkVjfJCprWJ+BhVj IVwCghFtTXluOmuABGDvnPlr5fzxFUchsBtHr2zdBnCB19P9YGaq5PclLTQ/HO3HiX3p m7i/9v5ucfa7dotnV/gz/N5cINZ/bi0+xG6g45QuKLDLlYk+/UYMtygawoY4tI5L1KiN Lwsdeh5imCR+xDI5XJRQk/S2+VZa5wMa6cHDSh8DiG7TuI+MidIOI9DXDCpNXLdozuis 0OeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=jBlEUGbY3b8g6dIjXWcbrWjBefIWreF/HXMBvYwoDp0=; b=VlcDExPkSTaKP2jf4vvF3j13bvSVxyouHoiIg6Gn0j1/2veXYo9nmZYNdMn6Ml0q2Y KkiiyY2Y2E2Lg6iYcXHdTfRHzCSHx65Nk/v3siibtgN0jwRvkxlI7gqlaiDvYW1QGIkb uZcUfbB7b1uG4LAdkhCn/SuxdzuGUkLQNImjtTDZpgpGJ1BpCcJaLzSSubF+v4vR6SIJ nnDVRE1jotERIn1TrDD8eQGvm4TxuCp4oSj0Jtbp2Y5rGCDdLfo4eBcmAk1475fhi6LG ag/rN9UOCXF2sMxDPYDmWgPnsBTaVONG+jnCmZWnX/WuH+h2GmP5Cb3Jpu76qC1eF7eG wJQg== X-Gm-Message-State: AOAM530YT0q31AuBEjvX3G7lhYB0QOhFUGPHzfX49jvuUbvGxBAYR/11 7kX4zVSObwHQl/3+nNyN732eG43BuFw= X-Received: from satyaprateek.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:1092]) (user=satyat job=sendgmr) by 2002:aa7:9d92:0:b029:2e9:dcf0:a2ef with SMTP id f18-20020aa79d920000b02902e9dcf0a2efmr5949723pfq.46.1622836776394; Fri, 04 Jun 2021 12:59:36 -0700 (PDT) Date: Fri, 4 Jun 2021 19:58:58 +0000 In-Reply-To: <20210604195900.2096121-1-satyat@google.com> Message-Id: <20210604195900.2096121-9-satyat@google.com> Mime-Version: 1.0 References: <20210604195900.2096121-1-satyat@google.com> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog Subject: [PATCH v3 08/10] dm: handle error from blk_ksm_register() From: Satya Tangirala To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jens Axboe , Eric Biggers , Satya Tangirala Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Handle any error from blk_ksm_register() in the callers. Previously, the callers ignored the return value because blk_ksm_register() wouldn't fail as long as the request_queue didn't have integrity support too, but as this is no longer the case, it's safer for the callers to just handle the return value appropriately. Signed-off-by: Satya Tangirala --- drivers/md/dm-table.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 29cbfc3e3c4b..e44f304b5c1a 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1354,7 +1354,21 @@ static void dm_update_keyslot_manager(struct request_queue *q, /* Make the ksm less restrictive */ if (!q->ksm) { - blk_ksm_register(t->ksm, q); + /* + * This WARN_ON should never trigger since t->ksm isn't be + * "empty" (i.e. will support at least 1 crypto capability), the + * request queue doesn't support integrity (since + * dm_table_construct_keyslot_manager() checks that), and + * it also satisfies all the block layer constraints + * "sufficiently" (as in the constraints of the DM device's + * request queue won't preclude any of the intersection of the + * supported capabilities of the underlying devices, since if + * some capability were precluded by the DM device's request + * queue's constraints, that capability would also have been + * precluded by one of the child device's request queues) + */ + if (WARN_ON(!blk_ksm_register(t->ksm, q))) + dm_destroy_keyslot_manager(t->ksm); } else { blk_ksm_update_capabilities(q->ksm, t->ksm); dm_destroy_keyslot_manager(t->ksm); -- 2.32.0.rc1.229.g3e70b5a671-goog