[Devel] [PATCH RHEL7 COMMIT] ploop: Sanity in kaio_open()

Vasily Averin vvs at virtuozzo.com
Wed Nov 24 14:50:14 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.42.2.vz7.184.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.42.2.vz7.184.4
------>
commit c65cfe6f83d9cd15d5286defd86a2e4ce375e520
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Nov 24 14:50:14 2021 +0300

    ploop: Sanity in kaio_open()
    
    1)Check for kaio_invalidate_cache() return value.
    2)Add sync for the case when userspace skipped
    to do that (if userspace skipped, kaio_invalidate_cache()
    will fail).
    
    https://jira.sw.ru/browse/PSBM-135881
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index bc245ea..e249527 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -962,9 +962,14 @@ static int kaio_open(struct ploop_io * io)
 	io->files.inode = io->files.mapping->host;
 	io->files.bdev = io->files.inode->i_sb->s_bdev;
 
+	err = io->ops->sync(io);
+	if (err)
+		return err;
+
 	mutex_lock(&io->files.inode->i_mutex);
-	kaio_invalidate_cache(io);
-	err = ploop_kaio_open(file, delta->flags & PLOOP_FMT_RDONLY);
+	err = kaio_invalidate_cache(io);
+	if (!err)
+		err = ploop_kaio_open(file, delta->flags & PLOOP_FMT_RDONLY);
 	mutex_unlock(&io->files.inode->i_mutex);
 
 	if (err)


More information about the Devel mailing list