All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chengyu Song <csong84@gatech.edu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Huang Ying <ying.huang@intel.com>,
	LKML <linux-kernel@vger.kernel.org>, LKP ML <lkp@01.org>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>
Subject: Re: [LKP] [ocfs2] e2ac55b6a8e: ocfs2_init:1612 ERROR: Unable to create ocfs2 debugfs root
Date: Mon, 20 Apr 2015 18:55:15 -0400	[thread overview]
Message-ID: <65ED84A1-D203-495E-9151-DEB24317EF9D@gatech.edu> (raw)
In-Reply-To: <20150420141024.1952c240f424f1416102fd86@linux-foundation.org>


> On Apr 20, 2015, at 5:10 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> On Mon, 20 Apr 2015 13:50:38 -0700 Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
>> On Sun, Apr 19, 2015 at 8:45 PM, Chengyu Song <csong84@gatech.edu> wrote:
>>> 
>>> As suggested in the patch,  -19 (-ENODEV) happens when debugfs is not configured (see include/linux/debugfs.h). So if debugfs is necessary for the functionality, in Kconfig, we should either declare it as a dependency, or auto select it.
>> 
>> That makes no sense.
>> 
>> If it used to work before that patch, then this is a regression and
>> the patch needs to be reverted.
>> 
>> Yes, the old code apparently used to set "o2hb_debug_dir" to an error
>> pointer when debugfs was compiled out, but since debugfs was compiled
>> out, that error pointer was probably never actually *used*. So things
>> presumably worked.
>> 
>> Now, it hangs, according to Huang Ying. If so, that's clearly a
>> regression. That means that commit e2ac55b6a8e3 ("ocfs2: incorrect
>> check for debugfs returns") needs to be reverted or fixed.
>> 
>> Andrew?
>> 
> 
> Yes, that one snuck through.  I think a revert would be best at this
> stage, please.
> 
> 
> 
> The debugfs interfaces are exceptional, and not very nice.  My
> understanding of the general idea is:
> 
> - debugfs is just for debug and subsystems shouldn't care whether
>  debugfs is present or not.
> 
> - if a debugfs call fails, the subsystem shouldn't care - don't log
>  it, just ignore it.
> 
> 
> The return semantics from things like debugfs_create_dir() are:
> 
> NULL: debugfs is available, but something went wrong.  We don't
>      tell you what it was.
> 
> -ENODEV: debugfs isn't available
> 
> -Exxx:  I don't think other errnos are supposed to happen.
> 
> 
> So the ofs2 code shouldn't log unless the debugfs calls return NULL. 
> And really, they shouldn't log at all, due to the general debugfs
> philosophy of "errors should be silently ignored".
> 
> 
> 
> A problem with functions like o2hb_debug_init() is that when
> CONFIG_DEBUG_FS=n they will still generate significant amounts of code.
> That's fixable with something like
> 
> --- a/fs/ocfs2/cluster/heartbeat.c~a
> +++ a/fs/ocfs2/cluster/heartbeat.c
> @@ -1312,12 +1312,8 @@ static int o2hb_debug_init(void)
> 	int ret = -ENOMEM;
> 
> 	o2hb_debug_dir = debugfs_create_dir(O2HB_DEBUG_DIR, NULL);
> -	if (IS_ERR_OR_NULL(o2hb_debug_dir)) {
> -		ret = o2hb_debug_dir ?
> -			PTR_ERR(o2hb_debug_dir) : -ENOMEM;
> -		mlog_errno(ret);
> -		goto bail;
> -	}
> +	if (IS_ERR(o2hb_debug_dir))
> +		return 0;
> 
> 	o2hb_debug_livenodes = o2hb_debug_create(O2HB_DEBUG_LIVENODES,
> 						 o2hb_debug_dir,
> 
> Here, the compiler shold see that the `return 0' is always taken (due
> to the -ENODEV) and the rest of the function will be eliminated.
> 
> Or we wrap large pieces of code inside `#ifdef CONFIG_DEBUG_FS'.
> 
> Either way, a cleanup here needs some thought and study.  And better
> testing, plesae.

First of all, I apologize for this incorrect patch. It was created in concern of potential used of the error pointer, but as there is no such use at all, there’s no need for a patch and should be reverted.

This fake problem was discovered by our static checker that compares different fs implementations. And what we found is that there are three ways how debugfs is handled:

- aware of -ENODEV and explicitly check for this error => ubifs
- warp uses with `#ifdef CONFIG_DEBUG_FS’ => btrfs, certain module of ocfs2
- isolate the code and declare dependency on DEBUG_FS in Kconfig => OCFS2_FS_STATS

Lacking enough testing and understanding of actual dependency of ocfs2 on debugfs, especially it uses two different approaches to avoid -ENODEV, the initial patch was mainly for discussing and I didn’t expect it got merged. But since a little more study would reveal there’s no actual use of these error pointers if debugfs is not configured, it’s my fault and I want to apologize again.

Chengyu

WARNING: multiple messages have this Message-ID (diff)
From: Chengyu Song <csong84@gatech.edu>
To: lkp@lists.01.org
Subject: Re: [ocfs2] e2ac55b6a8e: ocfs2_init:1612 ERROR: Unable to create ocfs2 debugfs root
Date: Mon, 20 Apr 2015 18:55:15 -0400	[thread overview]
Message-ID: <65ED84A1-D203-495E-9151-DEB24317EF9D@gatech.edu> (raw)
In-Reply-To: <20150420141024.1952c240f424f1416102fd86@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 4094 bytes --]


> On Apr 20, 2015, at 5:10 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> On Mon, 20 Apr 2015 13:50:38 -0700 Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
>> On Sun, Apr 19, 2015 at 8:45 PM, Chengyu Song <csong84@gatech.edu> wrote:
>>> 
>>> As suggested in the patch,  -19 (-ENODEV) happens when debugfs is not configured (see include/linux/debugfs.h). So if debugfs is necessary for the functionality, in Kconfig, we should either declare it as a dependency, or auto select it.
>> 
>> That makes no sense.
>> 
>> If it used to work before that patch, then this is a regression and
>> the patch needs to be reverted.
>> 
>> Yes, the old code apparently used to set "o2hb_debug_dir" to an error
>> pointer when debugfs was compiled out, but since debugfs was compiled
>> out, that error pointer was probably never actually *used*. So things
>> presumably worked.
>> 
>> Now, it hangs, according to Huang Ying. If so, that's clearly a
>> regression. That means that commit e2ac55b6a8e3 ("ocfs2: incorrect
>> check for debugfs returns") needs to be reverted or fixed.
>> 
>> Andrew?
>> 
> 
> Yes, that one snuck through.  I think a revert would be best at this
> stage, please.
> 
> 
> 
> The debugfs interfaces are exceptional, and not very nice.  My
> understanding of the general idea is:
> 
> - debugfs is just for debug and subsystems shouldn't care whether
>  debugfs is present or not.
> 
> - if a debugfs call fails, the subsystem shouldn't care - don't log
>  it, just ignore it.
> 
> 
> The return semantics from things like debugfs_create_dir() are:
> 
> NULL: debugfs is available, but something went wrong.  We don't
>      tell you what it was.
> 
> -ENODEV: debugfs isn't available
> 
> -Exxx:  I don't think other errnos are supposed to happen.
> 
> 
> So the ofs2 code shouldn't log unless the debugfs calls return NULL. 
> And really, they shouldn't log at all, due to the general debugfs
> philosophy of "errors should be silently ignored".
> 
> 
> 
> A problem with functions like o2hb_debug_init() is that when
> CONFIG_DEBUG_FS=n they will still generate significant amounts of code.
> That's fixable with something like
> 
> --- a/fs/ocfs2/cluster/heartbeat.c~a
> +++ a/fs/ocfs2/cluster/heartbeat.c
> @@ -1312,12 +1312,8 @@ static int o2hb_debug_init(void)
> 	int ret = -ENOMEM;
> 
> 	o2hb_debug_dir = debugfs_create_dir(O2HB_DEBUG_DIR, NULL);
> -	if (IS_ERR_OR_NULL(o2hb_debug_dir)) {
> -		ret = o2hb_debug_dir ?
> -			PTR_ERR(o2hb_debug_dir) : -ENOMEM;
> -		mlog_errno(ret);
> -		goto bail;
> -	}
> +	if (IS_ERR(o2hb_debug_dir))
> +		return 0;
> 
> 	o2hb_debug_livenodes = o2hb_debug_create(O2HB_DEBUG_LIVENODES,
> 						 o2hb_debug_dir,
> 
> Here, the compiler shold see that the `return 0' is always taken (due
> to the -ENODEV) and the rest of the function will be eliminated.
> 
> Or we wrap large pieces of code inside `#ifdef CONFIG_DEBUG_FS'.
> 
> Either way, a cleanup here needs some thought and study.  And better
> testing, plesae.

First of all, I apologize for this incorrect patch. It was created in concern of potential used of the error pointer, but as there is no such use at all, there’s no need for a patch and should be reverted.

This fake problem was discovered by our static checker that compares different fs implementations. And what we found is that there are three ways how debugfs is handled:

- aware of -ENODEV and explicitly check for this error => ubifs
- warp uses with `#ifdef CONFIG_DEBUG_FS’ => btrfs, certain module of ocfs2
- isolate the code and declare dependency on DEBUG_FS in Kconfig => OCFS2_FS_STATS

Lacking enough testing and understanding of actual dependency of ocfs2 on debugfs, especially it uses two different approaches to avoid -ENODEV, the initial patch was mainly for discussing and I didn’t expect it got merged. But since a little more study would reveal there’s no actual use of these error pointers if debugfs is not configured, it’s my fault and I want to apologize again.

Chengyu

  reply	other threads:[~2015-04-20 22:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20  3:25 [LKP] [ocfs2] e2ac55b6a8e: ocfs2_init:1612 ERROR: Unable to create ocfs2 debugfs root Huang Ying
2015-04-20  3:25 ` Huang Ying
2015-04-20  3:45 ` [LKP] " Chengyu Song
2015-04-20  4:32   ` Huang Ying
2015-04-20  4:32     ` Huang Ying
2015-04-20 20:50   ` [LKP] " Linus Torvalds
2015-04-20 20:50     ` Linus Torvalds
2015-04-20 21:10     ` [LKP] " Andrew Morton
2015-04-20 21:10       ` Andrew Morton
2015-04-20 22:55       ` Chengyu Song [this message]
2015-04-20 22:55         ` Chengyu Song

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=65ED84A1-D203-495E-9151-DEB24317EF9D@gatech.edu \
    --to=csong84@gatech.edu \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=mfasheh@suse.com \
    --cc=torvalds@linux-foundation.org \
    --cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.