Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Feb 2011 13:52:57 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Doug Barton <dougb@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: ext2fs crash in -current (r218056)
Message-ID:  <201102011352.57998.jhb@freebsd.org>
In-Reply-To: <4D47B954.3010600@FreeBSD.org>
References:  <4D47B954.3010600@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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