[Devel] [PATCH hci-8.1 2/2] dm-zero-rq: drop flushes, discards and write zeroes instead of failing them

Denis V. Lunev den at openvz.org
Wed Oct 28 15:31:29 MSK 2026


From: Denis V. Lunev <den at openvz.org>

zero-rq kills every request that is not a read or a write. Requests
queued against the previous table and dispatched to zero-rq after a
table swap therefore fail, a flush with an error returned to the
syncing task and a discard with an I/O error in the log:

  I/O error, dev dm-0, sector 0 op 0x3:(DISCARD) flags 0x4800

ploop reloads a released device to zero-rq precisely to keep the file
system on it from seeing such errors.

Complete flushes, discards and write zeroes as writes are completed.
Reads already return zeros, so all of them are honoured. Drop
num_discard_bios from the constructor: it only matters to bio-based
targets and to targets that pass discards through to a device, and
zero-rq is neither, so "silently drop discards" above it never held.

https://virtuozzo.atlassian.net/browse/VSTOR-152097
Feature: cbt: changed block tracking (for backup)
Signed-off-by: Denis V. Lunev <den at openvz.org>
---
 drivers/md/dm-zero-rq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-zero-rq.c b/drivers/md/dm-zero-rq.c
index 4f09266ff5ed..315ef8c930b3 100644
--- a/drivers/md/dm-zero-rq.c
+++ b/drivers/md/dm-zero-rq.c
@@ -24,11 +24,6 @@ static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		return -EINVAL;
 	}
 
-	/*
-	 * Silently drop discards, avoiding -EOPNOTSUPP.
-	 */
-	ti->num_discard_bios = 1;
-
 	return 0;
 }
 
@@ -47,7 +42,10 @@ static int zero_clone_and_map_rq(struct dm_target *ti, struct request *rq,
 
 		break;
 	case REQ_OP_WRITE:
-		/* writes get silently dropped */
+	case REQ_OP_FLUSH:
+	case REQ_OP_DISCARD:
+	case REQ_OP_WRITE_ZEROES:
+		/* writes of any kind get silently dropped */
 		break;
 	default:
 		return DM_MAPIO_KILL;
-- 
2.53.0



More information about the Devel mailing list