From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [PATCH net-next] netdevsim: correctly check return value of debugfs_create_dir Date: Tue, 19 Dec 2017 16:45:23 -0800 Message-ID: <20171219164523.60ac1308@cakuba.netronome.com> References: <002201d3723b$0e2b9310$2a82b930$@lab.ntt.co.jp> <20171211104029.63635671@cakuba.netronome.com> <014801d37884$3cc5d290$b65177b0$@lab.ntt.co.jp> <20171219.091152.920867492172236638.davem@davemloft.net> <024601d37927$b7e83410$27b89c30$@lab.ntt.co.jp> <20171219163014.1434bb62@cakuba.netronome.com> <024a01d3792a$e92c7ab0$bb857010$@lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "'David Miller'" , To: "Prashant Bhole" Return-path: Received: from mail-qk0-f173.google.com ([209.85.220.173]:32927 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753375AbdLTAp1 (ORCPT ); Tue, 19 Dec 2017 19:45:27 -0500 Received: by mail-qk0-f173.google.com with SMTP id x7so7417288qkb.0 for ; Tue, 19 Dec 2017 16:45:27 -0800 (PST) In-Reply-To: <024a01d3792a$e92c7ab0$bb857010$@lab.ntt.co.jp> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 20 Dec 2017 09:38:52 +0900, Prashant Bhole wrote: > > > 2) In case sim0 or bpf_bound_progs are fail to create, we need to add > > > checks before creating any file in them. > > > > What do you mean by "check before"? Checking if creation of each file > > fails or not, or something different? > > For example: > I will check if state->ddir is not NULL before creating files in it. > > if (state->ddir) { > debugfs_create_u32("id", 0400, state->ddir, &prog->aux->id); > debugfs_create_file("state", 0400, state->ddir, > &state->state, &nsim_bpf_string_fops); > debugfs_create_bool("loaded", 0400, state->ddir, &state->is_loaded); > } Ah, I would just error out in case we can't create any of the sub-directories as well.