public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcache: io.c: Fix check against error_limit in case of io errors
@ 2018-01-12 14:07 Pavel Vazharov
  2018-01-13  3:40 ` Coly Li
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Vazharov @ 2018-01-12 14:07 UTC (permalink / raw)
  To: mlyle, kent.overstreet; +Cc: linux-bcache, linux-kernel, Pavel Vazharov

The actual sysfs io_error_limit value is left shifted IO_ERROR_SHIFT
times before it is stored in the error_limit.
This fixes the un-registering of the cache set when the io_errors reach
the error_limit value.

Signed-off-by: Pavel Vazharov <freakpv@gmail.com>
---
 drivers/md/bcache/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index fac97ec..1ef6ae2 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -93,7 +93,7 @@ void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m)
 						    &ca->io_errors);
 		errors >>= IO_ERROR_SHIFT;
 
-		if (errors < ca->set->error_limit)
+		if (errors < (ca->set->error_limit >> IO_ERROR_SHIFT))
 			pr_err("%s: IO error on %s, recovering",
 			       bdevname(ca->bdev, buf), m);
 		else
-- 
2.7.4

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

* Re: [PATCH] bcache: io.c: Fix check against error_limit in case of io errors
  2018-01-12 14:07 [PATCH] bcache: io.c: Fix check against error_limit in case of io errors Pavel Vazharov
@ 2018-01-13  3:40 ` Coly Li
  2018-01-13  4:22   ` Pavel Vazharov
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2018-01-13  3:40 UTC (permalink / raw)
  To: Pavel Vazharov, mlyle, kent.overstreet; +Cc: linux-bcache, linux-kernel

On 12/01/2018 10:07 PM, Pavel Vazharov wrote:
> The actual sysfs io_error_limit value is left shifted IO_ERROR_SHIFT
> times before it is stored in the error_limit.
> This fixes the un-registering of the cache set when the io_errors reach
> the error_limit value.
> 
> Signed-off-by: Pavel Vazharov <freakpv@gmail.com>
> ---
>  drivers/md/bcache/io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
> index fac97ec..1ef6ae2 100644
> --- a/drivers/md/bcache/io.c
> +++ b/drivers/md/bcache/io.c
> @@ -93,7 +93,7 @@ void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m)
>  						    &ca->io_errors);
>  		errors >>= IO_ERROR_SHIFT;
>  
> -		if (errors < ca->set->error_limit)
> +		if (errors < (ca->set->error_limit >> IO_ERROR_SHIFT))
>  			pr_err("%s: IO error on %s, recovering",
>  			       bdevname(ca->bdev, buf), m);
>  		else
> 

Hi Pavel,

A similar fix is also in my device failure patch set, its name is,
    bcache: set error_limit correctly
The difference is, I remove the bit shift of error_limit.

-- 
Coly Li

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

* Re: [PATCH] bcache: io.c: Fix check against error_limit in case of io errors
  2018-01-13  3:40 ` Coly Li
@ 2018-01-13  4:22   ` Pavel Vazharov
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Vazharov @ 2018-01-13  4:22 UTC (permalink / raw)
  To: Coly Li; +Cc: mlyle, kent.overstreet, linux-bcache, linux-kernel

On Sat, 13 Jan 2018 11:40:54 +0800
Coly Li <i@coly.li> wrote:

> On 12/01/2018 10:07 PM, Pavel Vazharov wrote:
> > The actual sysfs io_error_limit value is left shifted IO_ERROR_SHIFT
> > times before it is stored in the error_limit.
> > This fixes the un-registering of the cache set when the io_errors reach
> > the error_limit value.
> > 
> > Signed-off-by: Pavel Vazharov <freakpv@gmail.com>
> > ---
> >  drivers/md/bcache/io.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
> > index fac97ec..1ef6ae2 100644
> > --- a/drivers/md/bcache/io.c
> > +++ b/drivers/md/bcache/io.c
> > @@ -93,7 +93,7 @@ void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m)
> >  						    &ca->io_errors);
> >  		errors >>= IO_ERROR_SHIFT;
> >  
> > -		if (errors < ca->set->error_limit)
> > +		if (errors < (ca->set->error_limit >> IO_ERROR_SHIFT))
> >  			pr_err("%s: IO error on %s, recovering",
> >  			       bdevname(ca->bdev, buf), m);
> >  		else
> > 
> 
> Hi Pavel,
> 
> A similar fix is also in my device failure patch set, its name is,
>     bcache: set error_limit correctly
> The difference is, I remove the bit shift of error_limit.
> 
> -- 
> Coly Li

Hi Coly,

I see your patch. I think it's better solution.
Originally, I was wondering why the shifting of error_limit is needed
when it's set via sysfs just to shift it back here.

-- 
Pavel Vazharov <freakpv@gmail.com>

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

end of thread, other threads:[~2018-01-13  4:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 14:07 [PATCH] bcache: io.c: Fix check against error_limit in case of io errors Pavel Vazharov
2018-01-13  3:40 ` Coly Li
2018-01-13  4:22   ` Pavel Vazharov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox