summaryrefslogtreecommitdiffstats
path: root/dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@fedoraproject.org>2014-12-18 10:06:55 -0500
committerJosh Boyer <jwboyer@fedoraproject.org>2014-12-18 11:29:54 -0500
commitf86e26e1860eaa3f8b6e400ea2ddb4e0fddcead1 (patch)
tree689d39fe27b65c477552fdafb91d617c4e1666ad /dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch
parent303b0b72c0075f329312e1abd9107af2b63d8cf2 (diff)
downloadkernel-f86e26e1860eaa3f8b6e400ea2ddb4e0fddcead1.tar.gz
kernel-f86e26e1860eaa3f8b6e400ea2ddb4e0fddcead1.tar.xz
kernel-f86e26e1860eaa3f8b6e400ea2ddb4e0fddcead1.zip
Fix dm-cache crash (rhbz 1168434)
Diffstat (limited to 'dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch')
-rw-r--r--dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch b/dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch
new file mode 100644
index 00000000..05a6ebdc
--- /dev/null
+++ b/dm-cache-fix-spurious-cell_defer-when-dealing-with-p.patch
@@ -0,0 +1,40 @@
+From: Joe Thornber <ejt@redhat.com>
+Date: Fri, 28 Nov 2014 09:48:25 +0000
+Subject: [PATCH] dm cache: fix spurious cell_defer when dealing with partial
+ block at end of device
+
+We never bother caching a partial block that is at the back end of the
+origin device. No cell ever gets locked, but the calling code was
+assuming it was and trying to release it.
+
+Now the code only releases if the cell has been set to a non NULL
+value.
+
+Signed-off-by: Joe Thornber <ejt@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Cc: stable@vger.kernel.org
+---
+ drivers/md/dm-cache-target.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
+index 387b93d81138..da496cfb458d 100644
+--- a/drivers/md/dm-cache-target.c
++++ b/drivers/md/dm-cache-target.c
+@@ -2554,11 +2554,11 @@ static int __cache_map(struct cache *cache, struct bio *bio, struct dm_bio_priso
+ static int cache_map(struct dm_target *ti, struct bio *bio)
+ {
+ int r;
+- struct dm_bio_prison_cell *cell;
++ struct dm_bio_prison_cell *cell = NULL;
+ struct cache *cache = ti->private;
+
+ r = __cache_map(cache, bio, &cell);
+- if (r == DM_MAPIO_REMAPPED) {
++ if (r == DM_MAPIO_REMAPPED && cell) {
+ inc_ds(cache, bio, cell);
+ cell_defer(cache, cell, false);
+ }
+--
+2.1.0
+