From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE7B6C3815B for ; Mon, 20 Apr 2020 11:38:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E0792078C for ; Mon, 20 Apr 2020 11:38:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="PSv9KlPA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E0792078C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 19B508E0005; Mon, 20 Apr 2020 07:38:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14CB58E0003; Mon, 20 Apr 2020 07:38:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0148B8E0005; Mon, 20 Apr 2020 07:38:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id D77968E0003 for ; Mon, 20 Apr 2020 07:38:53 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9439C180AD83E for ; Mon, 20 Apr 2020 11:38:53 +0000 (UTC) X-FDA: 76728036546.26.goat02_6ab4d8debd65d X-HE-Tag: goat02_6ab4d8debd65d X-Filterd-Recvd-Size: 3159 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Apr 2020 11:38:53 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03B3E206D4; Mon, 20 Apr 2020 11:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587382732; bh=veCGgKP+gaMaBxAIpl/jdA0mDZiqNm79OtKradPHlN8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PSv9KlPALQJwITlfEXQWZBKfTFX3Lc197g3Q8P8hhWjMQdROLzHL4K9KMio/IONiC 5fodZe10QtCuAN7yHrgwgFtBahvsrbC6jYbm3WOBcv4YJEBjYg9GmRAm9CLUTGV3U2 HxwYBll9AtQn8IQGb+0B89WmylTNdKz49QFIMyqc= Date: Mon, 20 Apr 2020 13:38:50 +0200 From: Greg KH To: Luis Chamberlain Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org, 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 Subject: Re: [PATCH v2 09/10] block: panic if block debugfs dir is not created Message-ID: <20200420113850.GC3906674@kroah.com> References: <20200419194529.4872-1-mcgrof@kernel.org> <20200419194529.4872-10-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200419194529.4872-10-mcgrof@kernel.org> 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: On Sun, Apr 19, 2020 at 07:45:28PM +0000, Luis Chamberlain wrote: > If DEBUG_FS is disabled we have another inline > blk_debugfs_register() which just returns 0. > > If BLK_DEV_IO_TRACE is enabled we rely on the block debugfs > directory to have been created. If BLK_DEV_IO_TRACE is not enabled > though, but if debugfs is still enabled we will always create a > debugfs directory for a request_queue. Instead of special-casing > this just for BLK_DEV_IO_TRACE, ensure this block debugfs dir is > always created at boot if we have enabled debugfs. > > Signed-off-by: Luis Chamberlain > --- > block/blk-debugfs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/block/blk-debugfs.c b/block/blk-debugfs.c > index 761318dcbf40..d6ec980e7531 100644 > --- a/block/blk-debugfs.c > +++ b/block/blk-debugfs.c > @@ -15,6 +15,8 @@ struct dentry *blk_debugfs_root; > void blk_debugfs_register(void) > { > blk_debugfs_root = debugfs_create_dir("block", NULL); > + if (!blk_debugfs_root) > + panic("Failed to create block debugfs directory\n"); How rude, never crash the kernel for something so trivial as that. Heck, never do ANYTHING different in the kernel if debugfs fails to do something you think it should do. This is debugging code, nothing should ever depend on it, so just save the value (if you need it) and move on. Never check the value, as it means nothing to you. greg k-h