]> granicus.if.org Git - zfs/commitdiff
Add assertion to catch 0-count page
authorChunwei Chen <tuxoko@gmail.com>
Thu, 24 Apr 2014 03:11:02 +0000 (11:11 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 25 Apr 2014 22:41:19 +0000 (15:41 -0700)
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 <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2277

module/zfs/vdev_disk.c

index cb0cdd7bb56619fcfe51833d1d15a21e7f9d620d..ee14165f5717f55e7a11ed3278a997557032be0c 100644 (file)
@@ -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;