Skip to contentSkip to conversation

FAILED: patch "[PATCH] bcache: return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n" failed to apply to 4.16-stable tree

PATCH In review [email protected] 3 participants 9 messages May 20, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 1c1a2ee1b53b006754073eefc65d2b2cedb5264b Mon Sep 17 00:00:00 2001

From: Coly Li <[email protected]>
Date: Thu, 17 May 2018 23:33:26 +0800
Subject: [PATCH] bcache: return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n

Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()") returns the return value of debugfs_create_dir() to bcache_init(). When CONFIG_DEBUG_FS=n, bch_debug_init() always returns 1 and makes bcache_init() failedi.

This patch makes bch_debug_init() always returns 0 if CONFIG_DEBUG_FS=n, so bcache can continue to work for the kernels which don't have debugfs enanbled.

Changelog:
v4: Add Acked-by from Kent Overstreet.
v3: Use IS_ENABLED(CONFIG_DEBUG_FS) to replace #ifdef DEBUG_FS.
v2: Remove a warning information
v1: Initial version.

Fixes Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()")
drivers/md/bcache/debug.c +3 -1
index 4e63c6f6c04d..d030ce3025a6 100644
@@ -250,7 +250,9 @@ void bch_debug_exit(void)
 
 int __init bch_debug_init(struct kobject *kobj)
 {
-	bcache_debug = debugfs_create_dir("bcache", NULL);
+	if (!IS_ENABLED(CONFIG_DEBUG_FS))
+		return 0;
 
+	bcache_debug = debugfs_create_dir("bcache", NULL);
 	return IS_ERR_OR_NULL(bcache_debug);
 }
#1 lore raw

Hey Greg!

2018-05-20 9:49 GMT+02:00 <[email protected]>:

Quoted 5 lines

The patch below does not apply to the 4.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

I could prepare a back-ported version.

Regards,
Kai

Quoted 47 lines

------------------ original commit in Linus's tree ------------------

From 1c1a2ee1b53b006754073eefc65d2b2cedb5264b Mon Sep 17 00:00:00 2001
From: Coly Li <[email protected]>
Date: Thu, 17 May 2018 23:33:26 +0800
Subject: [PATCH] bcache: return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n

Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()") returns the return value of debugfs_create_dir() to bcache_init(). When CONFIG_DEBUG_FS=n, bch_debug_init() always returns 1 and makes bcache_init() failedi.

This patch makes bch_debug_init() always returns 0 if CONFIG_DEBUG_FS=n, so bcache can continue to work for the kernels which don't have debugfs enanbled.

Changelog:
v4: Add Acked-by from Kent Overstreet.
v3: Use IS_ENABLED(CONFIG_DEBUG_FS) to replace #ifdef DEBUG_FS.
v2: Remove a warning information
v1: Initial version.

Fixes Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()")
drivers/md/bcache/debug.c +3 -1
index 4e63c6f6c04d..d030ce3025a6 100644
@@ -250,7 +250,9 @@ void bch_debug_exit(void)
 
 int __init bch_debug_init(struct kobject *kobj)
 {
-       bcache_debug = debugfs_create_dir("bcache", NULL);
+       if (!IS_ENABLED(CONFIG_DEBUG_FS))
+               return 0;
 
+       bcache_debug = debugfs_create_dir("bcache", NULL);
        return IS_ERR_OR_NULL(bcache_debug);
 }

A message that is not in the archive (sent off-list or not yet received): CAC2ZOYu1fGm2vHyx_Pp_DVsTMUKeYGHO6W_0NrW=M+-Anwr-Qw@mail.gmail.com

author maintainer
#3 lore raw
Quoted 6 lines · Kai Krakow

Hey Greg!

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

I could prepare a back-ported version.

Backported would be good.

Also, the code really is wrong even with this change. No code path should ever do anything different if debugfs is enabled or not, or based on the return value of a debugfs call. No need to check anything here at all, the function should be:

void __init bch_debug_init(void)

{
	bcache_debug = debugfs_create_dir("bcache", NULL);
}

