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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 66532C54F70 for ; Sun, 19 Apr 2020 23:05:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32D6F214D8 for ; Sun, 19 Apr 2020 23:05:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32D6F214D8 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 BBDFD8E0005; Sun, 19 Apr 2020 19:05:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B6DE28E0003; Sun, 19 Apr 2020 19:05:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A36638E0005; Sun, 19 Apr 2020 19:05:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 8BCE68E0003 for ; Sun, 19 Apr 2020 19:05:41 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 546A1824556B for ; Sun, 19 Apr 2020 23:05:41 +0000 (UTC) X-FDA: 76726138482.02.day91_4eb8d9668423e X-HE-Tag: day91_4eb8d9668423e X-Filterd-Recvd-Size: 4734 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Apr 2020 23:05:40 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id t40so3603340pjb.3 for ; Sun, 19 Apr 2020 16:05:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YJTrIfx/lTXBrxRhvPPVDY2x+cMSRZK5c/JFw4v1j9o=; b=OJZJNSNoG94S1I5EecTKDgdXsQV3MkcLVZuRwvwzF6kRtoW+ejjCTPeIeJYVDDj7Al o4NCLOBW2POMH8gg0q/U3WmbqOklVoW6yDgS9eEslJcXiQugBMJHDnDM06N8UUWxpg2a 19FC+RyhgMKUFvN/7+vwWf5fuG3KbYB0/gVhJXSdpB3g66iAPbeu0vthgLmJ0u2Yx+lz 7pNqCX1g0+6XQRCTWp6lxvUUiIuoIK8Pc5y+U2HKafggvDZ4N9uKmE8tcK4sRXMspxt/ XKd9LuxJr0dgrDwnOioGjJZbhd5p6HXL6n3ZS6yAxxvQjaTye3djKxzSHFNqqA3791Mk plHg== X-Gm-Message-State: AGi0PubaOAFMxTIDGCCLU37PeDVLWKaZI304CqcezAlF93JgrVOEjF7X 1Dx4sjZOsOoJkOT4FAFVe8Q= X-Google-Smtp-Source: APiQypLX1bYPgykU3ZP7zEmkJU3lEhVMCZnqRms/YIQbuGnJEBd6DNYdezzhhxxk1VGEWWm12j1PtQ== X-Received: by 2002:a17:90a:414b:: with SMTP id m11mr17790229pjg.160.1587337539909; Sun, 19 Apr 2020 16:05:39 -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 i8sm7384626pfq.126.2020.04.19.16.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 16:05:38 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6F34F403EA; Sun, 19 Apr 2020 23:05:37 +0000 (UTC) Date: Sun, 19 Apr 2020 23:05:37 +0000 From: Luis Chamberlain To: Bart Van Assche Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, gregkh@linuxfoundation.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 08/10] blktrace: add checks for created debugfs files on setup Message-ID: <20200419230537.GG11244@42.do-not-panic.com> References: <20200419194529.4872-1-mcgrof@kernel.org> <20200419194529.4872-9-mcgrof@kernel.org> <38240225-e48e-3035-0baa-4929948b23a3@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <38240225-e48e-3035-0baa-4929948b23a3@acm.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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 03:57:58PM -0700, Bart Van Assche wrote: > On 4/19/20 12:45 PM, Luis Chamberlain wrote: > > Even though debugfs can be disabled, enabling BLK_DEV_IO_TRACE will > > select DEBUG_FS, and blktrace exposes an API which userspace uses > > relying on certain files created in debugfs. If files are not created > > blktrace will not work correctly, so we do want to ensure that a > > blktrace setup creates these files properly, and otherwise inform > > userspace. > > > > Signed-off-by: Luis Chamberlain > > --- > > kernel/trace/blktrace.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c > > index 9cc0153849c3..fc32a8665ce8 100644 > > --- a/kernel/trace/blktrace.c > > +++ b/kernel/trace/blktrace.c > > @@ -552,17 +552,19 @@ static int blk_trace_create_debugfs_files(struct blk_user_trace_setup *buts, > > struct dentry *dir, > > struct blk_trace *bt) > > { > > - int ret = -EIO; > > - > > bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt, > > &blk_dropped_fops); > > + if (!bt->dropped_file) > > + return -ENOMEM; > > bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops); > > + if (!bt->msg_file) > > + return -ENOMEM; > > bt->rchan = relay_open("trace", dir, buts->buf_size, > > buts->buf_nr, &blk_relay_callbacks, bt); > > if (!bt->rchan) > > - return ret; > > + return -EIO; > > return 0; > > } > > I should have had a look at this patch before I replied to the previous > patch. > > Do you agree that the following code can be triggered by > debugfs_create_file() and also that debugfs_create_file() never returns > NULL? If debugfs is enabled, and not that we know it is in this blktrace code, as we select it, it can return ERR_PTR(-ERROR) if an error occurs. Luis