[TEST] NTFS patch

Jean-Sébastien Pédron jspedron at club-internet.fr
Mon Dec 13 08:07:38 PST 2004


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 ?

Jean-Seb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20041213/31ffa2ce/signature.bin


More information about the freebsd-current mailing list