From owner-freebsd-current@FreeBSD.ORG Sun Dec 19 13:02:53 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A417C16A4CE for ; Sun, 19 Dec 2004 13:02:53 +0000 (GMT) Received: from portpc-design.spb.ru (ns2.portpc-design.spb.ru [195.161.118.232]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3C01E43D2F for ; Sun, 19 Dec 2004 13:02:52 +0000 (GMT) (envelope-from mcsi@mcsi.pp.ru) Received: from [83.237.61.243] (ppp83-237-61-243.pppoe.mtu-net.ru [83.237.61.243]) (authenticated bits=0) by portpc-design.spb.ru (8.13.2/8.13.2) with ESMTP id iBJD2ljL081884; Sun, 19 Dec 2004 16:02:48 +0300 (MSK) (envelope-from mcsi@mcsi.pp.ru) Message-ID: <41C57BF2.2080902@mcsi.pp.ru> Date: Sun, 19 Dec 2004 16:02:42 +0300 From: Maxim Maximov User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041112 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Jean-S=E9bastien_P=E9dron?= References: <12004.1102850755@critter.freebsd.dk> <41BDBE43.1000809@club-internet.fr> In-Reply-To: <41BDBE43.1000809@club-internet.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit cc: Poul-Henning Kamp cc: freebsd-current@freebsd.org Subject: Re: [TEST] NTFS patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Dec 2004 13:02:53 -0000 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