That's it, no checking, and all is fine and good. Any result of a debugfs call can always be fed back into another debugfs call with no harm or errors happening.

thanks,

greg k-h

#4 lore raw

Hi Greg!

2018-05-20 11:04 GMT+02:00 Greg KH <[email protected]>:

Quoted 9 lines · Kai Krakow
Quoted 6 lines

Hey Greg!

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

I could prepare a back-ported version.

Backported would be good.

Currently on the way. I'm not much into kernel development so I can only apply on 4.16.9, reboot, and check if it works. Hope that's okay.

How should it be tagged then? Should I add my "Signed-off-by" or another line?

Should it be sent as a v5 version of the patch?

Quoted 5 lines

Also, the code really is wrong even with this change. No code path should ever do anything different if debugfs is enabled or not, or based on the return value of a debugfs call. No need to check anything here at all, the function should be:

Quoted 8 lines

void __init bch_debug_init(void)

{
        bcache_debug = debugfs_create_dir("bcache", NULL);
}

That's it, no checking, and all is fine and good. Any result of a debugfs call can always be fed back into another debugfs call with no harm or errors happening.

I'll try to figure out if this works, and only then send the patch.

Regards,
Kai

#5 lore raw
Quoted 11 lines · Kai Krakow

Hi Greg!

2018-05-20 11:04 GMT+02:00 Greg KH <[email protected]>:

Quoted 8 lines · Kai Krakow
Quoted 6 lines

Hey Greg!

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

I could prepare a back-ported version.

Quoted 10 lines
Quoted 1 line

Backported would be good.

Currently on the way. I'm not much into kernel development so I can only apply on 4.16.9, reboot, and check if it works. Hope that's okay.

How should it be tagged then? Should I add my "Signed-off-by" or another line?

Should it be sent as a v5 version of the patch?

Hi Kai,

I planed to back port the patch for stable after v4 patch merged into mainline, and good to know this patch is merged into upstream today.

So the simplest way should be back port commit 1c1a2ee1b53b ("bcache:
return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n") for v4.16 stable tree.

If you are working on the back port, then I will step back. Thank you for the quick response, very helpful :-)

Coly Li

Quoted 19 lines
Quoted 5 lines

Also, the code really is wrong even with this change. No code path should ever do anything different if debugfs is enabled or not, or based on the return value of a debugfs call. No need to check anything here at all, the function should be:

Quoted 8 lines

void __init bch_debug_init(void)

{
        bcache_debug = debugfs_create_dir("bcache", NULL);
}

That's it, no checking, and all is fine and good. Any result of a debugfs call can always be fed back into another debugfs call with no harm or errors happening.

I'll try to figure out if this works, and only then send the patch.

Regards,
Kai

#6 lore raw

Hello Coly, Greg!

2018-05-20 11:38 GMT+02:00 Coly Li <[email protected]>:

Quoted 23 lines · Kai Krakow
Quoted 11 lines

Hi Greg!

2018-05-20 11:04 GMT+02:00 Greg KH <[email protected]>:

Quoted 8 lines · Kai Krakow
Quoted 6 lines

Hey Greg!

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

I could prepare a back-ported version.

Quoted 10 lines
Quoted 1 line

Backported would be good.

Currently on the way. I'm not much into kernel development so I can only apply on 4.16.9, reboot, and check if it works. Hope that's okay.

How should it be tagged then? Should I add my "Signed-off-by" or another line?

Should it be sent as a v5 version of the patch?

Quoted 7 lines

Hi Kai,

I planed to back port the patch for stable after v4 patch merged into mainline, and good to know this patch is merged into upstream today.

So the simplest way should be back port commit 1c1a2ee1b53b ("bcache:
return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n") for v4.16 stable tree.

I already did "git cherry-pick" as Greg suggested (with the id of the failed patch).

Quoted 2 lines

If you are working on the back port, then I will step back. Thank you for the quick response, very helpful :-)

Coly, then I could need your review after sending the patch.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Also, the code really is wrong even with this change. No code path should ever do anything different if debugfs is enabled or not, or based on the return value of a debugfs call. No need to check anything here at all, the function should be:

