From patchwork Sun Apr 19 19:45:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 11497855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22AC9174A for ; Sun, 19 Apr 2020 19:45:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECDB321744 for ; Sun, 19 Apr 2020 19:45:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECDB321744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 578F08E000A; Sun, 19 Apr 2020 15:45:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 52A5B8E0003; Sun, 19 Apr 2020 15:45:47 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41A298E000A; Sun, 19 Apr 2020 15:45:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 240108E0003 for ; Sun, 19 Apr 2020 15:45:47 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D6CAB4DAB for ; Sun, 19 Apr 2020 19:45:46 +0000 (UTC) X-FDA: 76725634692.07.hen50_4f89ee9c18829 X-Spam-Summary: 2,0,0,377ccf8718ff0c8f,d41d8cd98f00b204,mcgrof@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2689:2892:2901:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3874:4321:5007:6261:9389:9592:10004:11026:11658:11914:12043:12048:12050:12296:12297:12438:12517:12519:12555:12660:12895:13069:13149:13180:13229:13230:13255:13311:13357:13894:13972:14181:14384:14394:14721:21080:21444:21451:21627:21660:21987:21990:30054:30075,0,RBL:209.85.215.194:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: hen50_4f89ee9c18829 X-Filterd-Recvd-Size: 4655 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Apr 2020 19:45:46 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id h69so3961427pgc.8 for ; Sun, 19 Apr 2020 12:45:46 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=V2K7EZXYN6Xe1jPwFmqZWg/LsfDQ8FxEGzorYIUkLfM=; b=Ss4ZDKNXAzvW442GiKXyFZBAc0wax59YRFOVTkFWN9KwBuLWx46/9Fi3MA+Hy+7Mq6 3+MMRemIz6BdfpR7eG0MI1eYVhK/kZnOCQD4nqV42WIiu5glbtWKzNef6GbKu1rTUvL/ upD2FLm4iFzLc5wY/XInoYPAwME+76fgNgWXN04mfIetb1euNuBtygRazCOUTSysBHWy 9tG10qgYTaKHoHjA9eug+sXgNPBvLkXJMWoG+SE/UHbf93CxQKSeD/baoyan1+8SbVUg XhIdzZFWv41J98T8ymgLNJDXzPTonozQpIFfNDYMZ2z9KHtG1XoBiuX0cHfBd2bOzLsf sEwg== X-Gm-Message-State: AGi0PuZrqvj+0oGIXzTVtlde2rR6FrUv8seNTH85howGJ1q8J1V3VbXP QTmyY89utpObt2kyza9d/Fg= X-Google-Smtp-Source: APiQypIMWS/ShJP5LZ41kIXm9G1F2gs0Kheeswgp6JGQgly3HmDS9WmGOoUUTQl9T2/u5sowlGqZhg== X-Received: by 2002:a63:7c2:: with SMTP id 185mr2478993pgh.131.1587325545506; Sun, 19 Apr 2020 12:45:45 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id a23sm19365100pfo.145.2020.04.19.12.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 12:45:43 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id E685642000; Sun, 19 Apr 2020 19:45:38 +0000 (UTC) From: Luis Chamberlain To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org Cc: mhocko@suse.com, yukuai3@huawei.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH v2 06/10] blk-debugfs: upgrade warns to BUG_ON() if directory is already found Date: Sun, 19 Apr 2020 19:45:25 +0000 Message-Id: <20200419194529.4872-7-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200419194529.4872-1-mcgrof@kernel.org> References: <20200419194529.4872-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that we have moved release_queue from being asynchronous to synchronous, and fixed how we use the debugfs directory with blktrace we should no longer have expected races with device removal/addition and other operations with the debugfs directory. If races do happen however, we want to be informed of *how* this races happens rather than dealing with a debugfs splat, so upgrading this to a BUG_ON() should capture better information about how this can happen in the future. This is specially true these days with funky reproducers in userspace for which we have no access to, but only a bug splat. Note that on addition the gendisk kobject is used as the parent for the request_queue kobject, and upon removal, now that request_queue removal is synchronous, blk_unregister_queue() is called prior to the gendisk device_del(). This means we expect to see a sysfs clash first now prior to running into a race with the debugfs dentry; so this bug would be considered highly unlikely. Signed-off-by: Luis Chamberlain Reported-by: kernel test robot --- block/blk-debugfs.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/block/blk-debugfs.c b/block/blk-debugfs.c index d84038bce0a5..761318dcbf40 100644 --- a/block/blk-debugfs.c +++ b/block/blk-debugfs.c @@ -19,16 +19,8 @@ void blk_debugfs_register(void) int __must_check blk_queue_debugfs_register(struct request_queue *q) { - struct dentry *dir = NULL; - /* This can happen if we have a bug in the lower layers */ - dir = debugfs_lookup(kobject_name(q->kobj.parent), blk_debugfs_root); - if (dir) { - pr_warn("%s: registering request_queue debugfs directory twice is not allowed\n", - kobject_name(q->kobj.parent)); - dput(dir); - return -EALREADY; - } + BUG_ON(debugfs_lookup(kobject_name(q->kobj.parent), blk_debugfs_root)); q->debugfs_dir = debugfs_create_dir(kobject_name(q->kobj.parent), blk_debugfs_root);