Date: Sun, 18 Oct 1998 12:09:24 +0900 (JST) From: Toshihiko ARAI <toshi@tenchi.ne.jp> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/8366: msdosfs re-mount kernel panic. Message-ID: <199810180309.MAA04256@lain.tenchi.ne.jp>
next in thread | raw e-mail | index | archive | help
>Number: 8366
>Category: kern
>Synopsis: msdosfs re-mount kernel panic.
>Confidential: yes
>Severity: critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Oct 17 20:40:01 PDT 1998
>Last-Modified:
>Originator: Toshihiko ARAI
>Organization:
Tenchi-Muyo! & PIONEER-LDC ML.
>Release: FreeBSD 2.2.7-RELEASE i386
>Environment:
FreeBSD 2.2.7-RELEASE and 2.2-STABLE
i386 and pc98 arch.
FAT16, FAT32 msdos filesystem.
>Description:
msdosfs bugs.
case 1: read-only -> writable -> file copy -> panic
case 2: read-write -> read-only -> panic
>How-To-Repeat:
/etc/fstab:
/dev/sd0s3 /msdos msdos ro 0 0
case 1
# mount /msdos
# mount -u -w /msdos
# cp foo.txt /msdos
# sync
panic: msdosfs_sync: rofs mod
rebooting...
case 2
writable mounted on /msdos
# mount -u -r /msdos
panic: vflush: not busy
rebooting...
>Fix:
cd <kernel source>/msdosfs
patch < patch-file
Index: msdosfs_denode.c
===================================================================
RCS file: /usr/tmp/cvsup/cvs/PAO/sys/msdosfs/msdosfs_denode.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 msdosfs_denode.c
--- msdosfs_denode.c 1998/07/24 10:22:22 1.1.1.2
+++ msdosfs_denode.c 1998/10/17 06:07:00
@@ -55,7 +55,10 @@
#include <sys/proc.h>
#include <sys/buf.h>
#include <sys/vnode.h>
+
+#ifndef __FreeBSD_version
#include <sys/kernel.h> /* defines "time" */
+#endif
#include <vm/vm.h>
#include <vm/vm_extern.h>
Index: msdosfs_lookup.c
===================================================================
RCS file: /usr/tmp/cvsup/cvs/PAO/sys/msdosfs/msdosfs_lookup.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 msdosfs_lookup.c
--- msdosfs_lookup.c 1998/07/24 10:22:25 1.1.1.2
+++ msdosfs_lookup.c 1998/10/17 05:25:25
@@ -942,9 +942,7 @@
int error;
daddr_t bn;
int blsize;
- u_long boff;
- boff = diroffset & ~pmp->pm_crbomask;
blsize = pmp->pm_bpcluster;
if (dirclust == MSDOSFSROOT
&& de_blk(pmp, diroffset + blsize) > pmp->pm_rootdirsize)
Index: msdosfs_vfsops.c
===================================================================
RCS file: /usr/tmp/cvsup/cvs/PAO/sys/msdosfs/msdosfs_vfsops.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 msdosfs_vfsops.c
--- msdosfs_vfsops.c 1998/07/24 10:22:29 1.1.1.3
+++ msdosfs_vfsops.c 1998/10/17 05:44:47
@@ -259,7 +259,14 @@
flags = WRITECLOSE;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
+#ifndef __FreeBSD_version
+ if (vfs_busy(mp))
+ return EBUSY;
+#endif
error = vflush(mp, NULLVP, flags);
+#ifndef __FreeBSD_version
+ vfs_unbusy(mp);
+#endif
}
if (!error && (mp->mnt_flag & MNT_RELOAD))
/* not yet implemented */
@@ -269,7 +276,7 @@
#ifdef __FreeBSD_version
if ((pmp->pm_flags & MSDOSFSMNT_RONLY) && (mp->mnt_kern_flag & MNTK_WANTRDWR)) {
#else
- if ((pmp->pm_flags & MSDOSFSMNT_RONLY) && (mp->mnt_flag & MNT_RDONLY) == 0) {
+ if ((pmp->pm_flags & MSDOSFSMNT_RONLY) && (mp->mnt_flag & MNT_WANTRDWR)) {
#endif
/*
* If upgrade to read-write by non-root, then verify
@@ -1134,4 +1141,8 @@
msdosfs_init
};
+#ifdef __FreeBSD_version
+VFS_SET(msdosfs_vfsops, msdos, 0);
+#else
VFS_SET(msdosfs_vfsops, msdos, MOUNT_MSDOS, 0);
+#endif
Index: msdosfs_vnops.c
===================================================================
RCS file: /usr/tmp/cvsup/cvs/PAO/sys/msdosfs/msdosfs_vnops.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 msdosfs_vnops.c
--- msdosfs_vnops.c 1998/07/24 10:22:31 1.1.1.2
+++ msdosfs_vnops.c 1998/10/17 05:50:11
@@ -1521,7 +1523,9 @@
#endif
goto bad;
}
- if (ip->de_dirclust != MSDOSFSROOT)
+ if (ip->de_dirclust == MSDOSFSROOT)
+ ip->de_diroffset = to_diroffset;
+ else
ip->de_diroffset = to_diroffset & pmp->pm_crbomask;
}
reinsert(ip);
@@ -2150,6 +2154,9 @@
static int
msdosfs_strategy(ap)
struct vop_strategy_args /* {
+#ifdef __FreeBSD_version
+ struct vnode *a_vp;
+#endif
struct buf *a_bp;
} */ *ap;
{
@@ -2187,7 +2194,11 @@
*/
vp = dep->de_devvp;
bp->b_dev = vp->v_rdev;
+#ifdef __FreeBSD_version
+ VOP_STRATEGY(vp, bp);
+#else
VOCALL(vp->v_op, VOFFSET(vop_strategy), ap);
+#endif
return (0);
}
@@ -2200,7 +2211,7 @@
struct denode *dep = VTODE(ap->a_vp);
printf(
- "tag VT_MSDOSFS, startcluster %d, dircluster %ld, diroffset %ld ",
+ "tag VT_MSDOSFS, startcluster %lu, dircluster %lu, diroffset %lu ",
dep->de_StartCluster, dep->de_dirclust, dep->de_diroffset);
printf(" dev %d, %d", major(dep->de_dev), minor(dep->de_dev));
#ifdef __FreeBSD_version
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810180309.MAA04256>