void __init bch_debug_init(void)

{
        bcache_debug = debugfs_create_dir("bcache", NULL);
}
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

That's it, no checking, and all is fine and good. Any result of a debugfs call can always be fed back into another debugfs call with no harm or errors happening.

I'll try to figure out if this works, and only then send the patch.

Thanks,
Kai

author maintainer
#7 lore raw
In reply to Kai Krakow
Quoted 9 lines · Kai Krakow

Hi Greg!

2018-05-20 11:04 GMT+02:00 Greg KH <[email protected]>:

Quoted 6 lines · Kai Krakow
Quoted 5 lines

Hey Greg!

The v1 version applied for me but it shows a compiler warning. I didn't try the newer version yet.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I could prepare a back-ported version.

Backported would be good.

Currently on the way. I'm not much into kernel development so I can only apply on 4.16.9, reboot, and check if it works. Hope that's okay.

How should it be tagged then? Should I add my "Signed-off-by" or another line?

Just like a "normal" patch, yes, signed-off-by is fine. If you do 'git cherry-pick -x -s' it will put the correct information in there.

thanks,

greg k-h

#8 lore raw

PATCH 1/1 bcache: return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n

In reply to [email protected]

From: Coly Li <[email protected]>

Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()") returns the return value of debugfs_create_dir() to bcache_init(). When CONFIG_DEBUG_FS=n, bch_debug_init() always returns 1 and makes bcache_init() failedi.

This patch makes bch_debug_init() always returns 0 if CONFIG_DEBUG_FS=n, so bcache can continue to work for the kernels which don't have debugfs enanbled.

Changelog:
v4: Add Acked-by from Kent Overstreet.
v3: Use IS_ENABLED(CONFIG_DEBUG_FS) to replace #ifdef DEBUG_FS.
v2: Remove a warning information
v1: Initial version.

Fixes Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()")
(cherry picked from commit 1c1a2ee1b53b006754073eefc65d2b2cedb5264b)
---
 drivers/md/bcache/debug.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/md/bcache/debug.c +3 -0
index af89408befe8..b218426a6493 100644
@@ -251,6 +251,9 @@ void bch_debug_exit(void)
 
 int __init bch_debug_init(struct kobject *kobj)
 {
+	if (!IS_ENABLED(CONFIG_DEBUG_FS))
+		return 0;
+
 	debug = debugfs_create_dir("bcache", NULL);
 
 	return IS_ERR_OR_NULL(debug);
Signature · 1 line
2.16.1
Reviewed-by on v1 1/1
#9 lore raw

Re: [PATCH] bcache: return 0 from bch_debug_init() if CONFIG_DEBUG_FS=n

Quoted 17 lines · Kai Krakow

From: Coly Li <[email protected]>

Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()") returns the return value of debugfs_create_dir() to bcache_init(). When CONFIG_DEBUG_FS=n, bch_debug_init() always returns 1 and makes bcache_init() failedi.

This patch makes bch_debug_init() always returns 0 if CONFIG_DEBUG_FS=n, so bcache can continue to work for the kernels which don't have debugfs enanbled.

Changelog:
v4: Add Acked-by from Kent Overstreet.
v3: Use IS_ENABLED(CONFIG_DEBUG_FS) to replace #ifdef DEBUG_FS.
v2: Remove a warning information
v1: Initial version.

Quoted 10 lines
Fixes Commit 539d39eb2708 ("bcache: fix wrong return value in bch_debug_init()")
(cherry picked from commit 1c1a2ee1b53b006754073eefc65d2b2cedb5264b)

Thanks for the back port.

Coly Li

Quoted 19 lines
---
 drivers/md/bcache/debug.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/md/bcache/debug.c +3 -0
index af89408befe8..b218426a6493 100644
@@ -251,6 +251,9 @@ void bch_debug_exit(void)
 
 int __init bch_debug_init(struct kobject *kobj)
 {
+	if (!IS_ENABLED(CONFIG_DEBUG_FS))
+		return 0;
+
 	debug = debugfs_create_dir("bcache", NULL);
 
 	return IS_ERR_OR_NULL(debug);