Skip to contentSkip to conversation

bcache: io.c: Fix check against error_limit in case of io errors

PATCH In review Pavel Vazharov 2 participants 3 messages Jan 12, 2018 – Jan 13, 2018 bcache (block layer cache)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcache: io.c: Fix check against error_limit in case of io errors

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.

---
 drivers/md/bcache/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/io.c +1 -1
index fac97ec..1ef6ae2 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 16 lines · 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.

---
 drivers/md/bcache/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/io.c +0 -0
index fac97ec..1ef6ae2 100644

drivers/md/bcache/io.c void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m) · line 99

Quoted 8 lines
drivers/md/bcache/io.c +1 -1
@@ -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.

Signature · 1 line
Coly Li
#2 lore raw
Quoted 28 lines · On Sat, 13 Jan 2018 11:40:54 +0800 Coly Li <[email protected]> wrote:
Quoted 16 lines · 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.

---
 drivers/md/bcache/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/io.c +0 -0
index fac97ec..1ef6ae2 100644

drivers/md/bcache/io.c void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m) · line 99

Quoted 8 lines
drivers/md/bcache/io.c +1 -1
@@ -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,

Quoted 6 lines

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.

Signature · 1 line
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.

Signature · 1 line
Pavel Vazharov <[email protected]>