[TEST] NTFS patch
Maxim Maximov
mcsi at mcsi.pp.ru
Sun Dec 19 05:02:53 PST 2004
Jean-Sébastien Pédron wrote:
> Poul-Henning Kamp wrote:
>
>> Here is a combined patch for the two problems that's been
>> reported against NTFS after my mount changes.
>>
>> Please test & report.
>
>
> With mmap(2), it doesn't panic() anymore, but the content of a file
> copied with cp(1) is wrong.
>
> Here is a small test case:
>
> ----------------
> # mount
> [...]
> /dev/ad2s1 on /mnt/ntfs (ntfs, local, read-only)
>
> # cat /mnt/ntfs/printenv.pl
> #!c:/Perl/bin/Perl.exe
> ##
> ## printenv -- demo CGI program which just prints its environment
> ##
>
> print "Content-type: text/plain\n\n";
> foreach $var (sort(keys(%ENV))) {
> $val = $ENV{$var};
> $val =~ s|\n|\\n|g;
> $val =~ s|"|\\"|g;
> print "${var}=\"${val}\"\n";
> }
>
> # cp /mnt/ntfs/printenv.pl .
>
> # xxd -l 64 printenv.pl
> 0000000: eb52 904e 5446 5320 2020 2000 0201 0000 .R.NTFS .....
> 0000010: 0000 0000 00f8 0000 3f00 ff00 3f00 0000 ........?...?...
> 0000020: 0000 0000 8000 8000 9920 0600 0000 0000 ......... ......
> 0000030: 2000 0000 0000 0000 4c10 0300 0000 0000 .......L.......
>
> # xxd -l 64 /dev/ad2s1
> 0000000: eb52 904e 5446 5320 2020 2000 0201 0000 .R.NTFS .....
> 0000010: 0000 0000 00f8 0000 3f00 ff00 3f00 0000 ........?...?...
> 0000020: 0000 0000 8000 8000 9920 0600 0000 0000 ......... ......
> 0000030: 2000 0000 0000 0000 4c10 0300 0000 0000 .......L.......
> ----------------
>
> This is with today's CVS. The NTFS file system was prepared under
> Windows 2000 SP4.
>
> In this example, the perl script is ok on the file system, but mmap(2)
> return data from he beginning of the file system, not the file.
>
> From sys/fs/ntfs/ntfs_vnops.c, ntfs_bmap():
>
> if (ap->a_bop != NULL)
> *ap->a_bop = &ntmp->ntm_devvp->v_bufobj;
> if (ap->a_bnp != NULL)
> *ap->a_bnp = ap->a_bn;
>
> The logical block number isn't converted (because it expects
> ntfs_strategy() to be called), and bstrategy() will call directly the
> device strategy function with the wrong block number.
>
> Am I the only one to see this behaviour ?
No. Me too. Kernel as of Dec 17, mounting WinXP partition.
Poul-Henning, are there any new patches to test?
--
Maxim Maximov
More information about the freebsd-current
mailing list