]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
During filesystem creation with -d option files copied from given
authorArtem Blagodarenko <artem.blagodarenko@seagate.com>
Tue, 31 Jan 2017 02:51:14 +0000 (21:51 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 31 Jan 2017 02:51:14 +0000 (21:51 -0500)
directory. If supported, FS_IOC_FIEMAP ioctl is used to get file
extents. For empty file fm_mapped_extents is 0 and no error code
is returned, because this is not fail situation.

Without this patch errno from previous operation is returned and
successful FS_IOC_FIEMAP ioctl call for empty file is interpreted
as error.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@seagate.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
misc/create_inode.c

index 5122e56cfb13d28ab381c67db3b9018f4a2d5e8c..ae22ff6fe43e1a3134793cf786072c6c80321a4e 100644 (file)
@@ -510,10 +510,11 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
                if (err < 0 && (errno == EOPNOTSUPP || errno == ENOTTY)) {
                        err = EXT2_ET_UNIMPLEMENTED;
                        goto out;
-               } else if (err < 0 || fiemap_buf->fm_mapped_extents == 0) {
+               } else if (err < 0) {
                        err = errno;
                        goto out;
-               }
+               } else if (fiemap_buf->fm_mapped_extents == 0)
+                       goto out;
                for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
                     i++, ext++) {
                        err = copy_file_range(fs, fd, e2_file, ext->fe_logical,