mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
zvol: Fix blk-mq sync
The zvol blk-mq codepaths would erroneously send FLUSH and TRIM commands down the read codepath, rather than write. This fixes the issue, and updates the zvol_misc_fua test to verify that sync writes are actually happening. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Ameer Hamza <ahamza@ixsystems.com> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #17761 Closes #17765
This commit is contained in:
committed by
Brian Behlendorf
parent
a9bcf4faf3
commit
9079f986ae
@@ -484,7 +484,28 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
|
||||
fstrans_cookie_t cookie = spl_fstrans_mark();
|
||||
uint64_t offset = io_offset(bio, rq);
|
||||
uint64_t size = io_size(bio, rq);
|
||||
int rw = io_data_dir(bio, rq);
|
||||
int rw;
|
||||
|
||||
if (rq != NULL) {
|
||||
/*
|
||||
* Flush & trim requests go down the zvol_write codepath. Or
|
||||
* more specifically:
|
||||
*
|
||||
* If request is a write, or if it's op_is_sync() and not a
|
||||
* read, or if it's a flush, or if it's a discard, then send the
|
||||
* request down the write path.
|
||||
*/
|
||||
if (op_is_write(rq->cmd_flags) ||
|
||||
(op_is_sync(rq->cmd_flags) && req_op(rq) != REQ_OP_READ) ||
|
||||
req_op(rq) == REQ_OP_FLUSH ||
|
||||
op_is_discard(rq->cmd_flags)) {
|
||||
rw = WRITE;
|
||||
} else {
|
||||
rw = READ;
|
||||
}
|
||||
} else {
|
||||
rw = bio_data_dir(bio);
|
||||
}
|
||||
|
||||
if (unlikely(zv->zv_flags & ZVOL_REMOVING)) {
|
||||
zvol_end_io(bio, rq, SET_ERROR(ENXIO));
|
||||
|
||||
Reference in New Issue
Block a user