Home Home > GIT Browse
diff options
authorColy Li <colyli@suse.de>2017-07-10 21:35:20 +0800
committerTakashi Iwai <tiwai@suse.de>2017-08-07 11:57:49 +0200
commit8775072499c3d0ab8daa6b3ba4de2ca5ae08c1b6 (patch)
parent71459651438af9cd03e3a00b59ad3e7943ad5f9d (diff)
bcache: only recovery I/O error for writethrough mode
2 files changed, 53 insertions, 0 deletions
diff --git a/patches.suse/0001-bcache-only-recovery-I-O-error-for-writethrough-mode.patch b/patches.suse/0001-bcache-only-recovery-I-O-error-for-writethrough-mode.patch
new file mode 100644
index 0000000000..6f322060e6
--- /dev/null
+++ b/patches.suse/0001-bcache-only-recovery-I-O-error-for-writethrough-mode.patch
@@ -0,0 +1,52 @@
+From: Coly Li <colyli@suse.de>
+Date: Mon, 10 Jul 2017 18:44:49 +0800
+Subject: [PATCH] bcache: only recovery I/O error for writethrough mode
+Patch-mainline: Not yet, under review by upstream
+References: bsc#1043652
+If a read bio to cache device gets failed, bcache will try to recovery it
+by forward the read bio to backing device. If backing device responses
+read request successfully then the bio contains data from backing device
+will be returned to uppper layer.
+The recovery effort in cached_dev_read_error() is not correct, and there
+is report that corrupted data may returned when a dirty cache device goes
+offline during reading I/O.
+For writeback cache mode, before dirty data are wrote back to backing
+device, data blocks on backing device are not updated and consistent. If
+a dirty cache device dropped and a read bio gets failed, bcache will
+return its stale version from backing device. This is mistaken behavior
+that applications don't expected, especially for data base workload.
+This patch fixes the issue by only permit recoverable I/O when cached
+device is in writethough mode, and s->recoverable is set. For other cache
+mode, recovery I/O failure by reading backing device does not make sense,
+bache just simply returns -EIO immediately.
+Reported-by: Arne Wolf <awolf@lenovo.com>
+Signed-off-by: Coly Li <colyli@suse.de>
+ drivers/md/bcache/request.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
+index 019b3df9f1c6..6edacac9b00d 100644
+--- a/drivers/md/bcache/request.c
++++ b/drivers/md/bcache/request.c
+@@ -702,8 +702,11 @@ static void cached_dev_read_error(struct closure *cl)
+ {
+ struct search *s = container_of(cl, struct search, cl);
+ struct bio *bio = &s->bio.bio;
++ struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
++ unsigned mode = cache_mode(dc, NULL);
+- if (s->recoverable) {
++ if (s->recoverable &&
+ /* Retry from the backing device: */
+ trace_bcache_read_retry(s->orig_bio);
diff --git a/series.conf b/series.conf
index 3305336c79..201cd15186 100644
--- a/series.conf
+++ b/series.conf
@@ -6852,6 +6852,7 @@
# bsc#1038078
# bsc#1043652
+ patches.suse/0001-bcache-only-recovery-I-O-error-for-writethrough-mode.patch
# bsc#1018446