[Devel] [PATCH RHEL8 COMMIT] ploop: Add GFP_NOIO brackets around call_read_iter()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 27 17:00:37 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.4
------>
commit fde304ae7d3b59e6feefee7889652a321198a012
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Jan 27 17:00:37 2021 +0300

    ploop: Add GFP_NOIO brackets around call_read_iter()
    
    Force all allocations not to result in IO.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 2b9d006b3777..39194cb2d7fe 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1,6 +1,7 @@
 #include <linux/buffer_head.h>
 #include <linux/dm-io.h>
 #include <linux/dm-kcopyd.h>
+#include <linux/sched/mm.h>
 #include <linux/init.h>
 #include <linux/vmalloc.h>
 #include <linux/uio.h>
@@ -917,10 +918,10 @@ static void ploop_read_aio_complete(struct kiocb *iocb, long ret, long ret2)
 static void submit_delta_read(struct ploop *ploop, unsigned int level,
 			    unsigned int dst_cluster, struct bio *bio)
 {
+	unsigned int flags, offset;
 	struct ploop_iocb *piocb;
 	struct bio_vec *bvec;
 	struct iov_iter iter;
-	unsigned int offset;
 	struct file *file;
 	loff_t pos;
 	int ret;
@@ -951,7 +952,9 @@ static void submit_delta_read(struct ploop *ploop, unsigned int level,
 	piocb->iocb.ki_flags = IOCB_DIRECT;
 	piocb->iocb.ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
 
+	flags = memalloc_noio_save();
 	ret = call_read_iter(file, &piocb->iocb, &iter);
+	memalloc_noio_restore(flags);
 
 	ploop_read_aio_do_completion(piocb);
 


More information about the Devel mailing list