[Devel] [PATCH RHEL7 COMMIT] ploop: Add lockout on discard requests

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 24 18:25:18 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.4
------>
commit 96d323a82a401c946401c01e3fd28c48c2dea587
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri May 24 18:25:16 2019 +0300

    ploop: Add lockout on discard requests
    
    In case of ext4 sends discard, it prohibits to reuse
    the discarded block in its internals. But in case of
    direct using of the device, there is no such protection.
    This patch implements it.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 54790568952a..9bbb2ad02fa2 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2459,7 +2459,8 @@ ploop_entry_request(struct ploop_request * preq)
 			if (delta == top_delta) {
 				/* Block exists in top delta. Good. */
 				if (plo->maintenance_type == PLOOP_MNTN_GROW ||
-				    plo->maintenance_type == PLOOP_MNTN_RELOC) {
+				    plo->maintenance_type == PLOOP_MNTN_RELOC ||
+				    preq->req_rw & REQ_DISCARD) {
 					spin_lock_irq(&plo->lock);
 					ploop_add_lockout(preq, 0);
 					spin_unlock_irq(&plo->lock);



More information about the Devel mailing list