From owner-freebsd-fs@FreeBSD.ORG Wed Feb 2 21:13:51 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB0B1065673 for ; Wed, 2 Feb 2011 21:13:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx22.fluidhosting.com [204.14.89.5]) by mx1.freebsd.org (Postfix) with ESMTP id 018AC8FC20 for ; Wed, 2 Feb 2011 21:13:50 +0000 (UTC) Received: (qmail 25819 invoked by uid 399); 2 Feb 2011 21:13:50 -0000 Received: from localhost (HELO doug-optiplex.ka9q.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 2 Feb 2011 21:13:50 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4D49C90C.2090003@FreeBSD.org> Date: Wed, 02 Feb 2011 13:13:48 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.13) Gecko/20101212 Thunderbird/3.1.7 MIME-Version: 1.0 To: Aditya Sarawgi References: <4D47B954.3010600@FreeBSD.org> <201102011352.57998.jhb@freebsd.org> <20110202014252.GA1574@earth> In-Reply-To: <20110202014252.GA1574@earth> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-fs@freebsd.org Subject: Re: ext2fs crash in -current (r218056) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2011 21:13:51 -0000 I haven't had a chance to test this patch yet, but John's did not work (sorry): http://dougbarton.us/ext2fs-crash-dump-2.jpg No actual dump this time either. I'm happy to test the patch below on Thursday if there is consensus that it will work. Doug On 02/01/2011 17:42, Aditya Sarawgi wrote: > Hi John, > > I can see what you are saying. Can't we check > the number of free blocks in the given cg without > locking the fs. > This way > > EXT2_LOCK(ump); > return (0); > } > + if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0) { > + /* > + * Another thread allocated the last block in this > + * group while we were waiting for the buffer. > + */ > + brelse(bp); > + EXT2_LOCK(ump); > + return (0); > + } > bbp = (char *)bp->b_data; > > if (dtog(fs, bpref) != cg) > > > UFS is doing something similar > > static ufs2_daddr_t > ffs_alloccg(ip, cg, bpref, size, rsize) > struct inode *ip; > u_int cg; > ufs2_daddr_t bpref; > int size; > int rsize; > { > struct fs *fs; > struct cg *cgp; > struct buf *bp; > struct ufsmount *ump; > ufs1_daddr_t bno; > ufs2_daddr_t blkno; > int i, allocsiz, error, frags; > u_int8_t *blksfree; > > ump = ip->i_ump; > fs = ip->i_fs; > if (fs->fs_cs(fs, cg).cs_nbfree == 0&& size == fs->fs_bsize) > return (0); > UFS_UNLOCK(ump); > error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), > (int)fs->fs_cgsize, NOCRED,&bp); > if (error) > goto fail; > cgp = (struct cg *)bp->b_data; > if (!cg_chkmagic(cgp) || > (cgp->cg_cs.cs_nbfree == 0&& size == fs->fs_bsize)) > goto fail; >> 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; > > -- > Aditya Sarawgi > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" > -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/