Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Apr 2012 13:44:56 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234036 - head/sys/ufs/ffs
Message-ID:  <201204081344.q38DiuHx014196@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Apr  8 13:44:55 2012
New Revision: 234036
URL: http://svn.freebsd.org/changeset/base/234036

Log:
  Fix panic in ffs_reload(), which may happen when read-only filesystem
  gets resized and then reloaded.
  
  Reviewed by:	kib, mckusick (earlier version)
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Sun Apr  8 11:09:08 2012	(r234035)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Sun Apr  8 13:44:55 2012	(r234036)
@@ -675,8 +675,14 @@ ffs_reload(struct mount *mp, struct thre
 	/*
 	 * Step 3: re-read summary information from disk.
 	 */
-	blks = howmany(fs->fs_cssize, fs->fs_fsize);
-	space = fs->fs_csp;
+	size = fs->fs_cssize;
+	blks = howmany(size, fs->fs_fsize);
+	if (fs->fs_contigsumsize > 0)
+		size += fs->fs_ncg * sizeof(int32_t);
+	size += fs->fs_ncg * sizeof(u_int8_t);
+	free(fs->fs_csp, M_UFSMNT);
+	space = malloc((u_long)size, M_UFSMNT, M_WAITOK);
+	fs->fs_csp = space;
 	for (i = 0; i < blks; i += fs->fs_frag) {
 		size = fs->fs_bsize;
 		if (i + fs->fs_frag > blks)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204081344.q38DiuHx014196>