[Devel] [PATCH RHEL7 COMMIT] ext4/mfsync: do not BUG_ON on wrong set of files

Konstantin Khorenko khorenko at virtuozzo.com
Thu Dec 14 21:07:03 MSK 2023


The commit is pushed to "branch-rh7-3.10.0-1160.99.1.vz7.211.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.99.1.vz7.211.3
------>
commit 990254121b5f02349699cb9af45a0c85703cf3a2
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Mon Dec 4 13:34:24 2023 +0200

    ext4/mfsync: do not BUG_ON on wrong set of files
    
    mfsync(...) can not sync files from different filesystems if
    passed such set of files it BUG_ONs.
    Instead of BUG return -EINVAL.
    
    https://pmc.acronis.work/browse/VSTOR-78331
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
---
 fs/ext4/fsync.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index ef1b88177220..45a0522496bd 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -180,7 +180,10 @@ int ext4_sync_files(struct file **files, unsigned int *flags, unsigned int nr_fi
 		struct address_space * mapping = files[i]->f_mapping;
 		struct inode *inode = mapping->host;
 
-		BUG_ON(sb != inode->i_sb);
+		if (sb != inode->i_sb) {
+			err = -EINVAL;
+			goto out;
+		}
 		if (!mapping->nrpages)
 			continue;
 


More information about the Devel mailing list