[Devel] [PATCH RHEL8 COMMIT] fuse: process small sync direct reads synchronously

Konstantin Khorenko khorenko at virtuozzo.com
Fri Apr 23 11:54:54 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.19
------>
commit 8ee12cd127fbc8ca0d8a144838648033b22af882
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Fri Apr 23 11:54:53 2021 +0300

    fuse: process small sync direct reads synchronously
    
    It is useless to process small sync direct reads asynchronously,
    because that optimization works only if we send more than one
    request to userspace fused concurrently.
    
    On the other hand, the patch workarounds a problem reported by AK:
    
    > If a cluster hangs (for any reason), all max_background fuse
    > requests are usually consumed and async io is impossible.
    > Unfortunately it also makes impossible to read .vstorage.info
    > that is necessary to investigate why the cluster hanged.
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/file.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 452ad4dabf51..13c0e453cd6f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3527,6 +3527,11 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	if ((offset + count > i_size) && iov_iter_rw(iter) == WRITE)
 		io->blocking = true;
 
+	/* Process small sync direct reads synchronously */
+	if (iov_iter_rw(iter) != WRITE && is_sync_kiocb(iocb) &&
+	    count <= (FUSE_DEFAULT_MAX_PAGES_PER_REQ << PAGE_SHIFT))
+		io->async = false;
+
 	if (io->async && io->blocking) {
 		/*
 		 * Additional reference to keep io around after


More information about the Devel mailing list