linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: weiping zhang <zwp10758@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Jan Kara <jack@suse.cz>, Bart Van Assche <Bart.VanAssche@wdc.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH v2] bdi: show error log when fail to create bdi debugfs entry
Date: Sat, 20 Jan 2018 08:09:24 +0800	[thread overview]
Message-ID: <CAA70yB5Xw09S-vfXnx-PHi5Pphid+VS_ZFacpQPDMuBCWAtiYA@mail.gmail.com> (raw)
In-Reply-To: <5a072f16-d82a-a25c-2ee9-fa75ac096a01@kernel.dk>

2018-01-20 3:54 GMT+08:00 Jens Axboe <axboe@kernel.dk>:
> On 1/19/18 10:36 AM, weiping zhang wrote:
>> 2018-01-11 0:36 GMT+08:00 weiping zhang <zhangweiping@didichuxing.com>:
>>> bdi debugfs dir/file may create fail, add error log here.
>>>
>>> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
>>> ---
>>> V1->V2:
>>> fix indentation and make log message more clear
>>>
>>>  mm/backing-dev.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
>>> index b5f940c..0a49665 100644
>>> --- a/mm/backing-dev.c
>>> +++ b/mm/backing-dev.c
>>> @@ -885,7 +885,9 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt, va_list args)
>>>         cgwb_bdi_register(bdi);
>>>         bdi->dev = dev;
>>>
>>> -       bdi_debug_register(bdi, dev_name(dev));
>>> +       if (bdi_debug_register(bdi, dev_name(dev)))
>>> +               pr_warn("blkdev %s: creation of bdi debugfs entries failed.\n",
>>> +                       dev_name(dev));
>>>         set_bit(WB_registered, &bdi->wb.state);
>>>
>>>         spin_lock_bh(&bdi_lock);
>>> --
>>
>> Hi Jens,
>>
>> madam has no permission to create debuts entry if SELINUX is enable at
>> Fedora and Centos,
>> and we have revert 6d0e4827b72 Revert "bdi: add error handle for
>> bdi_debug_register", that is to say
>> bdi debugfs is not the key component of block device, this patch just
>> add warning log.
>
> Have we fixed the case where we know it will trigger?

The reason is that mdadm has no permission to create dir/file under
/sys/kernel/debug/
, I think we can solve it in two possible ways.

1.Add proper SELINUX policy to allow mdadm create
/sys/kernel/debug/bdi/xxx, but not
every user add this allowance, so kernel show a warning for this case.

2.Split mdadm into 2 part, Firstly, user proccess mdadm trigger a
kwork and wait a event
done, secondly kwork will create gendisk)and then wake up event. But
it is more likely a
hack, and it may break SELINUX mechanism, so I give up this way.
https://marc.info/?l=linux-mm&m=151456540928231&w=2

> --
> Jens Axboe
>

      reply	other threads:[~2018-01-20  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 16:36 [PATCH v2] bdi: show error log when fail to create bdi debugfs entry weiping zhang
2018-01-19 17:36 ` weiping zhang
2018-01-19 19:54   ` Jens Axboe
2018-01-20  0:09     ` weiping zhang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA70yB5Xw09S-vfXnx-PHi5Pphid+VS_ZFacpQPDMuBCWAtiYA@mail.gmail.com \
    --to=zwp10758@gmail.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).