Date: Fri, 19 Mar 2010 19:11:33 +0100 From: Fabian Keil <freebsd-listen@fabiankeil.de> To: freebsd-current@freebsd.org Subject: Re: newfs_msdos and DVD-RAM Message-ID: <20100319191133.46fe271c@r500.local> In-Reply-To: <3a142e751003191021p141af009m6acf7d160c890cbb@mail.gmail.com> References: <3a142e751003190508x6a06868ene2e8fd9ddd977f66@mail.gmail.com> <3a142e751003191021p141af009m6acf7d160c890cbb@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Paul B Mahol <onemda@gmail.com> wrote:
> FreeBSD 9.0 CURRENT panics when mounting file system created via
> newfs_msdos on DVD-RAM disc.
> Something to do about divide by zero.
I recently had a similar problem with a 16GB iPod. I still haven't
managed to actually mount it, but the patch below at least works
around the panic.
Does it work for you, too?
From 682d827f591d703e049274f495bf90f41b27c15f Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 19 Mar 2010 18:59:49 +0100
Subject: [PATCH] Work around weird msdosfs crash on mount. How can SecPerClust be zero here?
---
sys/fs/msdosfs/msdosfs_vfsops.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index f229e91..22913c2 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -606,6 +606,12 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
pmp->pm_firstcluster = pmp->pm_rootdirblk + pmp->pm_rootdirsize;
}
+ if (SecPerClust == 0) {
+ printf("SecPerClust is 0? When did this happen?\n");
+ error = EINVAL;
+ goto error_exit;
+ }
+
pmp->pm_maxcluster = (pmp->pm_HugeSectors - pmp->pm_firstcluster) /
SecPerClust + 1;
pmp->pm_fatsize = pmp->pm_FATsecs * DEV_BSIZE; /* XXX not used? */
--
1.6.6.2
Fabian
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)
iEYEARECAAYFAkujvl0ACgkQBYqIVf93VJ28kACguJnUzoumOpJtIQBx55dsPxFt
2LAAoIJviCRzKS4AUoNWpsFqeJvN/ChQ
=zzUu
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100319191133.46fe271c>
