NetBSD Problem Report #43573
From www@NetBSD.org Mon Jul 5 17:00:55 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 71D6163BA89
for <gnats-bugs@gnats.NetBSD.org>; Mon, 5 Jul 2010 17:00:55 +0000 (UTC)
Message-Id: <20100705170055.3B10963BA81@www.NetBSD.org>
Date: Mon, 5 Jul 2010 17:00:55 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: gnats-bugs@NetBSD.org
Subject: ffs superblock search prevents mounting tiny file systems
X-Send-Pr-Version: www-1.0
>Number: 43573
>Category: kern
>Synopsis: ffs superblock search prevents mounting tiny file systems
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 05 17:05:00 +0000 2010
>Last-Modified: Mon Jul 05 20:05:01 +0000 2010
>Originator: Antti Kantee
>Release:
>Organization:
>Environment:
>Description:
As reported by hubertf, a really tiny ffs file system will fail
to mount with EINVAL.
>How-To-Repeat:
mount tiny_ffs /mnt
>Fix:
maybe this, although I haven't done any critical thinking about it.
Index: ffs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.259
diff -p -u -r1.259 ffs_vfsops.c
--- ffs_vfsops.c 24 Jun 2010 13:03:19 -0000 1.259
+++ ffs_vfsops.c 5 Jul 2010 16:47:28 -0000
@@ -878,8 +878,7 @@ ffs_mountfs(struct vnode *devvp, struct
error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, cred,
0, &bp);
if (error) {
- fs = NULL;
- goto out;
+ continue;
}
fs = (struct fs*)bp->b_data;
fsblockloc = sblockloc = sblock_try[i];
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/43573: ffs superblock search prevents mounting tiny file
systems
Date: Mon, 5 Jul 2010 19:36:10 +0000
On Mon, Jul 05, 2010 at 05:05:00PM +0000, pooka@iki.fi wrote:
> maybe this, although I haven't done any critical thinking about it.
>
> [...]
> if (error) {
> - fs = NULL;
> - goto out;
> + continue;
> }
That should at least test for the expected error code... but wouldn't
it be a better plan to check the block number against the volume size?
--
David A. Holland
dholland@netbsd.org
From: Antti Kantee <pooka@iki.fi>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/43573: ffs superblock search prevents mounting tiny file systems
Date: Mon, 5 Jul 2010 23:03:46 +0300
On Mon Jul 05 2010 at 19:40:03 +0000, David Holland wrote:
> > maybe this, although I haven't done any critical thinking about it.
> >
> > [...]
> > if (error) {
> > - fs = NULL;
> > - goto out;
> > + continue;
> > }
>
> That should at least test for the expected error code... but wouldn't
> it be a better plan to check the block number against the volume size?
Sure testing against the size before the call is better. But how do you
reliably do that and as an added challenge be unracy (*)? getdisksize()
fails for some media and arbitrarily breaking file system mounts because
of this is not acceptable. VOP_GETATTR() result for devvp gives some
cached value that may or may not reflect reality. So I say we "ask"
the driver about the size in the form of the actual request and be happy
with that.
*) yes, if your media size changes from below you, you're probably in
trouble anyway, but no reason to go digging for trouble.
(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.