linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] badblocks: fix wrong return value when badblocks are disabled
@ 2016-04-05 12:59 Artur Paszkiewicz
  2016-04-05 17:37 ` Verma, Vishal L
  2016-04-06  9:26 ` Johannes Thumshirn
  0 siblings, 2 replies; 4+ messages in thread
From: Artur Paszkiewicz @ 2016-04-05 12:59 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, vishal.l.verma, linux-raid, Artur Paszkiewicz

The return value of md_set_badblocks() was inverted when the code was
taken out of md, but the case when badblocks are disabled was left
unchanged. This causes silent ignoring of I/O errors and other
unpredictable behavior on md arrays that do not support badblocks (any
array not using v1.x metadata).

Fixes: 9e0e252a048b ("badblocks: Add core badblock management code")
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
 block/badblocks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/badblocks.c b/block/badblocks.c
index 7be53cb..252f24e 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -147,6 +147,7 @@ EXPORT_SYMBOL_GPL(badblocks_check);
  * Return:
  *  0: success
  *  1: failed to set badblocks (out of space)
+ *  -1: failed to set badblocks (badblocks are disabled)
  */
 int badblocks_set(struct badblocks *bb, sector_t s, int sectors,
 			int acknowledged)
@@ -158,7 +159,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors,
 
 	if (bb->shift < 0)
 		/* badblocks are disabled */
-		return 0;
+		return -1;
 
 	if (bb->shift) {
 		/* round the start down, and the end up */
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] badblocks: fix wrong return value when badblocks are disabled
  2016-04-05 12:59 [PATCH] badblocks: fix wrong return value when badblocks are disabled Artur Paszkiewicz
@ 2016-04-05 17:37 ` Verma, Vishal L
  2016-04-06  9:13   ` Artur Paszkiewicz
  2016-04-06  9:26 ` Johannes Thumshirn
  1 sibling, 1 reply; 4+ messages in thread
From: Verma, Vishal L @ 2016-04-05 17:37 UTC (permalink / raw)
  To: Paszkiewicz, Artur, axboe@kernel.dk
  Cc: linux-raid@vger.kernel.org, linux-block@vger.kernel.org

On Tue, 2016-04-05 at 14:59 +0200, Artur Paszkiewicz wrote:
> The return value of md_set_badblocks() was inverted when the code was
> taken out of md, but the case when badblocks are disabled was left
> unchanged. This causes silent ignoring of I/O errors and other
> unpredictable behavior on md arrays that do not support badblocks (any
> array not using v1.x metadata).
> 
> Fixes: 9e0e252a048b ("badblocks: Add core badblock management code")
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> ---
>  block/badblocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Good find, thanks!

Acked-by: Vishal Verma <vishal.l.verma@intel.com>

Should this also be tagged for stable?

	-Vishal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] badblocks: fix wrong return value when badblocks are disabled
  2016-04-05 17:37 ` Verma, Vishal L
@ 2016-04-06  9:13   ` Artur Paszkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Artur Paszkiewicz @ 2016-04-06  9:13 UTC (permalink / raw)
  To: Verma, Vishal L, axboe@kernel.dk
  Cc: linux-raid@vger.kernel.org, linux-block@vger.kernel.org

On 04/05/2016 07:37 PM, Verma, Vishal L wrote:
> On Tue, 2016-04-05 at 14:59 +0200, Artur Paszkiewicz wrote:
>> The return value of md_set_badblocks() was inverted when the code was
>> taken out of md, but the case when badblocks are disabled was left
>> unchanged. This causes silent ignoring of I/O errors and other
>> unpredictable behavior on md arrays that do not support badblocks (any
>> array not using v1.x metadata).
>>
>> Fixes: 9e0e252a048b ("badblocks: Add core badblock management code")
>> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
>> ---
>>  block/badblocks.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Good find, thanks!
> 
> Acked-by: Vishal Verma <vishal.l.verma@intel.com>
> 
> Should this also be tagged for stable?

Yes, I think it should be, since it affects 4.5.

Artur



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] badblocks: fix wrong return value when badblocks are disabled
  2016-04-05 12:59 [PATCH] badblocks: fix wrong return value when badblocks are disabled Artur Paszkiewicz
  2016-04-05 17:37 ` Verma, Vishal L
@ 2016-04-06  9:26 ` Johannes Thumshirn
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2016-04-06  9:26 UTC (permalink / raw)
  To: Artur Paszkiewicz
  Cc: axboe, linux-block, vishal.l.verma, linux-raid, linux-block-owner

On 2016-04-05 14:59, Artur Paszkiewicz wrote:
> The return value of md_set_badblocks() was inverted when the code was
> taken out of md, but the case when badblocks are disabled was left
> unchanged. This causes silent ignoring of I/O errors and other
> unpredictable behavior on md arrays that do not support badblocks (any
> array not using v1.x metadata).
> 
> Fixes: 9e0e252a048b ("badblocks: Add core badblock management code")
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-06  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 12:59 [PATCH] badblocks: fix wrong return value when badblocks are disabled Artur Paszkiewicz
2016-04-05 17:37 ` Verma, Vishal L
2016-04-06  9:13   ` Artur Paszkiewicz
2016-04-06  9:26 ` Johannes Thumshirn

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).