]> git.proxmox.com Git - mirror_zfs.git/blobdiff - module/zfs/zvol.c
Don't enter zvol's rangelock for read bio with size 0
[mirror_zfs.git] / module / zfs / zvol.c
index cc0f1d1e031499a5da287b04ce77eeb491438e2f..5ca4f4670a86f946f19cc95333180aef645c4acb 100644 (file)
@@ -1008,6 +1008,16 @@ zvol_request(struct request_queue *q, struct bio *bio)
                                zvol_write(zvr);
                }
        } else {
+               /*
+                * The SCST driver, and possibly others, may issue READ I/Os
+                * with a length of zero bytes.  These empty I/Os contain no
+                * data and require no additional handling.
+                */
+               if (size == 0) {
+                       BIO_END_IO(bio, 0);
+                       goto out;
+               }
+
                zvr = kmem_alloc(sizeof (zv_request_t), KM_SLEEP);
                zvr->zv = zv;
                zvr->bio = bio;