• Amir Goldstein's avatar
    vfs: fix vfs_clone_file_range() for overlayfs files · b335e9d9
    Amir Goldstein authored
    With overlayfs, it is wrong to compare file_inode(inode)->i_sb
    of regular files with those of non-regular files, because the
    former reference the real (upper/lower) sb and the latter reference
    the overlayfs sb.
    
    Move the test for same super block after the sanity tests for
    clone range of directory and non-regular file.
    
    This change fixes xfstest generic/157, which returned EXDEV instead
    of EISDIR/EINVAL in the following test cases over overlayfs:
    
      echo "Try to reflink a dir"
      _reflink_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
    
      echo "Try to reflink a device"
      _reflink_range $testdir1/dev1 0 $testdir1/file2 0 $blksz
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    b335e9d9
read_write.c 40.6 KB