Date: Sun, 9 Apr 2006 19:00:34 GMT From: Jason Harmening <jason.harmening@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/94669: Panic from Failed Removable Media Mount Message-ID: <200604091900.k39J0YPl026918@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/94669; it has been noted by GNATS. From: Jason Harmening <jason.harmening@gmail.com> To: bug-followup@freebsd.org, jason.harmening@gmail.com Cc: Kris Kennaway <kris@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604091900.k39J0YPl026918>