mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yukuai (C)" <yukuai3@huawei.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<oleg@redhat.com>, <jack@suse.cz>, <linux-kernel@vger.kernel.org>,
	<zhengbin13@huawei.com>, <yi.zhang@huawei.com>,
	<chenxiang66@hisilicon.com>, <xiexiuqi@huawei.com>,
	"Al Viro" <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH] debugfs: fix potential infinite loop in debugfs_remove_recursive
Date: Fri, 15 Nov 2019 09:57:12 +0800	[thread overview]
Message-ID: <9441c491-3d91-f16b-71fc-aeb658d6c8f0@huawei.com> (raw)
In-Reply-To: <6ac793b1-5472-6a39-fe94-348ad6a4e2be@huawei.com>



在 2019/11/15 9:47, yukuai (C) 写道:
> 
> 
> On 2019/11/14 22:34, Steven Rostedt wrote:
>> On Thu, 14 Nov 2019 14:59:04 +0800
>> "yukuai (C)" <yukuai3@huawei.com> wrote:
>>
>>>> Have you tried this patch with lockdep enabled and tried to hit this
>>>> code path?
>>>>
>>
>>> You are right, I get the results with lockdep enabled:
>>
>> That was what I was afraid of :-(
>>
>>> [   64.314748] ============================================
>>> [   64.315568] WARNING: possible recursive locking detected
>>> [   64.316549] 5.4.0-rc7-dirty #5 Tainted: G           O
>>> [   64.317398] --------------------------------------------
>>> [   64.318230] rmmod/2607 is trying to acquire lock:
>>
>>>
>>> The warning will disappeare by adding
>>> lockdep_set_novalidate_class(&child->d_lock) before calling
>>> simple_empty(child). But I'm not sure It's the right modfication.
>>
>> I'm wondering if we should add a simple_empty_unlocked() that does
>> simple_empty() without taking the lock, to allow us to call
>> spin_lock_nested() on the child. Of course, I don't know how much
>> nesting we allow as it calls the nesting too.
> Do you think we can do this:
> 1. add a new enum type for dentry_d_lock_class:
> enum dentry_d_lock_class
> {
>      DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */
>      DENTRY_D_LOCK_NESTED
missing a ','
>      DENTRY_D_LOCK_NESTED_1 /* maybe another name */
> };
> 2. use the new enum type in simple_empty
> int simple_empty(struct dentry *dentry)
> {
>      spin_lock(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
should be 'spin_lock_nested'
>      list_for_each_entry(child, &dentry->d_subdirs, d_child) {
>          spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED_1);
> }
> 
> If you agree, I'll try to send a patch or patchset(with modification in 
> debugfs_remove_recursive).
sorry about the stupid mistake..

Thanks!
Yu Kuai


      parent reply	other threads:[~2019-11-15  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 13:34 yu kuai
2019-11-13 20:17 ` Steven Rostedt
2019-11-14  2:01   ` yukuai (C)
2019-11-14  2:43     ` Steven Rostedt
2019-11-14  3:20       ` yukuai (C)
2019-11-14  6:59       ` yukuai (C)
2019-11-14 14:34         ` Steven Rostedt
2019-11-15  1:47           ` yukuai (C)
2019-11-15  1:53             ` Steven Rostedt
2019-11-15  2:13               ` yukuai (C)
2019-11-15  1:57             ` yukuai (C) [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=9441c491-3d91-f16b-71fc-aeb658d6c8f0@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=xiexiuqi@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhengbin13@huawei.com \
    /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

all inboxes | Powered by JetHome®