aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2014-04-24 11:11:02 +0800
committerBrian Behlendorf <[email protected]>2014-04-25 15:41:19 -0700
commit17584980b9ca6fc1aecb520ffc520cd306624854 (patch)
tree51800e334d0c8a934f3e736ec8ee5e61d225c097
parentcdf37f0c596bbdca8464ccf99482725507724fae (diff)
Add assertion to catch 0-count page
Some network related block device uses tcp_sendpage, which doesn't behave well when using 0-count page. Add assertion to catch them. This has a runtime dependency on: zfsonlinux/spl@ae16ed9 Fix crash when using ZFS on Ceph rbd Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2277
-rw-r--r--module/zfs/vdev_disk.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
index cb0cdd7bb..ee14165f5 100644
--- a/module/zfs/vdev_disk.c
+++ b/module/zfs/vdev_disk.c
@@ -484,6 +484,13 @@ bio_map(struct bio *bio, void *bio_ptr, unsigned int bio_size)
else
page = virt_to_page(bio_ptr);
+ /*
+ * Some network related block device uses tcp_sendpage, which
+ * doesn't behave well when using 0-count page, this is a
+ * safety net to catch them.
+ */
+ ASSERT3S(page_count(page), >, 0);
+
if (bio_add_page(bio, page, size, offset) != size)
break;