Date: Mon, 13 Dec 2004 17:07:31 +0100 From: =?ISO-8859-15?Q?Jean-S=E9bastien_P=E9dron?= <jspedron@club-internet.fr> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: freebsd-current@freebsd.org Subject: Re: [TEST] NTFS patch Message-ID: <41BDBE43.1000809@club-internet.fr> In-Reply-To: <12004.1102850755@critter.freebsd.dk> References: <12004.1102850755@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBvb5Ja+xGJsFYOlMRAv3jAKCYJQLDkBxi4PmcdW0kJtDiscgGHACeJ2Fk
jto5gWs4EduCHhJfwDxRwSc=
=AuE6
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41BDBE43.1000809>
