NetBSD Problem Report #45191
From tron@zhadum.org.uk Sat Jul 30 11:26:56 2011
Return-Path: <tron@zhadum.org.uk>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 92F5663BAC3
for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Jul 2011 11:26:56 +0000 (UTC)
Message-Id: <20110730112652.DF1C5F9D4B@lyssa.zhadum.org.uk>
Date: Sat, 30 Jul 2011 12:26:52 +0100 (BST)
From: tron@zhadum.org.uk
Reply-To: tron@zhadum.org.uk
To: gnats-bugs@gnats.NetBSD.org
Subject: newfs_v7fs(8) doesn't work on a disk partition
X-Send-Pr-Version: 3.95
>Number: 45191
>Category: bin
>Synopsis: newfs_v7fs(8) doesn't work on a disk partition
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 30 11:30:00 +0000 2011
>Closed-Date: Fri Aug 26 06:53:49 +0000 2011
>Last-Modified: Fri Aug 26 06:53:49 +0000 2011
>Originator: tron@zhadum.org.uk
>Release: NetBSD 5.99.55 2011-07-30 sources
>Organization:
Matthias Scheler http://zhadum.org.uk/
>Environment:
System: NetBSD lyssa.zhadum.org.uk 5.99.55 NetBSD 5.99.55 (LYSSA) #0: Sat Jul 30 10:49:54 BST 2011 tron@lyssa.zhadum.org.uk:/src/sys/compile/LYSSA i386
Architecture: i386
Machine: i386
>Description:
I'm trying to create a V7FS file-system on a (virtual) hard disk:
tron@lyssa:~#disklabel wd1
# /dev/rwd1d:
type: ESDI
disk: VMware Virtual I
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 8322
total sectors: 8388608
rpm: 7200
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg/sgs]
c: 8388545 63 unused 0 0 # (Cyl. 0*- 8322*)
d: 8388608 0 unused 0 0 # (Cyl. 0 - 8322*)
e: 8388545 63 Version 7 # (Cyl. 0*- 8322*)
But the "newfs_v7fs" command fails with a bunch of error messages:
tron@lyssa:~#newfs_v7fs /dev/rwd1e
newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
newfs_v7fs: sector=1
: Read-only file system
newfs_v7fs: Can't write back superblock.: Input/output error
newfs_v7fs: Input/output error
>How-To-Repeat:
1.) Create a 4GB System 7 partition.
2.) Try to use "newfs_v7fs" on it.
>Fix:
None provided.
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
Date: Mon, 1 Aug 2011 06:20:04 +0000
On Sat, Jul 30, 2011 at 11:30:01AM +0000, tron@zhadum.org.uk wrote:
> tron@lyssa:~#newfs_v7fs /dev/rwd1e
> newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
> newfs_v7fs: sector=1
> : Read-only file system
> newfs_v7fs: Can't write back superblock.: Input/output error
> newfs_v7fs: Input/output error
Is this because it's a partition or because it's too big to mmap?
(Does a 512M partition work?)
Of course, mmap'ing disk images is kind of silly...
--
David A. Holland
dholland@netbsd.org
From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
Date: Tue, 2 Aug 2011 11:22:00 +0100
On Mon, Aug 01, 2011 at 06:25:02AM +0000, David Holland wrote:
> The following reply was made to PR bin/45191; it has been noted by GNATS.
>
> From: David Holland <dholland-bugs@netbsd.org>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
> Date: Mon, 1 Aug 2011 06:20:04 +0000
>
> On Sat, Jul 30, 2011 at 11:30:01AM +0000, tron@zhadum.org.uk wrote:
> > tron@lyssa:~#newfs_v7fs /dev/rwd1e
> > newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
> > newfs_v7fs: sector=1
> > : Read-only file system
> > newfs_v7fs: Can't write back superblock.: Input/output error
> > newfs_v7fs: Input/output error
>
> Is this because it's a partition or because it's too big to mmap?
> (Does a 512M partition work?)
It works with a 46.4MB partition:
tron@lyssa:~tron#newfs_v7fs /dev/rwd0e
newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
I can mount the resulting file-system and write files to it.
> Of course, mmap'ing disk images is kind of silly...
I would call it optimistic. :-)
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
From: UCHIYAMA Yasushi <uch@vnop.net>
To: tron@zhadum.org.uk
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
Date: Tue, 02 Aug 2011 20:15:52 +0900 (JST)
From: Matthias Scheler <tron@zhadum.org.uk>
Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
Date: Tue, 2 Aug 2011 11:22:00 +0100
> On Mon, Aug 01, 2011 at 06:25:02AM +0000, David Holland wrote:
> > The following reply was made to PR bin/45191; it has been noted by GNATS.
> >
> > From: David Holland <dholland-bugs@netbsd.org>
> > To: gnats-bugs@NetBSD.org
> > Cc:
> > Subject: Re: bin/45191: newfs_v7fs(8) doesn't work on a disk partition
> > Date: Mon, 1 Aug 2011 06:20:04 +0000
> >
> > On Sat, Jul 30, 2011 at 11:30:01AM +0000, tron@zhadum.org.uk wrote:
> > > tron@lyssa:~#newfs_v7fs /dev/rwd1e
> > > newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
> > > newfs_v7fs: sector=1
> > > : Read-only file system
> > > newfs_v7fs: Can't write back superblock.: Input/output error
> > > newfs_v7fs: Input/output error
> >
> > Is this because it's a partition or because it's too big to mmap?
> > (Does a 512M partition work?)
>
> It works with a 46.4MB partition:
>
> tron@lyssa:~tron#newfs_v7fs /dev/rwd0e
> newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
>
> I can mount the resulting file-system and write files to it.
>
> > Of course, mmap'ing disk images is kind of silly...
>
> I would call it optimistic. :-)
>
> Kind regards
>
> --
> Matthias Scheler http://zhadum.org.uk/
>
16 partitions:
# size offset fstype [fsize bsize cpg/sgs]
c: 8388545 63 unused 0 0 # (Cyl. 0*- 8322*)
d: 8388608 0 unused 0 0 # (Cyl. 0 - 8322*)
e: 8388545 63 Version 7 # (Cyl. 0*- 8322*)
disklabel location is LABELSECTOR(it is 1) of c-partition. and v7fs
superblock sector is 1. so conflicts.
16 partitions:
# size offset fstype [fsize bsize cpg/sgs]
c: 8388545 63 unused 0 0 # (Cyl. 0*- 8322*)
d: 8388608 0 unused 0 0 # (Cyl. 0 - 8322*)
e: 8388543 65 Version 7
Should work. Some warning message should add to newfs_v7fs..
Remove mmap routines?
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/45191 CVS commit: src/sys/fs/v7fs
Date: Wed, 3 Aug 2011 16:21:52 +0000
Module Name: src
Committed By: dholland
Date: Wed Aug 3 16:21:52 UTC 2011
Modified Files:
src/sys/fs/v7fs: v7fs_io_user.c
Log Message:
Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_io_user.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 03 Aug 2011 16:25:32 +0000
State-Changed-Why:
please test
From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191 (newfs_v7fs(8) doesn't work on a disk partition)
Date: Wed, 3 Aug 2011 19:09:47 +0100
On Wed, Aug 03, 2011 at 04:25:33PM +0000, dholland@NetBSD.org wrote:
> Synopsis: newfs_v7fs(8) doesn't work on a disk partition
>
> State-Changed-From-To: open->feedback
> State-Changed-By: dholland@NetBSD.org
> State-Changed-When: Wed, 03 Aug 2011 16:25:32 +0000
> State-Changed-Why:
> please test
Yes, it works fine now on the setup:
tron@lyssa:/usr/src/sbin/newfs_v7fs#newfs_v7fs /dev/rwd1e
newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
tron@lyssa:/usr/src/sbin/newfs_v7fs#
It would be nice to get rid of the mmap(2) error message. And a progress
report would be nice as "newfs_v7fs" doesn't seem to be particular fast.
But neither of those is strictly related to this PR.
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191 (newfs_v7fs(8) doesn't work on a disk partition)
Date: Thu, 4 Aug 2011 16:06:56 +0000
On Wed, Aug 03, 2011 at 06:10:05PM +0000, Matthias Scheler wrote:
> tron@lyssa:/usr/src/sbin/newfs_v7fs#newfs_v7fs /dev/rwd1e
> newfs_v7fs: mmap failed. use direct I/O.: Invalid argument
> tron@lyssa:/usr/src/sbin/newfs_v7fs#
>
> It would be nice to get rid of the mmap(2) error message.
Indeed. However, it doesn't fully make sense: if the multiplication
for the length overflows, you should get a small page-aligned number,
mmap should succeed but give only a small mapping, and you should get
SIGSEGV afterwards when writing past the end of that mapping.
If the multiplication doesn't overflow but the size is too large to
map in 4G, I would think you ought to get ENOMEM. However, mmap(2)
doesn't seem to document an error for this case.
The cases it does document for EINVAL do not apply...
Also, now it's looking to me like the change I made yesterday
shouldn't have had any effect at all, so I really don't get it.
> nd a progress report would be nice as "newfs_v7fs" doesn't seem
> to be particular fast. But neither of those is strictly related to
> this PR.
-P?
--
David A. Holland
dholland@netbsd.org
State-Changed-From-To: feedback->open
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 05 Aug 2011 06:32:05 +0000
State-Changed-Why:
Feedback was provided.
From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191 (newfs_v7fs(8) doesn't work on a disk partition)
Date: Fri, 5 Aug 2011 07:33:34 +0100
On Thu, Aug 04, 2011 at 04:10:05PM +0000, David Holland wrote:
> Also, now it's looking to me like the change I made yesterday
> shouldn't have had any effect at all, so I really don't get it.
I just realized I made one more change:
I changed the offset of the partition to 65 to avoid conflicts with
the superblock as suggested by UCHIYAMA-san.
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191 (newfs_v7fs(8) doesn't work on a disk partition)
Date: Wed, 10 Aug 2011 14:12:56 +0000
On Fri, Aug 05, 2011 at 06:35:02AM +0000, Matthias Scheler wrote:
>> Also, now it's looking to me like the change I made yesterday
>> shouldn't have had any effect at all, so I really don't get it.
>
> I just realized I made one more change:
> I changed the offset of the partition to 65 to avoid conflicts with
> the superblock as suggested by UCHIYAMA-san.
Could you try reverting my change and see if that affects the
behavior? (I don't have a 32-bit test setup any more...)
In the meantime the warning message about mmap has been removed, btw.
--
David A. Holland
dholland@netbsd.org
From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45191 (newfs_v7fs(8) doesn't work on a disk partition)
Date: Fri, 26 Aug 2011 07:48:15 +0100
On Wed, Aug 10, 2011 at 02:15:04PM +0000, David Holland wrote:
> On Fri, Aug 05, 2011 at 06:35:02AM +0000, Matthias Scheler wrote:
> >> Also, now it's looking to me like the change I made yesterday
> >> shouldn't have had any effect at all, so I really don't get it.
> >
> > I just realized I made one more change:
> > I changed the offset of the partition to 65 to avoid conflicts with
> > the superblock as suggested by UCHIYAMA-san.
>
> Could you try reverting my change and see if that affects the
> behavior? (I don't have a 32-bit test setup any more...)
Reverting your commit doesn't change the behavior. The real problem
seems to have that"newfs_v7fs" tried to overwrite the disk label
because the partition started at offset 63. I'm therefore going
to close this PR.
> In the meantime the warning message about mmap has been removed, btw.
This seems to have been done.
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
State-Changed-From-To: open->closed
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 26 Aug 2011 06:53:49 +0000
State-Changed-Why:
"newfs_v7fs" works fine if you don't try to overwrite the disklabel.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.