[Devel] [PATCH RHEL7 COMMIT] fs: ioctl_fiemap must check what filemap_write_and_wait_range returns

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jul 24 12:31:05 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.15
------>
commit 626a0ce8c510703a4d2d979f49cef7f54ea29f07
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Mon Jul 24 13:31:04 2017 +0400

    fs: ioctl_fiemap must check what filemap_write_and_wait_range returns
    
    It's safer to check if filemap_write_and_wait_range succeeded or not.
    
    https://jira.sw.ru/browse/PSBM-68454
    
    Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/ioctl.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index 98f84a7..7f2c7f8 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -203,9 +203,12 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
 		       fieinfo.fi_extents_max * sizeof(struct fiemap_extent)))
 		return -EFAULT;
 
-	if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
-		filemap_write_and_wait_range(inode->i_mapping, fiemap.fm_start,
-					     fiemap.fm_start + len - 1);
+	if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC) {
+		error = filemap_write_and_wait_range(inode->i_mapping,
+				fiemap.fm_start, fiemap.fm_start + len - 1);
+		if (error)
+			return error;
+	}
 
 	error = inode->i_op->fiemap(inode, &fieinfo, fiemap.fm_start, len);
 	fiemap.fm_flags = fieinfo.fi_flags;


More information about the Devel mailing list