From 17584980b9ca6fc1aecb520ffc520cd306624854 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 24 Apr 2014 11:11:02 +0800 Subject: 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 Signed-off-by: Brian Behlendorf Closes #2277 --- module/zfs/vdev_disk.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'module') 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; -- cgit v1.2.3