ext2fs crash in -current (r218056)

John Baldwin jhb at freebsd.org
Tue Feb 1 18:53:01 UTC 2011


On Tuesday, February 01, 2011 2:42:12 am Doug Barton wrote:
> As I've discussed here previously I am using ext2fs in -current as a 
> general-purpose /home directory, which includes my ports tree, and at 
> the time of the crash my WRKDIRPREFIX. I was doing some heavy ports 
> building to re-create my amd64-current system from scratch when the 
> following crash happened (sorry for the fuzzy photo):
> 
> http://dougbarton.us/ext2fs-crash-dump.jpg
> http://dougbarton.us/ext2fs-crash-dump.txt
> 
> Previous to the recent changes in -current I hadn't been experiencing 
> actual crashes, so I can't help think this is related to some of the 
> changes that John has been shepherding in recently.

Please try this:

Index: ext2_alloc.c
===================================================================
--- ext2_alloc.c	(revision 218175)
+++ ext2_alloc.c	(working copy)
@@ -650,6 +650,18 @@
 		EXT2_LOCK(ump);
 		return (0);
 	}
+	EXT2_LOCK(ump);
+	if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0) {
+		/*
+		 * Another thread allocated the last block in this
+		 * group while we were waiting for the buffer.
+		 */
+		EXT2_UNLOCK(ump);
+		brelse(bp);
+		EXT2_LOCK(ump);
+		return (0);
+	}
+	EXT2_UNLOCK(ump);
 	bbp = (char *)bp->b_data;
 
 	if (dtog(fs, bpref) != cg)
@@ -776,6 +788,18 @@
 		EXT2_LOCK(ump);
 		return (0);
 	}
+	EXT2_LOCK(ump);
+	if (fs->e2fs_gd[cg].ext2bgd_nifree == 0) {
+		/*
+		 * Another thread allocated the last i-node in this
+		 * group while we were waiting for the buffer.
+		 */
+		EXT2_UNLOCK(ump);
+		brelse(bp);
+		EXT2_LOCK(ump);
+		return (0);
+	}
+	EXT2_UNLOCK(ump);	
 	ibp = (char *)bp->b_data;
 	if (ipref) {
 		ipref %= fs->e2fs->e2fs_ipg;

-- 
John Baldwin


More information about the freebsd-fs mailing list