Warning: Serious NTFS data corruption bug! + Fix! - Was: Re: ntfsCFT - was: Re: 2.6.14-rc4-mm1

From: Anton Altaparmakov
Date: Wed Oct 19 2005 - 06:10:30 EST


Hi,

To all: There is serious data corruption issue with ntfs in
2.6.14-rc4-mm1 (and ntfs 2.1.25 release in general, not just -mm). Fix
is below. Hopefully this is the only bug!

On Tue, 2005-10-18 at 12:48 -0500, Alberto Patino wrote:
> On 10/18/05, Alberto Patino <pato.lukaz@xxxxxxxxx> wrote:
> > Hi Anton, not too lucky doing modifications with soffice to word documents.
> > Saving files is ok but when I reopen the files, the format is lost...
> > I'll try to recover them from Word.exe
> Anton:
> I'm afraid I have bad news, I couldn't boot W2K, I got this message
> translated fom spanish:
>
> STOP: C0000221 { checksum image test incorrect }
>
> Something weird, I edited txt file A with vim, then I edited Word File
> B with soffice, I close it, then I reopened. I lost format so the file
> is not legible but I can see paragraphs from file A in file B!!!!!

I am really sorry about this. )-: You should be able to hopefully fix
windows by booting with the installation CD and going into recovery
console and running chkdsk on the partition. You can also try running
ntfsfix from ntfsprogs and then booting into windows. This may be
sufficient to allow it to do a chkdsk on the partition before it
crashes.

I found a bug that caused corruption of the openoffice document as you
described. The fix is below.

diff -urNp /usr/src/ntfs-2.6-devel/fs/ntfs/file.c ntfs26dev/file.c
--- /usr/src/ntfs-2.6-devel/fs/ntfs/file.c 2005-10-11 15:00:00.000000000 +0100
+++ ntfs26dev/file.c 2005-10-19 11:50:54.859558000 +0100
@@ -787,6 +787,7 @@ retry_remap:
vcn_len = rl[1].vcn - vcn;
lcn_block = lcn << (vol->cluster_size_bits -
blocksize_bits);
+ cdelta = 0;
/*
* If the number of remaining clusters in the
* @pages is smaller or equal to the number of

Thank you very much for testing and I am really sorry it caused the
corruption to your partition. In the future I will make sure to say
"Please only test on test partitions."...

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/