Under UFS/FFS the VFS_ROOT() function will return an error if the inode
check-hash fails. Panic'ing is not an appropriate response. So, check for an error return from VFS_ROOT() and when an error is reported, unwind and return the error. Reported by: Gary Jennejohn (gj) Sponsored by: Netflix
This commit is contained in:
parent
c8f55fc4b4
commit
e04d2a3c5a
@ -841,7 +841,7 @@ vfs_domount_first(
|
||||
struct vattr va;
|
||||
struct mount *mp;
|
||||
struct vnode *newdp;
|
||||
int error;
|
||||
int error, error1;
|
||||
|
||||
ASSERT_VOP_ELOCKED(vp, __func__);
|
||||
KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here"));
|
||||
@ -893,8 +893,14 @@ vfs_domount_first(
|
||||
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
|
||||
* get. No freeing of cn_pnbuf.
|
||||
*/
|
||||
error = VFS_MOUNT(mp);
|
||||
if (error != 0) {
|
||||
error1 = 0;
|
||||
if ((error = VFS_MOUNT(mp)) != 0 ||
|
||||
(error1 = VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) != 0) {
|
||||
if (error1 != 0) {
|
||||
error = error1;
|
||||
if ((error1 = VFS_UNMOUNT(mp, 0)) != 0)
|
||||
printf("VFS_UNMOUNT returned %d\n", error1);
|
||||
}
|
||||
vfs_unbusy(mp);
|
||||
mp->mnt_vnodecovered = NULL;
|
||||
vfs_mount_destroy(mp);
|
||||
@ -904,6 +910,7 @@ vfs_domount_first(
|
||||
vrele(vp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(newdp, 0);
|
||||
|
||||
if (mp->mnt_opt != NULL)
|
||||
vfs_freeopts(mp->mnt_opt);
|
||||
@ -935,8 +942,7 @@ vfs_domount_first(
|
||||
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))
|
||||
panic("mount: lost mount");
|
||||
vn_lock(newdp, LK_EXCLUSIVE | LK_RETRY);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
|
||||
VOP_UNLOCK(newdp, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user