Re: panic: Most recently used by mount

From: Tim Robbins <tjr_at_freebsd.org>
Date: Mon, 10 Nov 2003 10:33:52 +1100
On Sun, Nov 09, 2003 at 01:30:52PM -0800, Kris Kennaway wrote:

> On Sun, Nov 09, 2003 at 06:05:06PM +0100, Lukas Ertl wrote:
> 
> > ---
> > panic: Most recently used by mount
> 
> I reported this the other day..tjr has a fix in his p4 branch.

Here's the patch:
(http://perforce.freebsd.org/chv.cgi?CH=41739)

--- kern/vfs_mount.c.old	Mon Nov 10 10:30:14 2003
+++ kern/vfs_mount.c	Sun Nov  9 00:26:03 2003
_at__at_ -700,6 +700,8 _at__at_
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		vrele(vp);
_at__at_ -794,6 +796,8 _at__at_
 		mac_destroy_mount(mp);
 #endif
 		crfree(mp->mnt_cred);
+		lockdestroy(&mp->mnt_lock);
+		mtx_destroy(&mp->mnt_mtx);
 		free(mp, M_MOUNT);
 		vput(vp);
 		goto bad;
_at__at_ -1066,6 +1070,8 _at__at_
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		vrele(vp);
_at__at_ -1147,6 +1153,8 _at__at_
 		mac_destroy_mount(mp);
 #endif
 		crfree(mp->mnt_cred);
+		lockdestroy(&mp->mnt_lock);
+		mtx_destroy(&mp->mnt_mtx);
 		free(mp, M_MOUNT);
 		vput(vp);
 	}
_at__at_ -1587,11 +1595,14 _at__at_
 		free(path, M_MOUNT);
 	if (error != 0) {
 		if (mp != NULL) {
+			mp->mnt_vfc->vfc_refcount--;
 			vfs_unbusy(mp, curthread);
 #ifdef MAC
 			mac_destroy_mount(mp);
 #endif
 			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
 		}
 		printf("Root mount failed: %d\n", error);
--- nfsclient/nfs_vfsops.c.old	Mon Nov 10 10:31:08 2003
+++ nfsclient/nfs_vfsops.c	Sun Nov  9 00:26:03 2003
_at__at_ -510,8 +510,15 _at__at_
 		printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
 		mp->mnt_vfc->vfc_refcount--;
 		vfs_unbusy(mp, td);
-		if (didalloc)
+		if (didalloc) {
+#ifdef MAC
+			mac_destroy_mount(mp);
+#endif
+			crfree(mp->mnt_cred);
+			lockdestroy(&mp->mnt_lock);
+			mtx_destroy(&mp->mnt_mtx);
 			free(mp, M_MOUNT);
+		}
 		FREE(nam, M_SONAME);
 		return (error);
 	}
Received on Sun Nov 09 2003 - 14:33:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:28 UTC