Re: [TEST] NTFS patch

From: Jean-Sébastien Pédron <jspedron_at_club-internet.fr>
Date: Mon, 13 Dec 2004 17:07:31 +0100
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

Received on Mon Dec 13 2004 - 15:07:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:24 UTC