kern/94669: Panic from Failed Removable Media Mount
Jason Harmening
jason.harmening at gmail.com
Sun Apr 9 19:00:38 UTC 2006
The following reply was made to PR kern/94669; it has been noted by GNATS.
From: Jason Harmening <jason.harmening at gmail.com>
To: bug-followup at freebsd.org,
jason.harmening at gmail.com
Cc: Kris Kennaway <kris at obsecurity.org>
Subject: Re: kern/94669: Panic from Failed Removable Media Mount
Date: Sun, 9 Apr 2006 13:55:34 -0500
The following patch to vfs_mount.c (v1.196.2.8) has worked for me (so far):
--- vfs_mount_old.c Sat Apr 8 13:47:35 2006
+++ vfs_mount.c Sun Apr 9 13:46:47 2006
@@ -924,13 +924,18 @@
VI_LOCK(vp);
vp->v_iflag &= ~VI_MOUNT;
VI_UNLOCK(vp);
+ error = VFS_ROOT(mp, LK_EXCLUSIVE, &newdp, td);
+ if (error) {
+ VFS_UNMOUNT(mp, 0, td);
+ vfs_mount_destroy(mp, td);
+ vput(vp);
+ return (error);
+ }
vp->v_mountedhere = mp;
mtx_lock(&mountlist_mtx);
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mtx_unlock(&mountlist_mtx);
vfs_event_signal(NULL, VQ_MOUNT, 0);
- if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp, td))
- panic("mount: lost mount");
mountcheckdirs(vp, newdp);
vput(newdp);
VOP_UNLOCK(vp, 0, td);
Now if I encounter an I/O error while trying to mount, the mount will simply
fail, and I can successfully re-mount with no ill effects. I've only tested
this patch with UFS-formatted media, so I don't know if it will cause
problems for other filesystems. I'm also not very familiar with the FreeBSD
vfs, so there could very well be some gaping hole in this patch that I'm not
aware of.
More information about the freebsd-bugs
mailing list