ovl: fix freeze protection bypass in ovl_clone_file_range()
authorAmir Goldstein <amir73il@gmail.com>
Tue, 18 Sep 2018 13:34:33 +0000 (16:34 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 24 Sep 2018 08:54:01 +0000 (10:54 +0200)
Tested by doing clone on overlayfs while upper xfs+reflink is frozen:

  xfs_io -f /ovl/y
                             fsfreeze -f /xfs
  xfs_io> reflink /ovl/x

Before the fix xfs_io enters xfs_reflink_remap_range() and blocks
in xfs_trans_alloc(). After the fix, xfs_io blocks outside xfs code
in ovl_clone_file_range().

Fixes: 8ede205541ff ("ovl: add reflink/copyfile/dedup support")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/file.c

index 986313da0c8895352d2216f0fb0b78d3854064fb..5d1b4b38f7432b6b91e3212fbad5fee87cad76cd 100644 (file)
@@ -461,7 +461,7 @@ static ssize_t ovl_copyfile(struct file *file_in, loff_t pos_in,
                break;
 
        case OVL_CLONE:
-               ret = vfs_clone_file_range(real_in.file, pos_in,
+               ret = do_clone_file_range(real_in.file, pos_in,
                                           real_out.file, pos_out, len);
                break;