1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-17 09:06:50 +02:00

copy: do not treat unwritten extents specially: avoid XFS/ext4 data loss

* src/copy.c (extent_copy): Do not treat "unwritten extents" specially.
Otherwise, with a release-candidate 2.6.39-rc3 kernel, XFS or ext4,
when using gold as your linker, and if you forget to run "make check",
you could end up installing files full of zeros instead of the expected
binaries.  For a lot of discussion, see
http://thread.gmane.org/gmane.comp.file-systems.xfs.general/37895
* tests/cp/fiemap-empty: Disable this test.
This commit is contained in:
Jim Meyering
2011-04-20 10:15:15 +02:00
parent 9bcd045f81
commit bef4fa1e1a
2 changed files with 9 additions and 1 deletions
+4 -1
View File
@@ -398,7 +398,10 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
/* Treat an unwritten but allocated extent much like a hole.
I.E. don't read, but don't convert to a hole in the destination,
unless SPARSE_ALWAYS. */
if (scan.ext_info[i].ext_flags & FIEMAP_EXTENT_UNWRITTEN)
/* For now, do not treat FIEMAP_EXTENT_UNWRITTEN specially,
because that (in combination with no sync) would lead to data
loss at least on XFS and ext4 when using 2.6.39-rc3 kernels. */
if (0 && (scan.ext_info[i].ext_flags & FIEMAP_EXTENT_UNWRITTEN))
{
empty_extent = true;
last_ext_len = 0;
+5
View File
@@ -19,6 +19,11 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ cp
# FIXME: enable any part of this test that is still relevant,
# or, if none are relevant (now that cp does not handle unwritten
# extents), just remove the test altogether.
skip_test_ 'disabled for now'
touch fiemap_chk
fiemap_capable_ fiemap_chk ||
skip_test_ 'this file system lacks FIEMAP support'