From patchwork Tue Jul 30 18:17:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11066439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAB5413A0 for ; Tue, 30 Jul 2019 18:18:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBB6828793 for ; Tue, 30 Jul 2019 18:18:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9417288E1; Tue, 30 Jul 2019 18:18:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4495328861 for ; Tue, 30 Jul 2019 18:18:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbfG3SSF (ORCPT ); Tue, 30 Jul 2019 14:18:05 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40147 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729160AbfG3SSF (ORCPT ); Tue, 30 Jul 2019 14:18:05 -0400 Received: by mail-pf1-f196.google.com with SMTP id p184so30257900pfp.7 for ; Tue, 30 Jul 2019 11:18:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=brM2vy8GAAw7hQGH8n7IiDhTyVm/OGsWJf8LH5FSdzI=; b=H0uXvwP49dFtV9sS1aNAvxnVgBSUC33PhTgAYTTaZERIIEuROsdezX+7tS5Da/9D5t gPxau5359iyw0Fmjh83dPMWNr4jRFbxAvWOktTqZW4oV1Nr6PYP/zkTSmxUs3JZFxUFg hN6y22xeRNVm7E+wx1YozZ0lOs4DnJ+l/ziudkouw23F/xn2PITlB4DIIX6BBu9MBWHd d+wkhZgtHmhUExoA2lV1VhFOOYrb7DPDIErIgJD67JYGbwVUDexMgTt/1qb3dLUCZXSZ +GF7EKI1dSTV6tbD9i8bgrO+1eu7EpIE3+06CRWxuPLkpK6K41GrZrQcQb92kg3v3b4v kYOQ== X-Gm-Message-State: APjAAAUo4/wbXENE43d3X71OcBIWZwaafPSVIzQP9UWojjvxtrd87iTP /TL3jQzYC9x6j+n7jWNwu10= X-Google-Smtp-Source: APXvYqz5Pf/eXdnsNtX7WLnCgUnjg+Xtut3kh2r8ukmLhtIwpVUdIssx+HdXQeD3+Q5Oe6FqvCy7cA== X-Received: by 2002:aa7:9ad2:: with SMTP id x18mr45016770pfp.192.1564510684663; Tue, 30 Jul 2019 11:18:04 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id 32sm12165895pgt.43.2019.07.30.11.18.03 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Jul 2019 11:18:03 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 0/2] Fix a race condition triggered by submit_bio() Date: Tue, 30 Jul 2019 11:17:55 -0700 Message-Id: <20190730181757.248832-1-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.709.g102302147b-goog MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Jens, One of the consequences of the switch to blk-mq is that generic_make_request() calls, a function called by submit_bio(), must be protected by a blk_queue_enter() / blk_queue_exit() pair to avoid that the block-cgroup functions called by generic_make_request() trigger a race condition. This patch series makes the kernel report a warning if that race condition is hit and also adds the necessary protection in submit_bio(). Please consider these patches for kernel v5.4. Thanks, Bart. Bart Van Assche (2): block: Verify whether blk_queue_enter() is used when necessary block: Fix a race condition in submit_bio() block/blk-cgroup.c | 2 ++ block/blk-core.c | 34 +++++++++++++++++++++++++++++++++- include/linux/blk-cgroup.h | 2 ++ include/linux/blkdev.h | 8 ++++++++ 4 files changed, 45 insertions(+), 1 deletion(-)