@@ -337,16 +337,14 @@ zvol_discard(zv_request_t *zvr)
337
337
}
338
338
339
339
/*
340
- * Align the request to volume block boundaries when a secure erase is
341
- * not required. This will prevent dnode_free_range() from zeroing out
342
- * the unaligned parts which is slow (read-modify-write) and useless
343
- * since we are not freeing any space by doing so.
340
+ * Align the request to volume block boundaries. This will prevent
341
+ * dnode_free_range() from zeroing out the unaligned parts which is
342
+ * slow (read-modify-write) and useless since we are not freeing any
343
+ * space by doing so.
344
344
*/
345
- if (!io_is_secure_erase (bio , rq )) {
346
- start = P2ROUNDUP (start , zv -> zv_volblocksize );
347
- end = P2ALIGN_TYPED (end , zv -> zv_volblocksize , uint64_t );
348
- size = end - start ;
349
- }
345
+ start = P2ROUNDUP (start , zv -> zv_volblocksize );
346
+ end = P2ALIGN_TYPED (end , zv -> zv_volblocksize , uint64_t );
347
+ size = end - start ;
350
348
351
349
if (start >= end )
352
350
goto unlock ;
@@ -467,6 +465,18 @@ zvol_read_task(void *arg)
467
465
zv_request_task_free (task );
468
466
}
469
467
468
+ /*
469
+ * Verify the request is one of the IO types we can process (read, write, sync,
470
+ * trim).
471
+ */
472
+ inline static boolean_t
473
+ zvol_rq_type_is_supported (struct request * rq ) {
474
+ return (op_is_write (rq -> cmd_flags ) ||
475
+ req_op (rq ) == REQ_OP_READ ||
476
+ req_op (rq ) == REQ_OP_FLUSH ||
477
+ op_is_sync (rq -> cmd_flags ) ||
478
+ op_is_discard (rq -> cmd_flags ));
479
+ }
470
480
471
481
/*
472
482
* Process a BIO or request
@@ -487,6 +497,14 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
487
497
int rw ;
488
498
489
499
if (rq != NULL ) {
500
+ if (unlikely (!zvol_rq_type_is_supported (rq ))) {
501
+ zfs_dbgmsg ("Unsupported zvol IO, op=%d, cmd=0x%x" ,
502
+ req_op (rq ), rq -> cmd_flags );
503
+ ASSERT (zvol_rq_type_is_supported (rq ));
504
+ zvol_end_io (bio , rq , SET_ERROR (ENOTSUPP ));
505
+ goto out ;
506
+ }
507
+
490
508
/*
491
509
* Flush & trim requests go down the zvol_write codepath. Or
492
510
* more specifically:
@@ -610,7 +628,7 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
610
628
* interfaces lack this functionality (they block waiting for
611
629
* the i/o to complete).
612
630
*/
613
- if (io_is_discard (bio , rq ) || io_is_secure_erase ( bio , rq ) ) {
631
+ if (io_is_discard (bio , rq )) {
614
632
if (force_sync ) {
615
633
zvol_discard (& zvr );
616
634
} else {
0 commit comments