Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp41721rwi; Tue, 18 Oct 2022 13:50:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM729OWbv7XydsLtZ19xrUuOJ1H7ITLYEghTVVssn9/xdguDfW8SpyqWnx7RBCzUqKHk2Mrk X-Received: by 2002:a17:906:d54d:b0:78e:2fbf:ca2a with SMTP id cr13-20020a170906d54d00b0078e2fbfca2amr4048725ejc.488.1666126211679; Tue, 18 Oct 2022 13:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666126211; cv=none; d=google.com; s=arc-20160816; b=K9aIVCrfnNSNkmE37/CMQ7zw9c1bdHQ3rtauONmVJpDwg5udrljtzApSaixa244tfR rUjcL4XfDHElMF+TbX8V93qQGWRWiRojFoEQi1xnBuvsn2F7raen1GZ03zgHfQvA3FA4 62dPig7+MPGAU3ah1Q3mq1xdthEQZwYNL9Ueu4PVijMDdmlyPHB0T8ttbRp31CU0viM0 9Zb25GTdHv3f6az/BokEY8Vv3DUvPfwwgRXQsueYLPvZivt9tj6EBPE7h8Zme3K4q5yZ yCtv3ym5548ZklJa6KZk7czNWN49lAz5F/J4UPtefbAu2mT/01urppMCQWUhO5VyLOeI JkHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lFeaHcw3WNcJNFaRay0No0wm3D4s1Mkz5fJGwkqsY20=; b=LXAT3UiWSJUWR/mnu+anwzhdQV6Mji76DIdIon3vaFhWb/cd5eeJG3mhjsfLm9dNKd Z6cQgY+Ii2Quz2xWSqDxdZl8nvPjw37lofRCq3gPzm3UGCyHJx7xBkey61xrhnw+rBAn QvGwkG+Jzef1VzKaLuBMAVWBKquH2B/Mt1cC7FggEcRgLN+xAIyHN4JcjqaoGM4HNfb2 xHkb31DcnTkUHp8mYMFzz850igROm0x8J05jbETvd0xwIh9QzNKZPrxRu9JC0JbVqUJQ lzf73PYWPj7H2k+Mhj6/dVztue9XBtgDJAC0U9pqvck55PKOxlKkQ/wsVk/obq6NIJPA jVvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IMsZVcTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb17-20020a1709071c9100b0077979f8d3dbsi12486823ejc.838.2022.10.18.13.49.45; Tue, 18 Oct 2022 13:50:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IMsZVcTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbiJRTwv (ORCPT + 99 others); Tue, 18 Oct 2022 15:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbiJRTwk (ORCPT ); Tue, 18 Oct 2022 15:52:40 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 565ED876B5; Tue, 18 Oct 2022 12:52:29 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id a67so22060917edf.12; Tue, 18 Oct 2022 12:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lFeaHcw3WNcJNFaRay0No0wm3D4s1Mkz5fJGwkqsY20=; b=IMsZVcTie6W3CPtJzjN94pHSJC7XL+ENcaX4GcL0mtRZO8MtB/L1yhDZPpaVpBmUYK bs8KSCL+9M7/KhxBu9kwXv0EVYqh0iCdwdXLW9Ye0em6U8KaCMyiRmJQwJMlkA6ZLtFO +8sfPDSDC6kLilqDoyEHDQpnSoIZnDUK3Ctb35lhI6NamtWM10UnUukWx8A9zecNKMCu Q/NcC55LR1UvKSpzU+SF0fFZ0cCjPUTXADVinblmu5Ha4okPjQlhic/ZVnHZcc4YjTZO Q1bXlXtNVTWbDg+KVPFNW6ue6x0kajLHT9TDmRmUeQBBCmymCS2UU5Uq4r62CFLGgVT/ Rp9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lFeaHcw3WNcJNFaRay0No0wm3D4s1Mkz5fJGwkqsY20=; b=78X7igW5b8BtM7vkgQz5rLuZk8pmnC/THLZ1D0HhhmA7owzceKqBen2JvZ7RZ1Fpwg hMcPOAgEnE90eBnjYjc6FdZUSRgRr9HRZpPLy2T4NCIN0dRNiLJphCV0cS5P7T3yTG8O /qqbKimZzsau9bme0ow4z1Tn4u79bc37+7zpf27mGGqba38+/Ji6et2VPxjbf0shb/9G HADrM5vZxVmgO+aIkVd49yHRw8pflAUJw1obays7UCbHruFDDzqPruWvSN4L7zg9pVCJ WEnyf4x8RM+IDmVdTC/Lb3Jg2a/+VbosTr6sf4FiR07zeHl+LNuPkDmu4aCJ5K430rvR c/8A== X-Gm-Message-State: ACrzQf37n5Lg53+Tyq6I9Gh0rhRKaRRLvlMFxPWYJYQBx/fDU1qUCZme r5LLw9cQjo4Xar7be/z1RYZjU68ApaE= X-Received: by 2002:a05:6402:1c1c:b0:45c:35b2:2a98 with SMTP id ck28-20020a0564021c1c00b0045c35b22a98mr4220710edb.182.1666122725252; Tue, 18 Oct 2022 12:52:05 -0700 (PDT) Received: from 127.0.0.1localhost (94.197.72.2.threembb.co.uk. [94.197.72.2]) by smtp.gmail.com with ESMTPSA id r1-20020a1709061ba100b0072a881b21d8sm7945858ejg.119.2022.10.18.12.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 12:52:04 -0700 (PDT) From: Pavel Begunkov To: Jens Axboe , linux-block@vger.kernel.org Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Pavel Begunkov Subject: [RFC for-next v2 1/4] bio: safeguard REQ_ALLOC_CACHE bio put Date: Tue, 18 Oct 2022 20:50:55 +0100 Message-Id: <558d78313476c4e9c233902efa0092644c3d420a.1666122465.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org bio_put() with REQ_ALLOC_CACHE assumes that it's executed not from an irq context. Let's add a warning if the invariant is not respected, especially since there is a couple of places removing REQ_POLLED by hand without also clearing REQ_ALLOC_CACHE. Signed-off-by: Pavel Begunkov --- block/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index 7cb7d2ff139b..5b4594daa259 100644 --- a/block/bio.c +++ b/block/bio.c @@ -741,7 +741,7 @@ void bio_put(struct bio *bio) return; } - if (bio->bi_opf & REQ_ALLOC_CACHE) { + if ((bio->bi_opf & REQ_ALLOC_CACHE) && !WARN_ON_ONCE(in_interrupt())) { struct bio_alloc_cache *cache; bio_uninit(bio); -- 2.38.0